Signed-off-by: IWAMOTO Toshihiro <[email protected]>
---
ryu/ofproto/ofproto_v1_3_parser.py | 6 +++---
ryu/ofproto/ofproto_v1_4_parser.py | 6 +++---
ryu/tests/unit/test_utils.py | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
b/ryu/ofproto/ofproto_v1_3_parser.py
index 3d288ff..3288878 100644
--- a/ryu/ofproto/ofproto_v1_3_parser.py
+++ b/ryu/ofproto/ofproto_v1_3_parser.py
@@ -2268,7 +2268,7 @@ class OFPPort(ofproto_parser.namedtuple('OFPPort', (
i = cls._fields.index('hw_addr')
port[i] = addrconv.mac.bin_to_text(port[i])
i = cls._fields.index('name')
- port[i] = port[i].rstrip('\0')
+ port[i] = port[i].rstrip(b'\0')
ofpport = cls(*port)
ofpport.length = ofproto.OFP_PORT_SIZE
return ofpport
@@ -3655,7 +3655,7 @@ class
OFPDescStats(ofproto_parser.namedtuple('OFPDescStats', (
desc = struct.unpack_from(ofproto.OFP_DESC_PACK_STR,
buf, offset)
desc = list(desc)
- desc = [x.rstrip('\0') for x in desc]
+ desc = [x.rstrip(b'\0') for x in desc]
stats = cls(*desc)
stats.length = ofproto.OFP_DESC_SIZE
return stats
@@ -4922,7 +4922,7 @@ class OFPTableFeaturesStats(StringifyMixin):
table_features.max_entries
) = struct.unpack_from(ofproto.OFP_TABLE_FEATURES_PACK_STR,
buf, offset)
- table_features.name = name.rstrip('\0')
+ table_features.name = name.rstrip(b'\0')
props = []
rest = buf[offset + ofproto.OFP_TABLE_FEATURES_SIZE:
diff --git a/ryu/ofproto/ofproto_v1_4_parser.py
b/ryu/ofproto/ofproto_v1_4_parser.py
index 1a6e0e7..7d4b6b3 100644
--- a/ryu/ofproto/ofproto_v1_4_parser.py
+++ b/ryu/ofproto/ofproto_v1_4_parser.py
@@ -1841,7 +1841,7 @@ class OFPPort(StringifyMixin):
(port_no, length, hw_addr, name, config, state) = struct.unpack_from(
ofproto.OFP_PORT_PACK_STR, buf, offset)
hw_addr = addrconv.mac.bin_to_text(hw_addr)
- name = name.rstrip('\0')
+ name = name.rstrip(b'\0')
props = []
rest = buf[offset + ofproto.OFP_PORT_SIZE:offset + length]
while rest:
@@ -2101,7 +2101,7 @@ class
OFPDescStats(ofproto_parser.namedtuple('OFPDescStats', (
desc = struct.unpack_from(ofproto.OFP_DESC_PACK_STR,
buf, offset)
desc = list(desc)
- desc = [x.rstrip('\0') for x in desc]
+ desc = [x.rstrip(b'\0') for x in desc]
stats = cls(*desc)
stats.length = ofproto.OFP_DESC_SIZE
return stats
@@ -2197,7 +2197,7 @@ class OFPTableFeaturesStats(StringifyMixin):
table_features.max_entries
) = struct.unpack_from(ofproto.OFP_TABLE_FEATURES_PACK_STR,
buf, offset)
- table_features.name = name.rstrip('\0')
+ table_features.name = name.rstrip(b'\0')
props = []
rest = buf[offset + ofproto.OFP_TABLE_FEATURES_SIZE:
diff --git a/ryu/tests/unit/test_utils.py b/ryu/tests/unit/test_utils.py
index 70843cf..64886c3 100644
--- a/ryu/tests/unit/test_utils.py
+++ b/ryu/tests/unit/test_utils.py
@@ -33,13 +33,13 @@ class Test_utils(unittest.TestCase):
def test_hex_array_string(self):
''' Test string conversion into array of hexes '''
expected_result = '0x1 0x2 0x3 0x4'
- data = '\01\02\03\04'
+ data = b'\01\02\03\04'
eq_(expected_result, utils.hex_array(data))
def test_hex_array_bytearray(self):
''' Test bytearray conversion into array of hexes '''
expected_result = '0x1 0x2 0x3 0x4'
- data = bytearray('\01\02\03\04')
+ data = bytearray(b'\01\02\03\04')
eq_(expected_result, utils.hex_array(data))
def test_hex_array_invalid(self):
--
2.1.4
------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel