Change default setting for Tellabs OLT to support multiple UNIs by default
Change-Id: I7fee8c4eec5cc3036088f7c04467472a7d964508
diff --git a/voltha/adapters/openolt/openolt_resource_manager.py b/voltha/adapters/openolt/openolt_resource_manager.py
index 2b6e432..503fc6c 100644
--- a/voltha/adapters/openolt/openolt_resource_manager.py
+++ b/voltha/adapters/openolt/openolt_resource_manager.py
@@ -36,7 +36,6 @@
self.host_and_port = host_and_port
self.extra_args = extra_args
self.device_info = device_info
- self.max_uni_id_per_onu = 0 #OpenOltPlatform.MAX_UNIS_PER_ONU, Uncomment or override to make default multi-uni
self.args = registry('main').get_args()
# KV store's IP Address and PORT
@@ -122,7 +121,13 @@
self.assert_pon_id_limit(pon_intf_id)
self.resource_mgrs[pon_intf_id].assert_resource_limits(onu_id, PONResourceManager.ONU_ID)
+ @property
+ def max_uni_id_per_onu(self):
+ return 0 #OpenOltPlatform.MAX_UNIS_PER_ONU-1, zero-based indexing Uncomment or override to make default multi-uni
+
def assert_uni_id_limit(self, pon_intf_id, onu_id, uni_id):
+ self.log.error('assert_uni_id_limit', max_uni_id_per_onu=self.max_uni_id_per_onu)
+
self.assert_onu_id_limit(pon_intf_id, onu_id)
self.resource_mgrs[pon_intf_id].assert_resource_limits(uni_id, PONResourceManager.UNI_ID)
@@ -382,7 +387,9 @@
flow_id_start_idx=flow_id_start,
flow_id_end_idx=flow_id_end,
flow_id_shared_pool_id=flow_id_shared_pool_id,
- intf_ids=arange.intf_ids)
+ intf_ids=arange.intf_ids,
+ uni_id_start_idx=0,
+ uni_id_end_idx=self.max_uni_id_per_onu)
resource_mgr.init_default_pon_resource_ranges(
onu_id_start_idx=onu_id_start,
diff --git a/voltha/adapters/tellabs_olt/tellabs_olt.py b/voltha/adapters/tellabs_olt/tellabs_olt.py
index e1653af..64db685 100644
--- a/voltha/adapters/tellabs_olt/tellabs_olt.py
+++ b/voltha/adapters/tellabs_olt/tellabs_olt.py
@@ -25,6 +25,7 @@
from voltha.protos.common_pb2 import LogLevel
from voltha.adapters.openolt.openolt import OpenoltAdapter, OpenOltDefaults
from voltha.adapters.openolt.openolt_device import OpenoltDevice
+from voltha.adapters.tellabs_olt.tellabs_resource_manager import TellabsResourceManager
log = structlog.get_logger()
@@ -58,6 +59,9 @@
support_classes = deepcopy(OpenOltDefaults)['support_classes']
+ # Customize resource_mgr
+ support_classes['resource_mgr'] = TellabsResourceManager
+
kwargs = {
'support_classes': support_classes,
'adapter_agent': self.adapter_agent,
diff --git a/voltha/adapters/tellabs_olt/tellabs_resource_manager.py b/voltha/adapters/tellabs_olt/tellabs_resource_manager.py
new file mode 100644
index 0000000..26ae5cb
--- /dev/null
+++ b/voltha/adapters/tellabs_olt/tellabs_resource_manager.py
@@ -0,0 +1,25 @@
+# Copyright 2018-present Tellabs, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from voltha.adapters.openolt.openolt import OpenOltResourceMgr, OpenOltPlatform
+
+class TellabsResourceManager(OpenOltResourceMgr):
+
+ def __init__(self, device_id, host_and_port, extra_args, device_info):
+ super(TellabsResourceManager, self).__init__(device_id, host_and_port, extra_args, device_info)
+
+ @property
+ def max_uni_id_per_onu(self):
+ return OpenOltPlatform.MAX_UNIS_PER_ONU-1