summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--ryu/ofproto/ofproto_v1_5_parser.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py
index c7d36b40..ecd0f9b3 100644
--- a/ryu/ofproto/ofproto_v1_5_parser.py
+++ b/ryu/ofproto/ofproto_v1_5_parser.py
@@ -250,7 +250,7 @@ class OFPErrorMsg(MsgBase):
@classmethod
def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
- type_, = struct.unpack_from('!H', buffer(buf),
+ type_, = struct.unpack_from('!H', six.binary_type(buf),
ofproto.OFP_HEADER_SIZE)
if type_ == ofproto.OFPET_EXPERIMENTER:
return OFPErrorExperimenterMsg.parser(datapath, version, msg_type,
@@ -1153,7 +1153,8 @@ class OFPPortDescPropRecirculate(OFPPortDescProp):
rest = cls.get_rest(buf)
nos = []
while rest:
- (n,) = struct.unpack_from(cls._PORT_NO_PACK_STR, buffer(rest), 0)
+ (n,) = struct.unpack_from(cls._PORT_NO_PACK_STR,
+ six.binary_type(rest), 0)
rest = rest[struct.calcsize(cls._PORT_NO_PACK_STR):]
nos.append(n)
return cls(port_nos=nos)
@@ -2284,7 +2285,7 @@ class OFPMultipartReply(MsgBase):
@classmethod
def parser(cls, datapath, version, msg_type, msg_len, xid, buf):
type_, flags = struct.unpack_from(
- ofproto.OFP_MULTIPART_REPLY_PACK_STR, buffer(buf),
+ ofproto.OFP_MULTIPART_REPLY_PACK_STR, six.binary_type(buf),
ofproto.OFP_HEADER_SIZE)
stats_type_cls = cls._STATS_MSG_TYPES.get(type_)
msg = super(OFPMultipartReply, stats_type_cls).parser(
@@ -2461,7 +2462,7 @@ class OFPInstructionId(StringifyMixin):
@classmethod
def parse(cls, buf):
- (type_, len_,) = struct.unpack_from(cls._PACK_STR, buffer(buf), 0)
+ (type_, len_,) = struct.unpack_from(cls._PACK_STR, six.binary_type(buf), 0)
rest = buf[len_:]
return cls(type_=type_, len_=len_), rest
@@ -2511,7 +2512,7 @@ class OFPActionId(StringifyMixin):
@classmethod
def parse(cls, buf):
- (type_, len_,) = struct.unpack_from(cls._PACK_STR, buffer(buf), 0)
+ (type_, len_,) = struct.unpack_from(cls._PACK_STR, six.binary_type(buf), 0)
rest = buf[len_:]
return cls(type_=type_, len_=len_), rest
@@ -2564,7 +2565,7 @@ class OFPTableFeaturePropNextTables(OFPTableFeatureProp):
rest = cls.get_rest(buf)
ids = []
while rest:
- (i,) = struct.unpack_from(cls._TABLE_ID_PACK_STR, buffer(rest), 0)
+ (i,) = struct.unpack_from(cls._TABLE_ID_PACK_STR, six.binary_type(rest), 0)
rest = rest[struct.calcsize(cls._TABLE_ID_PACK_STR):]
ids.append(i)
return cls(table_ids=ids)
@@ -2615,7 +2616,7 @@ class OFPOxmId(StringifyMixin):
@classmethod
def parse(cls, buf):
- (oxm,) = struct.unpack_from(cls._PACK_STR, buffer(buf), 0)
+ (oxm,) = struct.unpack_from(cls._PACK_STR, six.binary_type(buf), 0)
# oxm (32 bit) == class (16) | field (7) | hasmask (1) | length (8)
# in case of experimenter OXMs, another 32 bit value
# (experimenter id) follows.
@@ -2626,7 +2627,7 @@ class OFPOxmId(StringifyMixin):
class_ = oxm >> (7 + 1 + 8)
if class_ == ofproto.OFPXMC_EXPERIMENTER:
(exp_id,) = struct.unpack_from(cls._EXPERIMENTER_ID_PACK_STR,
- buffer(rest), 0)
+ six.binary_type(rest), 0)
rest = rest[struct.calcsize(cls._EXPERIMENTER_ID_PACK_STR):]
subcls = OFPExperimenterOxmId
return subcls(type_=type_, exp_id=exp_id, hasmask=hasmask,