VOL-1489: Process packet in and packet out
Can successfully recieve packet from openolt
agent and proxy to core then ofagent then onos
and back. tested with eapol and dhcp
Change-Id: I0ec573ae791fec3b2c31730b5736c5a760ec3bc5
diff --git a/python/adapters/openolt/openolt.py b/python/adapters/openolt/openolt.py
index 7e1a3e6..1e81c67 100644
--- a/python/adapters/openolt/openolt.py
+++ b/python/adapters/openolt/openolt.py
@@ -269,22 +269,12 @@
proxied_msg=msg)
raise NotImplementedError()
- def receive_packet_out(self, logical_device_id, egress_port_no, msg):
- log.debug('packet-out', logical_device_id=logical_device_id,
- egress_port_no=egress_port_no, msg_len=len(msg))
-
- def ldi_to_di(ldi):
- di = self.logical_device_id_to_root_device_id.get(ldi)
- if di is None:
- logical_device = self.adapter_agent.get_logical_device(ldi)
- di = logical_device.root_device_id
- self.logical_device_id_to_root_device_id[ldi] = di
- return di
-
+ def receive_packet_out(self, device_id, port_no, packet):
+ log.debug('packet-out', device_id=device_id,
+ port_no=port_no, msg_len=len(packet.data))
try:
- device_id = ldi_to_di(logical_device_id)
handler = self.devices[device_id]
- handler.packet_out(egress_port_no, msg)
+ handler.packet_out(port_no, packet.data)
except Exception as e:
log.error('packet-out:exception', e=e.message)
diff --git a/python/adapters/openolt/openolt_device.py b/python/adapters/openolt/openolt_device.py
index 17cc6ad..5d8eb8e 100644
--- a/python/adapters/openolt/openolt_device.py
+++ b/python/adapters/openolt/openolt_device.py
@@ -687,7 +687,7 @@
if pkt_indication.intf_type == "pon":
if pkt_indication.port_no:
- logical_port_num = pkt_indication.port_no
+ port_num = pkt_indication.port_no
else: # TODO Remove this else block after openolt device has been fully rolled out with cookie protobuf change
try:
onu_id_uni_id = self.resource_mgr.get_onu_uni_from_ponport_gemport(pkt_indication.intf_id,
@@ -699,7 +699,7 @@
raise Exception("onu-id-none")
if uni_id is None:
raise Exception("uni-id-none")
- logical_port_num = self.platform.mk_uni_port_num(pkt_indication.intf_id, onu_id, uni_id)
+ port_num = self.platform.mk_uni_port_num(pkt_indication.intf_id, onu_id, uni_id)
except Exception as e:
self.log.error("no-onu-reference-for-gem",
gemport_id=pkt_indication.gemport_id, e=e)
@@ -707,19 +707,19 @@
elif pkt_indication.intf_type == "nni":
- logical_port_num = self.platform.intf_id_to_port_no(
+ port_num = self.platform.intf_id_to_port_no(
pkt_indication.intf_id,
Port.ETHERNET_NNI)
pkt = Ether(pkt_indication.pkt)
self.log.debug("packet indication",
- logical_device_id=self.logical_device_id,
- logical_port_no=logical_port_num)
+ device_id=self.device_id,
+ port_num=port_num)
- yield self.adapter_agent.send_packet_in(
- logical_device_id=self.logical_device_id,
- logical_port_no=logical_port_num,
+ yield self.core_proxy.send_packet_in(
+ device_id=self.device_id,
+ port=port_num,
packet=str(pkt))
def packet_out(self, egress_port, msg):