diff options
author | IWAMOTO Toshihiro <iwamoto@valinux.co.jp> | 2015-07-03 11:27:12 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-07-03 11:38:00 +0900 |
commit | f99b50474245bb2702c9d6792c861cd68b975b66 (patch) | |
tree | a7858a6bea46c98e8036a41185ee7a366d2af328 | |
parent | 8df05b17d00994738d04391808412e56e9c5d176 (diff) |
python3: Use b'str' for binary data
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/packet/bgp.py | 6 | ||||
-rw-r--r-- | ryu/lib/packet/cfm.py | 18 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_bgp.py | 44 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_bmp.py | 16 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_icmp.py | 8 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_icmpv6.py | 4 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_igmp.py | 2 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_lldp.py | 20 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_ospf.py | 16 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_pbb.py | 2 | ||||
-rw-r--r-- | ryu/tests/unit/packet/test_vlan.py | 4 |
11 files changed, 70 insertions, 70 deletions
diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py index cd324c7c..80e56c16 100644 --- a/ryu/lib/packet/bgp.py +++ b/ryu/lib/packet/bgp.py @@ -1599,7 +1599,7 @@ class BGPPathAttributeAtomicAggregate(_PathAttribute): return {} def serialize_value(self): - return '' + return b'' class _BGPPathAttributeAggregatorCommon(_PathAttribute): @@ -2014,7 +2014,7 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute): next_hop_bin = rest[:next_hop_len] rest = rest[next_hop_len:] reserved = rest[:1] - assert reserved == '\0' + assert reserved == b'\0' binnlri = rest[1:] addr_cls = _get_addr_class(afi, safi) nlri = [] @@ -2068,7 +2068,7 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute): next_hop_len = self.next_hop_len next_hop_bin = self._next_hop_bin - self._reserved = '\0' + self._reserved = b'\0' buf = bytearray() msg_pack_into(self._VALUE_PACK_STR, buf, 0, self.afi, diff --git a/ryu/lib/packet/cfm.py b/ryu/lib/packet/cfm.py index e4544b19..032c928f 100644 --- a/ryu/lib/packet/cfm.py +++ b/ryu/lib/packet/cfm.py @@ -742,11 +742,11 @@ class sender_id_tlv(tlv): length=0, chassis_id_length=0, chassis_id_subtype=_CHASSIS_ID_MAC_ADDRESS, - chassis_id="", + chassis_id=b'', ma_domain_length=0, - ma_domain="", + ma_domain=b'', ma_length=0, - ma="" + ma=b'' ): super(sender_id_tlv, self).__init__(length) self._type = CFM_SENDER_ID_TLV @@ -771,11 +771,11 @@ class sender_id_tlv(tlv): (type_, length, chassis_id_length) = struct.unpack_from(cls._PACK_STR, buf) chassis_id_subtype = 4 - chassis_id = "" + chassis_id = b'' ma_domain_length = 0 - ma_domain = "" + ma_domain = b'' ma_length = 0 - ma = "" + ma = b'' offset = cls._MIN_LEN if chassis_id_length != 0: (chassis_id_subtype, ) = struct.unpack_from("!B", buf, offset) @@ -1230,7 +1230,7 @@ class reply_tlv(tlv): mac_address) = struct.unpack_from(cls._PACK_STR, buf) port_id_length = 0 port_id_subtype = 0 - port_id = "" + port_id = b'' if length > cls._MIN_VALUE_LEN: (port_id_length, port_id_subtype) = struct.unpack_from('!2B', buf, cls._MIN_LEN) @@ -1309,7 +1309,7 @@ class reply_ingress_tlv(reply_tlv): mac_address='00:00:00:00:00:00', port_id_length=0, port_id_subtype=0, - port_id="" + port_id=b'' ): super(reply_ingress_tlv, self).__init__(length, action, mac_address, port_id_length, @@ -1358,7 +1358,7 @@ class reply_egress_tlv(reply_tlv): mac_address='00:00:00:00:00:00', port_id_length=0, port_id_subtype=0, - port_id="" + port_id=b'' ): super(reply_egress_tlv, self).__init__(length, action, mac_address, port_id_length, diff --git a/ryu/tests/unit/packet/test_bgp.py b/ryu/tests/unit/packet/test_bgp.py index 92a6dad9..8b77cc63 100644 --- a/ryu/tests/unit/packet/test_bgp.py +++ b/ryu/tests/unit/packet/test_bgp.py @@ -39,11 +39,11 @@ class Test_bgp(unittest.TestCase): msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) eq_(len(msg), 29) - eq_(rest, '') + eq_(rest, b'') def test_open2(self): opt_param = [bgp.BGPOptParamCapabilityUnknown(cap_code=200, - cap_value='hoge'), + cap_value=b'hoge'), bgp.BGPOptParamCapabilityGracefulRestart(flags=0, time=120, tuples=[]), @@ -54,14 +54,14 @@ class Test_bgp(unittest.TestCase): bgp.BGPOptParamCapabilityCarryingLabelInfo(), bgp.BGPOptParamCapabilityFourOctetAsNumber( as_number=1234567), - bgp.BGPOptParamUnknown(type_=99, value='fuga')] + bgp.BGPOptParamUnknown(type_=99, value=b'fuga')] msg = bgp.BGPOpen(my_as=30000, bgp_identifier='192.0.2.2', opt_param=opt_param) binmsg = msg.serialize() msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) ok_(len(msg) > 29) - eq_(rest, '') + eq_(rest, b'') def test_update1(self): msg = bgp.BGPUpdate() @@ -69,7 +69,7 @@ class Test_bgp(unittest.TestCase): msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) eq_(len(msg), 23) - eq_(rest, '') + eq_(rest, b'') def test_update2(self): withdrawn_routes = [bgp.BGPWithdrawnRoute(length=0, @@ -105,8 +105,8 @@ class Test_bgp(unittest.TestCase): bgp.BGPIPv4AddressSpecificExtendedCommunity( subtype=3, ipv4_address='192.0.2.1', local_administrator=65432), - bgp.BGPOpaqueExtendedCommunity(opaque='abcdefg'), - bgp.BGPUnknownExtendedCommunity(type_=99, value='abcdefg'), + bgp.BGPOpaqueExtendedCommunity(opaque=b'abcdefg'), + bgp.BGPUnknownExtendedCommunity(type_=99, value=b'abcdefg'), ] path_attributes = [ bgp.BGPPathAttributeOrigin(value=1), @@ -134,7 +134,7 @@ class Test_bgp(unittest.TestCase): nlri=mp_nlri2), bgp.BGPPathAttributeMpUnreachNLRI(afi=afi.IP, safi=safi.MPLS_VPN, withdrawn_routes=mp_nlri), - bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * 'bar') + bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * b'bar') ] nlri = [ bgp.BGPNLRI(length=24, addr='203.0.113.1'), @@ -147,7 +147,7 @@ class Test_bgp(unittest.TestCase): msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) ok_(len(msg) > 23) - eq_(rest, '') + eq_(rest, b'') def test_keepalive(self): msg = bgp.BGPKeepAlive() @@ -155,16 +155,16 @@ class Test_bgp(unittest.TestCase): msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) eq_(len(msg), 19) - eq_(rest, '') + eq_(rest, b'') def test_notification(self): - data = "hoge" + data = b'hoge' msg = bgp.BGPNotification(error_code=1, error_subcode=2, data=data) binmsg = msg.serialize() msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) eq_(len(msg), 21 + len(data)) - eq_(rest, '') + eq_(rest, b'') def test_route_refresh(self): msg = bgp.BGPRouteRefresh(afi=afi.IP, safi=safi.MPLS_VPN) @@ -172,13 +172,13 @@ class Test_bgp(unittest.TestCase): msg2, rest = bgp.BGPMessage.parser(binmsg) eq_(str(msg), str(msg2)) eq_(len(msg), 23) - eq_(rest, '') + eq_(rest, b'') def test_stream_parser(self): msgs = [ - bgp.BGPNotification(error_code=1, error_subcode=2, data="foo"), - bgp.BGPNotification(error_code=3, error_subcode=4, data="bar"), - bgp.BGPNotification(error_code=5, error_subcode=6, data="baz"), + bgp.BGPNotification(error_code=1, error_subcode=2, data=b'foo'), + bgp.BGPNotification(error_code=3, error_subcode=4, data=b'bar'), + bgp.BGPNotification(error_code=5, error_subcode=6, data=b'baz'), ] binmsgs = b''.join([bytes(msg.serialize()) for msg in msgs]) sp = bgp.StreamParser() @@ -205,17 +205,17 @@ class Test_bgp(unittest.TestCase): msg, rest = bgp.BGPMessage.parser(binmsg) binmsg2 = msg.serialize() eq_(binmsg, binmsg2) - eq_(rest, '') + eq_(rest, b'') def test_json1(self): opt_param = [bgp.BGPOptParamCapabilityUnknown(cap_code=200, - cap_value='hoge'), + cap_value=b'hoge'), bgp.BGPOptParamCapabilityRouteRefresh(), bgp.BGPOptParamCapabilityMultiprotocol( afi=afi.IP, safi=safi.MPLS_VPN), bgp.BGPOptParamCapabilityFourOctetAsNumber( as_number=1234567), - bgp.BGPOptParamUnknown(type_=99, value='fuga')] + bgp.BGPOptParamUnknown(type_=99, value=b'fuga')] msg1 = bgp.BGPOpen(my_as=30000, bgp_identifier='192.0.2.2', opt_param=opt_param) jsondict = msg1.to_jsondict() @@ -253,8 +253,8 @@ class Test_bgp(unittest.TestCase): bgp.BGPIPv4AddressSpecificExtendedCommunity( subtype=3, ipv4_address='192.0.2.1', local_administrator=65432), - bgp.BGPOpaqueExtendedCommunity(opaque='abcdefg'), - bgp.BGPUnknownExtendedCommunity(type_=99, value='abcdefg'), + bgp.BGPOpaqueExtendedCommunity(opaque=b'abcdefg'), + bgp.BGPUnknownExtendedCommunity(type_=99, value=b'abcdefg'), ] path_attributes = [ bgp.BGPPathAttributeOrigin(value=1), @@ -277,7 +277,7 @@ class Test_bgp(unittest.TestCase): nlri=mp_nlri), bgp.BGPPathAttributeMpUnreachNLRI(afi=afi.IP, safi=safi.MPLS_VPN, withdrawn_routes=mp_nlri), - bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * 'bar') + bgp.BGPPathAttributeUnknown(flags=0, type_=100, value=300 * b'bar') ] nlri = [ bgp.BGPNLRI(length=24, addr='203.0.113.1'), diff --git a/ryu/tests/unit/packet/test_bmp.py b/ryu/tests/unit/packet/test_bmp.py index 67c2c755..f9433700 100644 --- a/ryu/tests/unit/packet/test_bmp.py +++ b/ryu/tests/unit/packet/test_bmp.py @@ -47,7 +47,7 @@ class Test_bmp(unittest.TestCase): binmsg = msg.serialize() msg2, rest = bmp.BMPMessage.parser(binmsg) eq_(msg.to_jsondict(), msg2.to_jsondict()) - eq_(rest, '') + eq_(rest, b'') def test_statistics_report(self): stats = [{'type': bmp.BMP_STAT_TYPE_REJECTED, 'value': 100}, @@ -66,11 +66,11 @@ class Test_bmp(unittest.TestCase): binmsg = msg.serialize() msg2, rest = bmp.BMPMessage.parser(binmsg) eq_(msg.to_jsondict(), msg2.to_jsondict()) - eq_(rest, '') + eq_(rest, b'') def test_peer_down_notification(self): reason = bmp.BMP_PEER_DOWN_REASON_LOCAL_BGP_NOTIFICATION - data = "hoge" + data = b'hoge' data = bgp.BGPNotification(error_code=1, error_subcode=2, data=data) msg = bmp.BMPPeerDownNotification(reason=reason, data=data, peer_type=bmp.BMP_PEER_TYPE_GLOBAL, @@ -83,11 +83,11 @@ class Test_bmp(unittest.TestCase): binmsg = msg.serialize() msg2, rest = bmp.BMPMessage.parser(binmsg) eq_(msg.to_jsondict(), msg2.to_jsondict()) - eq_(rest, '') + eq_(rest, b'') def test_peer_up_notification(self): opt_param = [bgp.BGPOptParamCapabilityUnknown(cap_code=200, - cap_value='hoge'), + cap_value=b'hoge'), bgp.BGPOptParamCapabilityRouteRefresh(), bgp.BGPOptParamCapabilityMultiprotocol( afi=afi.IP, safi=safi.MPLS_VPN)] @@ -108,7 +108,7 @@ class Test_bmp(unittest.TestCase): binmsg = msg.serialize() msg2, rest = bmp.BMPMessage.parser(binmsg) eq_(msg.to_jsondict(), msg2.to_jsondict()) - eq_(rest, '') + eq_(rest, b'') def test_initiation(self): initiation_info = [{'type': bmp.BMP_INIT_TYPE_STRING, @@ -117,7 +117,7 @@ class Test_bmp(unittest.TestCase): binmsg = msg.serialize() msg2, rest = bmp.BMPMessage.parser(binmsg) eq_(msg.to_jsondict(lambda v: v), msg2.to_jsondict(lambda v: v)) - eq_(rest, '') + eq_(rest, b'') def test_termination(self): termination_info = [{'type': bmp.BMP_TERM_TYPE_STRING, @@ -128,4 +128,4 @@ class Test_bmp(unittest.TestCase): binmsg = msg.serialize() msg2, rest = bmp.BMPMessage.parser(binmsg) eq_(msg.to_jsondict(lambda v: v), msg2.to_jsondict(lambda v: v)) - eq_(rest, '') + eq_(rest, b'') diff --git a/ryu/tests/unit/packet/test_icmp.py b/ryu/tests/unit/packet/test_icmp.py index 2858c84c..fddf668a 100644 --- a/ryu/tests/unit/packet/test_icmp.py +++ b/ryu/tests/unit/packet/test_icmp.py @@ -78,7 +78,7 @@ class Test_icmp(unittest.TestCase): def setUp_with_dest_unreach(self): self.unreach_mtu = 10 - self.unreach_data = 'abc' + self.unreach_data = b'abc' self.unreach_data_len = len(self.unreach_data) self.data = icmp.dest_unreach( data_len=self.unreach_data_len, mtu=self.unreach_mtu, @@ -95,7 +95,7 @@ class Test_icmp(unittest.TestCase): struct.pack_into('!H', self.buf, 2, self.csum_calc) def setUp_with_TimeExceeded(self): - self.te_data = 'abc' + self.te_data = b'abc' self.te_data_len = len(self.te_data) self.data = icmp.TimeExceeded( data_len=self.te_data_len, data=self.te_data) @@ -305,7 +305,7 @@ class Test_dest_unreach(unittest.TestCase): def setUp(self): self.mtu = 10 - self.data = 'abc' + self.data = b'abc' self.data_len = len(self.data) self.dest_unreach = icmp.dest_unreach( data_len=self.data_len, mtu=self.mtu, data=self.data) @@ -346,7 +346,7 @@ class Test_dest_unreach(unittest.TestCase): class Test_TimeExceeded(unittest.TestCase): def setUp(self): - self.data = 'abc' + self.data = b'abc' self.data_len = len(self.data) self.te = icmp.TimeExceeded( data_len=self.data_len, data=self.data) diff --git a/ryu/tests/unit/packet/test_icmpv6.py b/ryu/tests/unit/packet/test_icmpv6.py index b9b8201a..c6438171 100644 --- a/ryu/tests/unit/packet/test_icmpv6.py +++ b/ryu/tests/unit/packet/test_icmpv6.py @@ -315,7 +315,7 @@ class Test_icmpv6_neighbor_solicit(unittest.TestCase): eq_(csum, nd_csum) eq_(res >> 29, self.res) eq_(dst, addrconv.ipv6.text_to_bin(self.dst)) - eq_(data, '') + eq_(data, b'') def test_serialize_with_data(self): nd_opt = icmpv6.nd_option_sla(self.nd_length, self.nd_hw_src) @@ -606,7 +606,7 @@ class Test_icmpv6_router_solicit(unittest.TestCase): eq_(code, self.code) eq_(csum, rs_csum) eq_(res[0], self.res) - eq_(data, '') + eq_(data, b'') def test_serialize_with_data(self): nd_opt = icmpv6.nd_option_sla(self.nd_length, self.nd_hw_src) diff --git a/ryu/tests/unit/packet/test_igmp.py b/ryu/tests/unit/packet/test_igmp.py index 813b443d..e2f9b3cc 100644 --- a/ryu/tests/unit/packet/test_igmp.py +++ b/ryu/tests/unit/packet/test_igmp.py @@ -988,7 +988,7 @@ class Test_igmpv3_report_group(unittest.TestCase): eq_(res[2], addrconv.ipv4.text_to_bin(srcs[2])) # aux without aux_len - aux = 'abcde' + aux = b'abcde' rep = igmpv3_report_group(aux=aux) buf = rep.serialize() res = unpack_from(igmpv3_report_group._PACK_STR, six.binary_type(buf)) diff --git a/ryu/tests/unit/packet/test_lldp.py b/ryu/tests/unit/packet/test_lldp.py index 12f78d1e..3612fa8a 100644 --- a/ryu/tests/unit/packet/test_lldp.py +++ b/ryu/tests/unit/packet/test_lldp.py @@ -63,7 +63,7 @@ class TestLLDPMandatoryTLV(unittest.TestCase): eq_(tlvs[1].tlv_type, lldp.LLDP_TLV_PORT_ID) eq_(tlvs[1].len, 4) eq_(tlvs[1].subtype, lldp.PortID.SUB_INTERFACE_NAME) - eq_(tlvs[1].port_id, '1/3') + eq_(tlvs[1].port_id, b'1/3') eq_(tlvs[2].tlv_type, lldp.LLDP_TLV_TTL) eq_(tlvs[2].len, 2) eq_(tlvs[2].ttl, 120) @@ -89,7 +89,7 @@ class TestLLDPMandatoryTLV(unittest.TestCase): tlv_chassis_id = lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS, chassis_id=b'\x00\x04\x96\x1f\xa7\x26') tlv_port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/3') + port_id=b'1/3') tlv_ttl = lldp.TTL(ttl=120) tlv_end = lldp.End() tlvs = (tlv_chassis_id, tlv_port_id, tlv_ttl, tlv_end) @@ -111,7 +111,7 @@ class TestLLDPMandatoryTLV(unittest.TestCase): chassis_id=addrconv.mac. text_to_bin(src)) tlv_port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/3') + port_id=b'1/3') tlv_ttl = lldp.TTL(ttl=120) tlv_end = lldp.End() tlvs = (tlv_chassis_id, tlv_port_id, tlv_ttl, tlv_end) @@ -127,7 +127,7 @@ class TestLLDPMandatoryTLV(unittest.TestCase): chassis_id = lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS, chassis_id=b'\x00\x04\x96\x1f\xa7\x26') port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/3') + port_id=b'1/3') ttl = lldp.TTL(ttl=120) end = lldp.End() tlvs = (chassis_id, port_id, ttl, end) @@ -183,7 +183,7 @@ class TestLLDPMandatoryTLV(unittest.TestCase): chassis_id = lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS, chassis_id=b'\x00\x04\x96\x1f\xa7\x26') port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/3') + port_id=b'1/3') ttl = lldp.TTL(ttl=120) end = lldp.End() tlvs = (chassis_id, port_id, ttl, end) @@ -260,7 +260,7 @@ class TestLLDPOptionalTLV(unittest.TestCase): eq_(tlvs[5].tlv_type, lldp.LLDP_TLV_SYSTEM_DESCRIPTION) eq_(tlvs[5].system_description, - 'Summit300-48 - Version 7.4e.1 (Build 5) ' + b'Summit300-48 - Version 7.4e.1 (Build 5) ' + b'by Release_Master 05/27/05 04:53:11\x00') # SystemCapabilities @@ -304,7 +304,7 @@ class TestLLDPOptionalTLV(unittest.TestCase): chassis_id=addrconv.mac. text_to_bin(src)) tlv_port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/1') + port_id=b'1/1') tlv_ttl = lldp.TTL(ttl=120) tlv_port_description = lldp.PortDescription( port_description=b'Summit300-48-Port 1001\x00') @@ -319,7 +319,7 @@ class TestLLDPOptionalTLV(unittest.TestCase): tlv_management_address = lldp.ManagementAddress( addr_subtype=0x06, addr=b'\x00\x01\x30\xf9\xad\xa0', intf_subtype=0x02, intf_num=1001, - oid='') + oid=b'') tlv_organizationally_specific = lldp.OrganizationallySpecific( oui=b'\x00\x12\x0f', subtype=0x02, info=b'\x07\x01\x00') tlv_end = lldp.End() @@ -342,7 +342,7 @@ class TestLLDPOptionalTLV(unittest.TestCase): chassis_id = lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS, chassis_id=b'\x00\x01\x30\xf9\xad\xa0') port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/1') + port_id=b'1/1') ttl = lldp.TTL(ttl=120) port_desc = lldp.PortDescription( port_description=b'Summit300-48-Port 1001\x00') @@ -497,7 +497,7 @@ class TestLLDPOptionalTLV(unittest.TestCase): chassis_id = lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS, chassis_id=b'\x00\x01\x30\xf9\xad\xa0') port_id = lldp.PortID(subtype=lldp.PortID.SUB_INTERFACE_NAME, - port_id='1/1') + port_id=b'1/1') ttl = lldp.TTL(ttl=120) port_desc = lldp.PortDescription( port_description=b'Summit300-48-Port 1001\x00') diff --git a/ryu/tests/unit/packet/test_ospf.py b/ryu/tests/unit/packet/test_ospf.py index 4c9bab55..df57b8de 100644 --- a/ryu/tests/unit/packet/test_ospf.py +++ b/ryu/tests/unit/packet/test_ospf.py @@ -38,7 +38,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.LSA.parser(binmsg) eq_(msg.header.checksum, msg2.header.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_network_lsa(self): msg = ospf.NetworkLSA(id_='192.168.0.1', adv_router='192.168.0.2', @@ -47,7 +47,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.LSA.parser(binmsg) eq_(msg.header.checksum, msg2.header.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_as_external_lsa(self): extnw1 = ospf.ASExternalLSA.ExternalNetwork(mask='255.255.255.0', @@ -59,7 +59,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.LSA.parser(binmsg) eq_(msg.header.checksum, msg2.header.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_hello(self): msg = ospf.OSPFHello(router_id='192.168.0.1', @@ -68,7 +68,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.OSPFMessage.parser(binmsg) eq_(msg.checksum, msg2.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_dbdesc(self): link1 = ospf.RouterLSA.Link(id_='10.0.0.1', data='255.255.255.0', @@ -81,7 +81,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.OSPFMessage.parser(binmsg) eq_(msg.checksum, msg2.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_lsreq(self): req = ospf.OSPFLSReq.Request(type_=ospf.OSPF_ROUTER_LSA, @@ -92,7 +92,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.OSPFMessage.parser(binmsg) eq_(msg.checksum, msg2.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_lsupd(self): link1 = ospf.RouterLSA.Link(id_='10.0.0.1', data='255.255.255.0', @@ -104,7 +104,7 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.OSPFMessage.parser(binmsg) eq_(msg.checksum, msg2.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') def test_lsack(self): link1 = ospf.RouterLSA.Link(id_='10.0.0.1', data='255.255.255.0', @@ -117,4 +117,4 @@ class Test_ospf(unittest.TestCase): msg2, cls, rest = ospf.OSPFMessage.parser(binmsg) eq_(msg.checksum, msg2.checksum) eq_(str(msg), str(msg2)) - eq_(rest, '') + eq_(rest, b'') diff --git a/ryu/tests/unit/packet/test_pbb.py b/ryu/tests/unit/packet/test_pbb.py index fc892df1..dd7778cd 100644 --- a/ryu/tests/unit/packet/test_pbb.py +++ b/ryu/tests/unit/packet/test_pbb.py @@ -113,7 +113,7 @@ class Test_itag(unittest.TestCase): csum = 0xa7f2 src = '131.151.32.21' dst = '131.151.32.129' - option = 'TEST' + option = b'TEST' ip = ipv4.ipv4(version, header_length, tos, total_length, identification, flags, offset, ttl, proto, csum, src, dst, option) diff --git a/ryu/tests/unit/packet/test_vlan.py b/ryu/tests/unit/packet/test_vlan.py index df54db7e..b8e3a048 100644 --- a/ryu/tests/unit/packet/test_vlan.py +++ b/ryu/tests/unit/packet/test_vlan.py @@ -100,7 +100,7 @@ class Test_vlan(unittest.TestCase): csum = 0xa7f2 src = '131.151.32.21' dst = '131.151.32.129' - option = 'TEST' + option = b'TEST' ip = ipv4(version, header_length, tos, total_length, identification, flags, offset, ttl, proto, csum, src, dst, option) @@ -217,7 +217,7 @@ class Test_svlan(unittest.TestCase): csum = 0xa7f2 src = '131.151.32.21' dst = '131.151.32.129' - option = 'TEST' + option = b'TEST' ip = ipv4(version, header_length, tos, total_length, identification, flags, offset, ttl, proto, csum, src, dst, option) |