VOL-764: OpenOLT - Change PON OLT port numbering
Change-Id: Ia3ac4945d3f46283fcf46827a4818677e16891c6
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 0c37427..69d9941 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -236,7 +236,7 @@
self.nni_oper_state[intf_oper_indication.intf_id] = oper_state
port_no, label = self.add_port(intf_oper_indication.intf_id, Port.ETHERNET_NNI, oper_state)
self.log.debug("int_oper_indication", port_no=port_no, label=label)
- self.add_logical_port(port_no) # FIXME - add oper_state
+ self.add_logical_port(port_no, intf_oper_indication.intf_id) # FIXME - add oper_state
elif intf_oper_indication.intf_id != self.nni_oper_state:
# FIXME - handle subsequent NNI oper state change
pass
@@ -345,7 +345,7 @@
#
# v_enet create (onu)
#
- interface_name = self.port_name(onu_indication.intf_id, Port.PON_OLT)
+ interface_name = self.port_name(onu_indication.intf_id, Port.PON_OLT, onu_indication.intf_id)
msg = {'proxy_address':onu_device.proxy_address,
'event':'create-venet',
'event_data':{'uni_name':uni_name, 'interface_name':uni_name}}
@@ -454,16 +454,17 @@
elif intf_type is Port.PON_OLT:
# Interface Ids (reported by device) are zero-based indexed
# OpenFlow port numbering is one-based.
- return intf_id + 65 # FIXME
+ #return intf_id + 65 # FIXME
+ return 0x2<<28 | intf_id
else:
raise Exception('Invalid port type')
- def port_name(self, port_no, port_type):
+ def port_name(self, port_no, port_type, intf_id=None):
if port_type is Port.ETHERNET_NNI:
prefix = "nni"
elif port_type is Port.PON_OLT:
- prefix = "pon"
+ return "pon" + str(intf_id)
elif port_type is Port.ETHERNET_UNI:
prefix = "uni"
return prefix + "-" + str(port_no)
@@ -479,7 +480,7 @@
device.reason = reason
self.adapter_agent.update_device(device)
- def add_logical_port(self, port_no):
+ def add_logical_port(self, port_no, intf_id):
self.log.info('adding-logical-port', port_no=port_no)
label = self.port_name(port_no, Port.ETHERNET_NNI)
@@ -503,7 +504,7 @@
def add_port(self, intf_id, port_type, oper_status):
port_no = self.intf_id_to_port_no(intf_id, port_type)
- label = self.port_name(port_no, port_type)
+ label = self.port_name(port_no, port_type, intf_id)
self.log.info('adding-port', port_no=port_no, label=label,
port_type=port_type)