VOL-1286 OpenOLT - remove unused method new_onu_id()
Plus, minor pep8 cleanup.
Change-Id: I0f0c6a9441eeeda10d7c3124d78b7478b1a68062
diff --git a/voltha/adapters/openolt/openolt.py b/voltha/adapters/openolt/openolt.py
index 137096d..50c84af 100644
--- a/voltha/adapters/openolt/openolt.py
+++ b/voltha/adapters/openolt/openolt.py
@@ -51,6 +51,7 @@
}
}
+
@implementer(IAdapterInterface)
class OpenoltAdapter(object):
name = 'openolt'
@@ -210,7 +211,7 @@
def update_flows_bulk(self, device, flows, groups):
log.info('bulk-flow-update', device_id=device.id,
number_of_flows=len(flows.items), number_of_groups=len(
- groups.items))
+ groups.items))
log.debug('flows and grousp details', flows=flows, groups=groups)
assert len(groups.items) == 0, "Cannot yet deal with groups"
handler = self.devices[device.id]
@@ -227,7 +228,7 @@
groups, device_rules_map):
log.info('logical-flows-update', flows_to_add=len(flows_to_add),
- flows_to_remove = len(flows_to_remove))
+ flows_to_remove=len(flows_to_remove))
log.debug('logical-flows-details', flows_to_add=flows_to_add,
flows_to_remove=flows_to_remove)
assert len(groups) == 0, "Cannot yet deal with groups"
@@ -237,7 +238,7 @@
def update_pm_config(self, device, pm_configs):
log.info('update_pm_config - Not implemented yet', device=device,
- pm_configs=pm_configs)
+ pm_configs=pm_configs)
raise NotImplementedError()
def send_proxied_message(self, proxy_address, msg):
@@ -375,13 +376,13 @@
handler.delete_child_device(child_device)
else:
log.error('Could not find matching handler',
- looking_for_device_id =parent_device_id,
+ looking_for_device_id=parent_device_id,
available_handlers=self.devices.keys())
# This is currently not part of the Iadapter interface
def collect_stats(self, device_id):
log.info('collect_stats', device_id=device_id)
- handler= self.devices[device_id]
+ handler = self.devices[device_id]
if handler is not None:
handler.trigger_statistics_collection()
else:
@@ -395,7 +396,8 @@
if device.id not in self.devices:
log.error("Device does not exist", device_id=device.id)
return OperationResp(code=OperationResp.OPERATION_FAILURE,
- additional_info="Device %s does not exist" % device.id)
+ additional_info="Device %s does not exist"
+ % device.id)
handler = self.devices[device.id]
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 943fb66..14d48a8 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -187,9 +187,9 @@
self.platform = self.platform_class(self.log, device_info)
self.resource_mgr = self.resource_mgr_class(self.device_id,
- self.host_and_port,
- self.extra_args,
- device_info)
+ self.host_and_port,
+ self.extra_args,
+ device_info)
self.flow_mgr = self.flow_mgr_class(self.log, self.stub,
self.device_id,
@@ -208,7 +208,6 @@
device.hardware_version = device_info.hardware_version
device.firmware_version = device_info.firmware_version
-
# TODO: check for uptime and reboot if too long (VOL-1192)
device.connect_status = ConnectStatus.REACHABLE
@@ -403,8 +402,6 @@
serial_number=serial_number_str)
if onu_device is None:
- onu_id = self.new_onu_id(intf_id)
-
try:
onu_id = self.resource_mgr.get_onu_id(intf_id)
if onu_id is None:
@@ -496,16 +493,17 @@
onu_id=onu_indication.onu_id)
return
- # We will use this alloc_id and gemport_id to pass on to the onu adapter
+ # We will use this alloc_id, gemport_id to pass on to the onu adapter
pon_intf_onu_id = (onu_indication.intf_id, onu_indication.onu_id)
alloc_id = self.resource_mgr.get_alloc_id(pon_intf_onu_id)
gemport_id = self.resource_mgr.get_gemport_id(pon_intf_onu_id)
if self.platform.intf_id_from_pon_port_no(onu_device.parent_port_no) \
!= onu_indication.intf_id:
+ previous_intf_id = self.platform.intf_id_from_pon_port_no(
+ onu_device.parent_port_no),
self.log.warn('ONU-is-on-a-different-intf-id-now',
- previous_intf_id=self.platform.intf_id_from_pon_port_no(
- onu_device.parent_port_no),
+ previous_intf_id=previous_intf_id,
current_intf_id=onu_indication.intf_id)
# FIXME - handle intf_id mismatch (ONU move?)
@@ -517,7 +515,7 @@
received_onu_id=onu_indication.onu_id)
uni_no = self.platform.mk_uni_port_num(onu_indication.intf_id,
- onu_indication.onu_id)
+ onu_indication.onu_id)
uni_name = self.port_name(uni_no, Port.ETHERNET_UNI,
serial_number=onu_device.serial_number)
@@ -669,7 +667,8 @@
flow_id=pkt_indication.flow_id)
if pkt_indication.intf_type == "pon":
- pon_intf_gemport = (pkt_indication.intf_id, pkt_indication.gemport_id)
+ pon_intf_gemport = (pkt_indication.intf_id,
+ pkt_indication.gemport_id)
try:
onu_id = int(self.resource_mgr.kv_store[pon_intf_gemport])
if onu_id is None:
@@ -679,8 +678,8 @@
gemport_id=pkt_indication.gemport_id, e=e)
return
- logical_port_num = self.platform.mk_uni_port_num(pkt_indication.intf_id,
- onu_id)
+ logical_port_num = self.platform.mk_uni_port_num(
+ pkt_indication.intf_id, onu_id)
elif pkt_indication.intf_type == "nni":
logical_port_num = self.platform.intf_id_to_port_no(
pkt_indication.intf_id,
@@ -881,19 +880,6 @@
self.adapter_agent.delete_port(self.device_id, port)
return
- def new_onu_id(self, intf_id):
- onu_devices = self.adapter_agent.get_child_devices(self.device_id)
- pon_onu_ids = [onu_device.proxy_address.onu_id
- for onu_device in onu_devices
- if onu_device.proxy_address.channel_id == intf_id]
- for i in range(1, self.platform.max_onus_per_pon()):
- if i not in pon_onu_ids:
- return i
-
- self.log.error('All available onu_ids taken on this pon',
- intf_id=intf_id, ids_taken=self.platform.max_onus_per_pon())
- return None
-
def update_flow_table(self, flows):
self.log.debug('No updates here now, all is done in logical flows '
'update')