[VOL-1524] Use port labels as port IDs
This commit consists of the following:
1) Update the simulated OLT and ONU adapters to set the port label
using the port number
2) Update the ponsim OLT and ONU adapters to set the port label
using the port number.
3) Update the logic to verify whether a logical port exist using
the port label.
4) Update the logical device lock when adding a port to the logical
device to prevent two requests to add the same port from
occuring in parallel.
Change-Id: Ia5a732db1f3fc6e559acd7e70ae9659113b6fa9f
diff --git a/python/adapters/ponsim_onu/ponsim_onu.py b/python/adapters/ponsim_onu/ponsim_onu.py
index a10c235..e0592b4 100644
--- a/python/adapters/ponsim_onu/ponsim_onu.py
+++ b/python/adapters/ponsim_onu/ponsim_onu.py
@@ -209,17 +209,23 @@
log.info("initial-pm-config", pm_config=pm_config)
yield self.core_proxy.device_pm_config_update(pm_config, init=True)
+ # Use the channel Id, assigned by the parent device to me, as the port number
+ uni_port = 2
+ if device.proxy_address is not None:
+ if device.proxy_address.channel_id != 0:
+ uni_port = device.proxy_address.channel_id
+
# register physical ports
self.uni_port = Port(
- port_no=2,
- label='UNI facing Ethernet port',
+ port_no=uni_port,
+ label="uni-" + str(uni_port),
type=Port.ETHERNET_UNI,
admin_state=AdminState.ENABLED,
oper_status=OperStatus.ACTIVE
)
self.pon_port = Port(
port_no=1,
- label='PON port',
+ label='pon-1',
type=Port.PON_ONU,
admin_state=AdminState.ENABLED,
oper_status=OperStatus.ACTIVE,