VOL-1352 - Use serial_number reported by device instead of host:port.
Currently the logical device's serial number is set to the
host:port of the olt. This was done since the device's
serial number was not reported by the openolt agent.
Since the openolt agent now reports the actual device serial
number, this commit makes it a requirement to use the
device's serial number in the onos config.
This change will require onos sadis config to specify
the serial number instead of host:port:
"entries" : [
{
"id" : "EC1721000216",
"hardwareIdentifier" : "de:ad:be:ef:ba:11",
"uplinkPort" : 65536
},
This commit requires the corresponsing openolt agent change which
provides the serial number in the device_info:
commit 42bc6ec6af647ebd42e690c0e28e1d5623ab912f
Author: Thiyagarajan Subramani <Thiyagarajan.Subramani@radisys.com>
Date: Sat Feb 2 03:21:43 2019 -0800
VOL-1392: OpenOLT driver should send the actual device serial number
Change-Id: I1c9703568bc85f7e8e3c62313a4a9abaa9d7b1e7
Change-Id: I9a40717baf6ca23d6a1171d4e79f49a0c5175133
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 0b8ec62..ac6489e 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -105,11 +105,6 @@
self.log.info('openolt-device-init')
- # default device id and device serial number. If device_info provides
- # better results, they will be updated
- self.dpid = kwargs.get('dp_id')
- self.serial_number = self.host_and_port # FIXME
-
# Device already set in the event of reconciliation
if not is_reconciliation:
self.log.info('updating-device')
@@ -120,7 +115,6 @@
device.oper_status = OperStatus.ACTIVATING
self.adapter_agent.update_device(device)
- self.logical_device_id = None
# If logical device does exist use it, else create one after connecting
# to device
if device.parent_id:
@@ -145,11 +139,6 @@
dpid = device_info.device_id
serial_number = device_info.device_serial_number
- if dpid is None:
- dpid = self.dpid
- if serial_number is None:
- serial_number = self.serial_number
-
if dpid is None or dpid == '':
uri = self.host_and_port.split(":")[0]
try:
@@ -193,9 +182,6 @@
device.serial_number = serial_number
self.adapter_agent.update_device(device)
- self.dpid = dpid
- self.serial_number = serial_number
-
self.log.info('created-openolt-logical-device',
logical_device_id=ld_init.id)
@@ -244,6 +230,11 @@
def do_state_connected(self, event):
self.log.debug("do_state_connected")
+ # Check that device_info was successfully retrieved
+ assert(self.device_info is not None
+ and self.device_info.device_serial_number is not None
+ and self.device_info.device_serial_number != '')
+
device = self.adapter_agent.get_device(self.device_id)
if self.logical_device_id is None:
@@ -255,7 +246,7 @@
# TODO - Update logical device with new device_info
pass
- device.serial_number = self.serial_number
+ device.serial_number = self.device_info.device_serial_number
self.resource_mgr = self.resource_mgr_class(self.device_id,
self.host_and_port,