diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2016-10-19 13:36:15 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-10-25 16:20:12 +0900 |
commit | 2ebb9218b2429b627f257d9db6e8ec7fac52c0cf (patch) | |
tree | 208282db7e32fc42f89e16c71a6208b897beb076 | |
parent | e80a36317aacb142c282e0795b9f5b3a20aec1dc (diff) |
rest_router: Fix conversion of Packet Library to dict
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.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/app/rest_router.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ryu/app/rest_router.py b/ryu/app/rest_router.py index 2098ffae..81a3be46 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 |