summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorfumihiko kakuma <kakuma@valinux.co.jp>2015-06-27 21:07:19 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-06-27 21:08:47 +0900
commit645ae7633fdc6938429ed1a6ff3c6b174ad9a049 (patch)
tree136db455d0e6c1a424da6bf9f108b841a9ea7930
parentb48fedc7295cb0c9c3fe62fc2d2f124b7fc739f8 (diff)
python3: Continuous patch to replace buffer to six.binary_type
python3: Continuous patch to replace buffer to six.binary_type Signed-off-by: Fumihiko Kakuma <kakuma@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/ofproto_v1_0_parser.py7
-rw-r--r--ryu/tests/unit/lib/test_ofp_pktinfilter.py5
-rw-r--r--ryu/tests/unit/ofproto/test_parser_compat.py2
-rw-r--r--ryu/tests/unit/ofproto/test_parser_v10.py56
-rw-r--r--ryu/tests/unit/ofproto/test_parser_v12.py44
5 files changed, 58 insertions, 56 deletions
diff --git a/ryu/ofproto/ofproto_v1_0_parser.py b/ryu/ofproto/ofproto_v1_0_parser.py
index f4648f7f..1582a695 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -20,6 +20,7 @@ Decoder/Encoder implementations of OpenFlow 1.0.
import struct
import binascii
+import six
from ryu.ofproto.ofproto_parser import StringifyMixin, MsgBase, msg_str_attr
from ryu.lib import addrconv
@@ -1877,7 +1878,7 @@ class OFPStatsReply(MsgBase):
@classmethod
def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
type_, flags = struct.unpack_from(ofproto.OFP_STATS_MSG_PACK_STR,
- buffer(buf),
+ six.binary_type(buf),
ofproto.OFP_HEADER_SIZE)
stats_type_cls = cls._STATS_MSG_TYPES.get(type_)
msg = stats_type_cls.parser_stats(
@@ -1956,7 +1957,7 @@ class OFPVendorStatsReply(OFPStatsReply):
def parser_stats(cls, datapath, version, msg_type, msg_len, xid,
buf):
(type_,) = struct.unpack_from(
- ofproto.OFP_VENDOR_STATS_MSG_PACK_STR, buffer(buf),
+ ofproto.OFP_VENDOR_STATS_MSG_PACK_STR, six.binary_type(buf),
ofproto.OFP_STATS_MSG_SIZE)
cls_ = cls._STATS_VENDORS.get(type_)
@@ -2017,7 +2018,7 @@ class NXStatsReply(OFPStatsReply):
def parser(cls, datapath, version, msg_type, msg_len, xid, buf,
offset):
(type_,) = struct.unpack_from(
- ofproto.NX_STATS_MSG_PACK_STR, buffer(buf), offset)
+ ofproto.NX_STATS_MSG_PACK_STR, six.binary_type(buf), offset)
offset += ofproto.NX_STATS_MSG0_SIZE
cls_ = cls._NX_STATS_TYPES.get(type_)
diff --git a/ryu/tests/unit/lib/test_ofp_pktinfilter.py b/ryu/tests/unit/lib/test_ofp_pktinfilter.py
index c1eeffe0..2c037737 100644
--- a/ryu/tests/unit/lib/test_ofp_pktinfilter.py
+++ b/ryu/tests/unit/lib/test_ofp_pktinfilter.py
@@ -17,6 +17,7 @@
import unittest
import logging
+import six
from nose.tools import *
@@ -65,7 +66,7 @@ class Test_packet_in_filter(unittest.TestCase):
pkt = (e / v / i)
pkt.serialize()
pkt_in = ofproto_v1_3_parser.OFPPacketIn(datapath,
- data=buffer(pkt.data))
+ data=six.binary_type(pkt.data))
ev = ofp_event.EventOFPPacketIn(pkt_in)
ok_(self.app.packet_in_handler(ev))
@@ -78,7 +79,7 @@ class Test_packet_in_filter(unittest.TestCase):
pkt = (e / i)
pkt.serialize()
pkt_in = ofproto_v1_3_parser.OFPPacketIn(datapath,
- data=buffer(pkt.data))
+ data=six.binary_type(pkt.data))
ev = ofp_event.EventOFPPacketIn(pkt_in)
ok_(not self.app.packet_in_handler(ev))
diff --git a/ryu/tests/unit/ofproto/test_parser_compat.py b/ryu/tests/unit/ofproto/test_parser_compat.py
index 9a879f05..fc22f04f 100644
--- a/ryu/tests/unit/ofproto/test_parser_compat.py
+++ b/ryu/tests/unit/ofproto/test_parser_compat.py
@@ -131,7 +131,7 @@ class Test_Parser_Compat(unittest.TestCase):
# a parsed object can be inspected by old and new api
- check(ofpp.OFPMatch.parser(buffer(new_buf), 0))
+ check(ofpp.OFPMatch.parser(six.binary_type(new_buf), 0))
check(ofpp.OFPMatch.from_jsondict(list(new_jsondict.values())[0]))
diff --git a/ryu/tests/unit/ofproto/test_parser_v10.py b/ryu/tests/unit/ofproto/test_parser_v10.py
index 1895f65a..3d2539b4 100644
--- a/ryu/tests/unit/ofproto/test_parser_v10.py
+++ b/ryu/tests/unit/ofproto/test_parser_v10.py
@@ -204,7 +204,7 @@ class TestOFPMatch(unittest.TestCase):
c.serialize(buf, 0)
fmt = ofproto.OFP_MATCH_PACK_STR
- res = struct.unpack_from(fmt, buffer(buf))
+ res = struct.unpack_from(fmt, six.binary_type(buf))
eq_(self.wildcards['val'], res[0])
eq_(self.in_port['val'], res[1])
@@ -252,7 +252,7 @@ class TestOFPActionHeader(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_HEADER_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type['val'], res[0])
eq_(self.len['val'], res[1])
@@ -319,7 +319,7 @@ class TestOFPActionOutput(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_OUTPUT_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -386,7 +386,7 @@ class TestOFPActionVlanVid(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_VLAN_VID_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -451,7 +451,7 @@ class TestOFPActionVlanPcp(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_VLAN_PCP_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -574,7 +574,7 @@ class TestOFPActionSetDlSrc(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_DL_ADDR_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -648,7 +648,7 @@ class TestOFPActionSetDlDst(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_DL_ADDR_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -719,7 +719,7 @@ class TestOFPActionSetNwSrc(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_NW_ADDR_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -790,7 +790,7 @@ class TestOFPActionSetNwDst(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_NW_ADDR_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -855,7 +855,7 @@ class TestOFPActionSetNwTos(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_NW_TOS_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -931,7 +931,7 @@ class TestOFPActionSetTpSrc(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_TP_PORT_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1007,7 +1007,7 @@ class TestOFPActionSetTpDst(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_TP_PORT_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1079,7 +1079,7 @@ class TestOFPActionEnqueue(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_ENQUEUE_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1134,7 +1134,7 @@ class TestNXActionResubmit(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_RESUBMIT_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1191,7 +1191,7 @@ class TestNXActionResubmitTable(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_RESUBMIT_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1244,7 +1244,7 @@ class TestNXActionSetTunnel(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_SET_TUNNEL_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1298,7 +1298,7 @@ class TestNXActionSetQueue(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_SET_QUEUE_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1352,7 +1352,7 @@ class TestNXActionPopQueue(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_POP_QUEUE_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1424,7 +1424,7 @@ class TestNXActionRegMove(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_REG_MOVE_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1492,7 +1492,7 @@ class TestNXActionRegLoad(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_REG_LOAD_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1549,7 +1549,7 @@ class TestNXActionSetTunnel64(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_SET_TUNNEL64_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1633,7 +1633,7 @@ class TestNXActionMultipath(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_MULTIPATH_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -1752,7 +1752,7 @@ class TestNXActionBundle(unittest.TestCase):
+ ofproto.NX_ACTION_BUNDLE_PACK_STR.replace('!', '') \
+ 'HH4x'
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self._len, res[1])
@@ -1871,7 +1871,7 @@ class TestNXActionBundleLoad(unittest.TestCase):
+ ofproto.NX_ACTION_BUNDLE_PACK_STR.replace('!', '') \
+ 'HH4x'
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self._len, res[1])
@@ -1947,7 +1947,7 @@ class TestNXActionAutopath(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_AUTOPATH_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -2019,7 +2019,7 @@ class TestNXActionOutputReg(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_OUTPUT_REG_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -2075,7 +2075,7 @@ class TestNXActionExit(unittest.TestCase):
self.c.serialize(buf, 0)
fmt = ofproto.NX_ACTION_HEADER_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(self.type_['val'], res[0])
eq_(self.len_['val'], res[1])
@@ -2696,7 +2696,7 @@ class TestOFPHello(unittest.TestCase):
eq_(msg_type, res.msg_type)
eq_(msg_len, res.msg_len)
eq_(xid, res.xid)
- eq_(buffer(buf), res.buf)
+ eq_(six.binary_type(buf), six.binary_type(res.buf))
def test_serialize(self):
diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py b/ryu/tests/unit/ofproto/test_parser_v12.py
index 91baf233..ccffcac4 100644
--- a/ryu/tests/unit/ofproto/test_parser_v12.py
+++ b/ryu/tests/unit/ofproto/test_parser_v12.py
@@ -137,7 +137,7 @@ class TestOFPHello(unittest.TestCase):
eq_(msg_type, res.msg_type)
eq_(msg_len, res.msg_len)
eq_(xid, res.xid)
- eq_(buffer(buf), res.buf)
+ eq_(six.binary_type(buf), six.binary_type(res.buf))
def test_parser_xid_min(self):
xid = 0
@@ -2819,7 +2819,7 @@ class TestOFPInstructionGotoTable(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], table_id)
@@ -2892,7 +2892,7 @@ class TestOFPInstructionWriteMetadata(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], metadata)
@@ -3010,7 +3010,7 @@ class TestOFPInstructionActions(unittest.TestCase):
for a in range(action_cnt):
fmt += ofproto.OFP_ACTION_OUTPUT_PACK_STR.replace('!', '')
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], len_)
@@ -3063,7 +3063,7 @@ class TestOFPActionHeader(unittest.TestCase):
c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_HEADER_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(res[0], type_)
eq_(res[1], len_)
@@ -3141,7 +3141,7 @@ class TestOFPActionOutput(unittest.TestCase):
c.serialize(buf, 0)
fmt = ofproto.OFP_ACTION_OUTPUT_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], port)
@@ -3207,7 +3207,7 @@ class TestOFPActionGroup(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], group_id)
@@ -3261,7 +3261,7 @@ class TestOFPActionSetQueue(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], queue_id)
@@ -3315,7 +3315,7 @@ class TestOFPActionSetMplsTtl(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], mpls_ttl)
@@ -3350,7 +3350,7 @@ class TestOFPActionDecMplsTtl(unittest.TestCase):
buf = bytearray()
self.c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
@@ -3394,7 +3394,7 @@ class TestOFPActionSetNwTtl(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], nw_ttl)
@@ -3429,7 +3429,7 @@ class TestOFPActionDecNwTtl(unittest.TestCase):
buf = bytearray()
self.c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
@@ -3453,7 +3453,7 @@ class TestOFPActionCopyTtlOut(unittest.TestCase):
buf = bytearray()
self.c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
@@ -3480,7 +3480,7 @@ class TestOFPActionCopyTtlIn(unittest.TestCase):
buf = bytearray()
self.c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
@@ -3522,7 +3522,7 @@ class TestOFPActionPushVlan(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], ethertype)
@@ -3574,7 +3574,7 @@ class TestOFPActionPushMpls(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], ethertype)
@@ -3610,7 +3610,7 @@ class TestOFPActionPopVlan(unittest.TestCase):
buf = bytearray()
self.c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
@@ -3652,7 +3652,7 @@ class TestOFPActionPopMpls(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], ethertype)
@@ -3699,7 +3699,7 @@ class TestOFPActionSetField(unittest.TestCase):
buf = bytearray()
self.c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
@@ -3748,7 +3748,7 @@ class TestOFPActionExperimenter(unittest.TestCase):
buf = bytearray()
c.serialize(buf, 0)
- res = struct.unpack(self.fmt, buffer(buf))
+ res = struct.unpack(self.fmt, six.binary_type(buf))
eq_(res[0], self.type_)
eq_(res[1], self.len_)
eq_(res[2], experimenter)
@@ -3872,7 +3872,7 @@ class TestOFPBucket(unittest.TestCase):
fmt = ofproto.OFP_BUCKET_PACK_STR
for a in range(action_cnt):
fmt += ofproto.OFP_ACTION_OUTPUT_PACK_STR[1:]
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(res[0], len_)
eq_(res[1], weight)
@@ -6178,7 +6178,7 @@ class TestOFPQueuePropHeader(unittest.TestCase):
c.serialize(buf, 0)
fmt = ofproto.OFP_QUEUE_PROP_HEADER_PACK_STR
- res = struct.unpack(fmt, buffer(buf))
+ res = struct.unpack(fmt, six.binary_type(buf))
eq_(res[0], property_)
eq_(res[1], len_)