On Python3, rest_router fails to compare the type of protocols in
the Packet Library instances, because the non-parsed packet data
is not str type but bytes type.
This patch fixes to compare the protocols instance type with
packet_base.PacketBase and enable to convert the Packet Library
instances to dict.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
---
 ryu/app/rest_router.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ryu/app/rest_router.py b/ryu/app/rest_router.py
index 2098ffa..81a3be4 100644
--- a/ryu/app/rest_router.py
+++ b/ryu/app/rest_router.py
@@ -40,6 +40,7 @@ from ryu.lib.packet import ethernet
 from ryu.lib.packet import icmp
 from ryu.lib.packet import ipv4
 from ryu.lib.packet import packet
+from ryu.lib.packet import packet_base
 from ryu.lib.packet import tcp
 from ryu.lib.packet import udp
 from ryu.lib.packet import vlan
@@ -569,7 +570,8 @@ class Router(dict):
         # TODO: Packet library convert to string
         # self.logger.debug('Packet in = %s', str(pkt), self.sw_id)
         header_list = dict((p.protocol_name, p)
-                           for p in pkt.protocols if type(p) != str)
+                           for p in pkt.protocols
+                           if isinstance(p, packet_base.PacketBase))
         if header_list:
             # Check vlan-tag
             vlan_id = VLANID_NONE
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to