On Mon, 22 Jun 2015 19:20:55 +0900
IWAMOTO Toshihiro <[email protected]> wrote:

> At Mon, 22 Jun 2015 19:09:59 +0900,
> IWAMOTO Toshihiro wrote:
>> 
>> python3 doesn't have buffer() and it doesn't seem to be necessary from first.
> 
> Is there a reason for using buffer?
> If buffer-like thing is necessary in python3, memoryview can be used.

Looks like this breaks python2.6 support. You can look at the full log at:

https://travis-ci.org/fujita/ryu

 
>> 
>> Signed-off-by: IWAMOTO Toshihiro <[email protected]>
>> ---
>>  ryu/lib/packet/bgp.py                         | 66 
>> +++++++++++++--------------
>>  ryu/lib/packet/bmp.py                         | 33 ++++++--------
>>  ryu/lib/packet/ospf.py                        | 30 ++++++------
>>  ryu/ofproto/ofproto_parser.py                 |  8 +++-
>>  ryu/ofproto/ofproto_v1_3_parser.py            | 16 +++----
>>  ryu/tests/unit/lib/test_ofp_pktinfilter.py    |  2 +-
>>  ryu/tests/unit/lib/test_pack_utils.py         |  2 +-
>>  ryu/tests/unit/ofproto/test_ofproto_parser.py |  5 ++
>>  ryu/tests/unit/packet/test_icmpv6.py          | 40 ++++++++--------
>>  ryu/tests/unit/packet/test_igmp.py            | 16 +++----
>>  10 files changed, 112 insertions(+), 106 deletions(-)
>> 
>> diff --git a/ryu/lib/packet/bgp.py b/ryu/lib/packet/bgp.py
>> index 623260f..cc95ce1 100644
>> --- a/ryu/lib/packet/bgp.py
>> +++ b/ryu/lib/packet/bgp.py
>> @@ -174,7 +174,7 @@ class _Value(object):
>>  
>>      @classmethod
>>      def parse_value(cls, buf):
>> -        values = struct.unpack_from(cls._VALUE_PACK_STR, buffer(buf))
>> +        values = struct.unpack_from(cls._VALUE_PACK_STR, buf)
>>          return dict(zip(cls._VALUE_FIELDS, values))
>>  
>>      def serialize_value(self):
>> @@ -623,7 +623,7 @@ class _RouteDistinguisher(StringifyMixin, _TypeDisp, 
>> _Value):
>>      @classmethod
>>      def parser(cls, buf):
>>          assert len(buf) == 8
>> -        (type_,) = struct.unpack_from(cls._PACK_STR, buffer(buf))
>> +        (type_,) = struct.unpack_from(cls._PACK_STR, buf)
>>          rest = buf[struct.calcsize(cls._PACK_STR):]
>>          subcls = cls._lookup_type(type_)
>>          return subcls(type_=type_, **subcls.parse_value(rest))
>> @@ -733,7 +733,7 @@ class _AddrPrefix(StringifyMixin):
>>  
>>      @classmethod
>>      def parser(cls, buf):
>> -        (length, ) = struct.unpack_from(cls._PACK_STR, buffer(buf))
>> +        (length, ) = struct.unpack_from(cls._PACK_STR, buf)
>>          rest = buf[struct.calcsize(cls._PACK_STR):]
>>          byte_length = (length + 7) / 8
>>          addr = cls._from_bin(rest[:byte_length])
>> @@ -800,7 +800,7 @@ class _LabelledAddrPrefix(_AddrPrefix):
>>  
>>      @classmethod
>>      def _label_from_bin(cls, bin):
>> -        (b1, b2, b3) = struct.unpack_from(cls._LABEL_PACK_STR, buffer(bin))
>> +        (b1, b2, b3) = struct.unpack_from(cls._LABEL_PACK_STR, bin)
>>          rest = bin[struct.calcsize(cls._LABEL_PACK_STR):]
>>          return (b1 << 16) | (b2 << 8) | b3, rest
>>  
>> @@ -1135,7 +1135,7 @@ class _OptParam(StringifyMixin, _TypeDisp, _Value):
>>  
>>      @classmethod
>>      def parser(cls, buf):
>> -        (type_, length) = struct.unpack_from(cls._PACK_STR, buffer(buf))
>> +        (type_, length) = struct.unpack_from(cls._PACK_STR, buf)
>>          rest = buf[struct.calcsize(cls._PACK_STR):]
>>          value = bytes(rest[:length])
>>          rest = rest[length:]
>> @@ -1188,7 +1188,7 @@ class _OptParamCapability(_OptParam, _TypeDisp):
>>          caps = []
>>          while len(buf) > 0:
>>              (code, length) = struct.unpack_from(cls._CAP_HDR_PACK_STR,
>> -                                                buffer(buf))
>> +                                                buf)
>>              value = buf[struct.calcsize(cls._CAP_HDR_PACK_STR):]
>>              buf = buf[length + 2:]
>>              kwargs = {
>> @@ -1258,11 +1258,11 @@ class 
>> BGPOptParamCapabilityGracefulRestart(_OptParamCapability):
>>  
>>      @classmethod
>>      def parse_cap_value(cls, buf):
>> -        (restart, ) = struct.unpack_from(cls._CAP_PACK_STR, buffer(buf))
>> +        (restart, ) = struct.unpack_from(cls._CAP_PACK_STR, buf)
>>          buf = buf[2:]
>>          l = []
>>          while len(buf) > 0:
>> -            l.append(struct.unpack_from("!HBB", buffer(buf)))
>> +            l.append(struct.unpack_from("!HBB", buf))
>>              buf = buf[4:]
>>          return {'flags': restart >> 12, 'time': restart & 0xfff, 'tuples': 
>> l}
>>  
>> @@ -1289,7 +1289,7 @@ class 
>> BGPOptParamCapabilityFourOctetAsNumber(_OptParamCapability):
>>  
>>      @classmethod
>>      def parse_cap_value(cls, buf):
>> -        (as_number, ) = struct.unpack_from(cls._CAP_PACK_STR, buffer(buf))
>> +        (as_number, ) = struct.unpack_from(cls._CAP_PACK_STR, buf)
>>          return {'as_number': as_number}
>>  
>>      def serialize_cap_value(self):
>> @@ -1311,7 +1311,7 @@ class 
>> BGPOptParamCapabilityMultiprotocol(_OptParamCapability):
>>      @classmethod
>>      def parse_cap_value(cls, buf):
>>          (afi, reserved, safi,) = struct.unpack_from(cls._CAP_PACK_STR,
>> -                                                    buffer(buf))
>> +                                                    buf)
>>          return {
>>              'afi': afi,
>>              'reserved': reserved,
>> @@ -1354,13 +1354,13 @@ class _PathAttribute(StringifyMixin, _TypeDisp, 
>> _Value):
>>  
>>      @classmethod
>>      def parser(cls, buf):
>> -        (flags, type_) = struct.unpack_from(cls._PACK_STR, buffer(buf))
>> +        (flags, type_) = struct.unpack_from(cls._PACK_STR, buf)
>>          rest = buf[struct.calcsize(cls._PACK_STR):]
>>          if (flags & BGP_ATTR_FLAG_EXTENDED_LENGTH) != 0:
>>              len_pack_str = cls._PACK_STR_EXT_LEN
>>          else:
>>              len_pack_str = cls._PACK_STR_LEN
>> -        (length,) = struct.unpack_from(len_pack_str, buffer(rest))
>> +        (length,) = struct.unpack_from(len_pack_str, rest)
>>          rest = rest[struct.calcsize(len_pack_str):]
>>          value = bytes(rest[:length])
>>          rest = rest[length:]
>> @@ -1469,7 +1469,7 @@ class _BGPPathAttributeAsPathCommon(_PathAttribute):
>>  
>>          while buf:
>>              (type_, num_as) = struct.unpack_from(cls._SEG_HDR_PACK_STR,
>> -                                                 buffer(buf))
>> +                                                 buf)
>>  
>>              if type_ is not cls._AS_SET and type_ is not cls._AS_SEQUENCE:
>>                  return False
>> @@ -1494,12 +1494,12 @@ class _BGPPathAttributeAsPathCommon(_PathAttribute):
>>  
>>          while buf:
>>              (type_, num_as) = struct.unpack_from(cls._SEG_HDR_PACK_STR,
>> -                                                 buffer(buf))
>> +                                                 buf)
>>              buf = buf[struct.calcsize(cls._SEG_HDR_PACK_STR):]
>>              l = []
>>              for i in range(0, num_as):
>>                  (as_number,) = struct.unpack_from(as_pack_str,
>> -                                                  buffer(buf))
>> +                                                  buf)
>>                  buf = buf[struct.calcsize(as_pack_str):]
>>                  l.append(as_number)
>>              if type_ == cls._AS_SET:
>> @@ -1568,7 +1568,7 @@ class BGPPathAttributeNextHop(_PathAttribute):
>>  
>>      @classmethod
>>      def parse_value(cls, buf):
>> -        (ip_addr,) = struct.unpack_from(cls._VALUE_PACK_STR, buffer(buf))
>> +        (ip_addr,) = struct.unpack_from(cls._VALUE_PACK_STR, buf)
>>          return {
>>              'value': addrconv.ipv4.bin_to_text(ip_addr),
>>          }
>> @@ -1621,7 +1621,7 @@ class 
>> _BGPPathAttributeAggregatorCommon(_PathAttribute):
>>      @classmethod
>>      def parse_value(cls, buf):
>>          (as_number, addr) = struct.unpack_from(cls._VALUE_PACK_STR,
>> -                                               buffer(buf))
>> +                                               buf)
>>          return {
>>              'as_number': as_number,
>>              'addr': addrconv.ipv4.bin_to_text(addr),
>> @@ -1669,7 +1669,7 @@ class BGPPathAttributeCommunities(_PathAttribute):
>>          communities = []
>>          elem_size = struct.calcsize(cls._VALUE_PACK_STR)
>>          while len(rest) >= elem_size:
>> -            (comm, ) = struct.unpack_from(cls._VALUE_PACK_STR, buffer(rest))
>> +            (comm, ) = struct.unpack_from(cls._VALUE_PACK_STR, rest)
>>              communities.append(comm)
>>              rest = rest[elem_size:]
>>          return {
>> @@ -1730,7 +1730,7 @@ class BGPPathAttributeOriginatorId(_PathAttribute):
>>  
>>      @classmethod
>>      def parse_value(cls, buf):
>> -        (originator_id,) = struct.unpack_from(cls._VALUE_PACK_STR, 
>> buffer(buf))
>> +        (originator_id,) = struct.unpack_from(cls._VALUE_PACK_STR, buf)
>>          return {
>>              'value': addrconv.ipv4.bin_to_text(originator_id),
>>          }
>> @@ -1762,7 +1762,7 @@ class BGPPathAttributeClusterList(_PathAttribute):
>>          elem_size = struct.calcsize(cls._VALUE_PACK_STR)
>>          while len(rest) >= elem_size:
>>              (cluster_id, ) = struct.unpack_from(
>> -                cls._VALUE_PACK_STR, buffer(rest))
>> +                cls._VALUE_PACK_STR, rest)
>>              cluster_list.append(addrconv.ipv4.bin_to_text(cluster_id))
>>              rest = rest[elem_size:]
>>          return {
>> @@ -1880,7 +1880,7 @@ class _ExtendedCommunity(StringifyMixin, _TypeDisp, 
>> _Value):
>>  
>>      @classmethod
>>      def parse(cls, buf):
>> -        (type_high, payload) = struct.unpack_from(cls._PACK_STR, 
>> buffer(buf))
>> +        (type_high, payload) = struct.unpack_from(cls._PACK_STR, buf)
>>          rest = buf[struct.calcsize(cls._PACK_STR):]
>>          type_ = type_high & cls._TYPE_HIGH_MASK
>>          subcls = cls._lookup_type(type_)
>> @@ -2006,7 +2006,7 @@ class BGPPathAttributeMpReachNLRI(_PathAttribute):
>>      @classmethod
>>      def parse_value(cls, buf):
>>          (afi, safi, next_hop_len,) = struct.unpack_from(cls._VALUE_PACK_STR,
>> -                                                        buffer(buf))
>> +                                                        buf)
>>          rest = buf[struct.calcsize(cls._VALUE_PACK_STR):]
>>          next_hop_bin = rest[:next_hop_len]
>>          rest = rest[next_hop_len:]
>> @@ -2103,7 +2103,7 @@ class BGPPathAttributeMpUnreachNLRI(_PathAttribute):
>>  
>>      @classmethod
>>      def parse_value(cls, buf):
>> -        (afi, safi,) = struct.unpack_from(cls._VALUE_PACK_STR, buffer(buf))
>> +        (afi, safi,) = struct.unpack_from(cls._VALUE_PACK_STR, buf)
>>          binnlri = buf[struct.calcsize(cls._VALUE_PACK_STR):]
>>          addr_cls = _get_addr_class(afi, safi)
>>          nlri = []
>> @@ -2169,7 +2169,7 @@ class BGPMessage(packet_base.PacketBase, _TypeDisp):
>>              raise stream_parser.StreamParser.TooSmallException(
>>                  '%d < %d' % (len(buf), cls._HDR_LEN))
>>          (marker, len_, type_) = struct.unpack_from(cls._HDR_PACK_STR,
>> -                                                   buffer(buf))
>> +                                                   buf)
>>          msglen = len_
>>          if len(buf) < msglen:
>>              raise stream_parser.StreamParser.TooSmallException(
>> @@ -2248,7 +2248,7 @@ class BGPOpen(BGPMessage):
>>      def parser(cls, buf):
>>          (version, my_as, hold_time,
>>           bgp_identifier, opt_param_len) = struct.unpack_from(cls._PACK_STR,
>> -                                                             buffer(buf))
>> +                                                             buf)
>>          rest = buf[struct.calcsize(cls._PACK_STR):]
>>          binopts = rest[:opt_param_len]
>>          opt_param = []
>> @@ -2345,15 +2345,15 @@ class BGPUpdate(BGPMessage):
>>      @classmethod
>>      def parser(cls, buf):
>>          offset = 0
>> -        (withdrawn_routes_len,) = struct.unpack_from('!H', buffer(buf), 
>> offset)
>> -        binroutes = buffer(buf[offset + 2:
>> -                               offset + 2 + withdrawn_routes_len])
>> +        (withdrawn_routes_len,) = struct.unpack_from('!H', buf, offset)
>> +        binroutes = buf[offset + 2:
>> +                        offset + 2 + withdrawn_routes_len]
>>          offset += 2 + withdrawn_routes_len
>> -        (total_path_attribute_len,) = struct.unpack_from('!H', buffer(buf),
>> +        (total_path_attribute_len,) = struct.unpack_from('!H', buf,
>>                                                           offset)
>> -        binpathattrs = buffer(buf[offset + 2:
>> -                                  offset + 2 + total_path_attribute_len])
>> -        binnlri = buffer(buf[offset + 2 + total_path_attribute_len:])
>> +        binpathattrs = buf[offset + 2:
>> +                           offset + 2 + total_path_attribute_len]
>> +        binnlri = buf[offset + 2 + total_path_attribute_len:]
>>          withdrawn_routes = []
>>          while binroutes:
>>              r, binroutes = BGPWithdrawnRoute.parser(binroutes)
>> @@ -2562,7 +2562,7 @@ class BGPRouteRefresh(BGPMessage):
>>      @classmethod
>>      def parser(cls, buf):
>>          (afi, demarcation, safi,) = struct.unpack_from(cls._PACK_STR,
>> -                                                       buffer(buf))
>> +                                                       buf)
>>          return {
>>              "afi": afi,
>>              "safi": safi,
>> diff --git a/ryu/lib/packet/bmp.py b/ryu/lib/packet/bmp.py
>> index 06d4fb2..a3158e9 100644
>> --- a/ryu/lib/packet/bmp.py
>> +++ b/ryu/lib/packet/bmp.py
>> @@ -132,7 +132,7 @@ class BMPMessage(packet_base.PacketBase, _TypeDisp):
>>              raise stream_parser.StreamParser.TooSmallException(
>>                  '%d < %d' % (len(buf), cls._HDR_LEN))
>>          (version, len_, type_) = struct.unpack_from(cls._HDR_PACK_STR,
>> -                                                    buffer(buf))
>> +                                                    buf)
>>  
>>          return version, len_, type_
>>  
>> @@ -229,7 +229,7 @@ class BMPPeerMessage(BMPMessage):
>>          (peer_type, peer_flags, peer_distinguisher,
>>           peer_address, peer_as, peer_bgp_id,
>>           timestamp1, timestamp2) = 
>> struct.unpack_from(cls._PEER_HDR_PACK_STR,
>> -                                                      buffer(buf))
>> +                                                      buf)
>>  
>>          rest = buf[struct.calcsize(cls._PEER_HDR_PACK_STR):]
>>  
>> @@ -239,11 +239,11 @@ class BMPPeerMessage(BMPMessage):
>>              is_post_policy = False
>>  
>>          if peer_flags & (1 << 7):
>> -            peer_address = addrconv.ipv6.bin_to_text(buffer(peer_address))
>> +            peer_address = addrconv.ipv6.bin_to_text(peer_address)
>>          else:
>> -            peer_address = 
>> addrconv.ipv4.bin_to_text(buffer(peer_address[:4]))
>> +            peer_address = addrconv.ipv4.bin_to_text(peer_address[:4])
>>  
>> -        peer_bgp_id = addrconv.ipv4.bin_to_text(buffer(peer_bgp_id))
>> +        peer_bgp_id = addrconv.ipv4.bin_to_text(peer_bgp_id)
>>  
>>          timestamp = float(timestamp1) + timestamp2 * (10 ** -6)
>>  
>> @@ -385,8 +385,7 @@ class BMPStatisticsReport(BMPPeerMessage):
>>      def parser(cls, buf):
>>          kwargs, rest = super(BMPStatisticsReport, cls).parser(buf)
>>  
>> -        stats_count, = struct.unpack_from('!I', buffer(rest))
>> -
>> +        stats_count, = struct.unpack_from('!I', rest)
>>          buf = rest[struct.calcsize('!I'):]
>>  
>>          stats = []
>> @@ -395,7 +394,7 @@ class BMPStatisticsReport(BMPPeerMessage):
>>              if len(buf) < cls._MIN_LEN:
>>                  raise stream_parser.StreamParser.TooSmallException(
>>                      '%d < %d' % (len(buf), cls._MIN_LEN))
>> -            (type_, len_) = struct.unpack_from(cls._TLV_PACK_STR, 
>> buffer(buf))
>> +            (type_, len_) = struct.unpack_from(cls._TLV_PACK_STR, buf)
>>  
>>              if len(buf) < (cls._MIN_LEN + len_):
>>                  raise stream_parser.StreamParser.TooSmallException(
>> @@ -410,10 +409,10 @@ class BMPStatisticsReport(BMPPeerMessage):
>>                 type_ == BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_PATH_LOOP or \
>>                 type_ == BMP_STAT_TYPE_INV_UPDATE_DUE_TO_ORIGINATOR_ID or \
>>                 type_ == BMP_STAT_TYPE_INV_UPDATE_DUE_TO_AS_CONFED_LOOP:
>> -                value, = struct.unpack_from('!I', buffer(value))
>> +                value, = struct.unpack_from('!I', value)
>>              elif type_ == BMP_STAT_TYPE_ADJ_RIB_IN or \
>>                      type_ == BMP_STAT_TYPE_LOC_RIB:
>> -                value, = struct.unpack_from('!Q', buffer(value))
>> +                value, = struct.unpack_from('!Q', value)
>>  
>>              buf = buf[cls._MIN_LEN + len_:]
>>  
>> @@ -491,13 +490,13 @@ class BMPPeerDownNotification(BMPPeerMessage):
>>      @classmethod
>>      def parser(cls, buf):
>>          kwargs, buf = super(BMPPeerDownNotification, cls).parser(buf)
>> -        reason, = struct.unpack_from('!B', buffer(buf))
>> +        reason, = struct.unpack_from('!B', buf)
>>          buf = buf[struct.calcsize('!B'):]
>>  
>>          if reason == BMP_PEER_DOWN_REASON_LOCAL_BGP_NOTIFICATION:
>>              data, rest = BGPMessage.parser(buf)
>>          elif reason == BMP_PEER_DOWN_REASON_LOCAL_NO_NOTIFICATION:
>> -            data = struct.unpack_from('!H', buffer(buf))
>> +            data = struct.unpack_from('!H', buf)
>>          elif reason == BMP_PEER_DOWN_REASON_REMOTE_BGP_NOTIFICATION:
>>              data, rest = BGPMessage.parser(buf)
>>          elif reason == BMP_PEER_DOWN_REASON_REMOTE_NO_NOTIFICATION:
>> @@ -591,9 +590,7 @@ class BMPPeerUpNotification(BMPPeerMessage):
>>          kwargs, rest = super(BMPPeerUpNotification, cls).parser(buf)
>>  
>>          (local_address, local_port,
>> -         remote_port) = struct.unpack_from(cls._PACK_STR, buffer(rest))
>> -
>> -        local_address = buffer(local_address)
>> +         remote_port) = struct.unpack_from(cls._PACK_STR, rest)
>>  
>>          if '.' in kwargs['peer_address']:
>>              local_address = addrconv.ipv4.bin_to_text(local_address[:4])
>> @@ -665,7 +662,7 @@ class BMPInitiation(BMPMessage):
>>              if len(buf) < cls._MIN_LEN:
>>                  raise stream_parser.StreamParser.TooSmallException(
>>                      '%d < %d' % (len(buf), cls._MIN_LEN))
>> -            (type_, len_) = struct.unpack_from(cls._TLV_PACK_STR, 
>> buffer(buf))
>> +            (type_, len_) = struct.unpack_from(cls._TLV_PACK_STR, buf)
>>  
>>              if len(buf) < (cls._MIN_LEN + len_):
>>                  raise stream_parser.StreamParser.TooSmallException(
>> @@ -728,7 +725,7 @@ class BMPTermination(BMPMessage):
>>              if len(buf) < cls._MIN_LEN:
>>                  raise stream_parser.StreamParser.TooSmallException(
>>                      '%d < %d' % (len(buf), cls._MIN_LEN))
>> -            (type_, len_) = struct.unpack_from(cls._TLV_PACK_STR, 
>> buffer(buf))
>> +            (type_, len_) = struct.unpack_from(cls._TLV_PACK_STR, buf)
>>  
>>              if len(buf) < (cls._MIN_LEN + len_):
>>                  raise stream_parser.StreamParser.TooSmallException(
>> @@ -738,7 +735,7 @@ class BMPTermination(BMPMessage):
>>              if type_ == BMP_TERM_TYPE_STRING:
>>                  value = value.decode('utf-8')
>>              elif type_ == BMP_TERM_TYPE_REASON:
>> -                value, = struct.unpack_from('!H', buffer(value))
>> +                value, = struct.unpack_from('!H', value)
>>  
>>              buf = buf[cls._MIN_LEN + len_:]
>>  
>> diff --git a/ryu/lib/packet/ospf.py b/ryu/lib/packet/ospf.py
>> index 99ef6bf..2414c7a 100644
>> --- a/ryu/lib/packet/ospf.py
>> +++ b/ryu/lib/packet/ospf.py
>> @@ -151,7 +151,7 @@ class LSAHeader(StringifyMixin):
>>              raise stream_parser.StreamParser.TooSmallException(
>>                  '%d < %d' % (len(buf), cls._HDR_LEN))
>>          (ls_age, options, type_, id_, adv_router, ls_seqnum, checksum,
>> -         length,) = struct.unpack_from(cls._HDR_PACK_STR, buffer(buf))
>> +         length,) = struct.unpack_from(cls._HDR_PACK_STR, buf)
>>          adv_router = addrconv.ipv4.bin_to_text(adv_router)
>>          rest = buf[cls._HDR_LEN:]
>>          lsacls = LSA._lookup_type(type_)
>> @@ -167,7 +167,7 @@ class LSAHeader(StringifyMixin):
>>          }
>>  
>>          if issubclass(lsacls, OpaqueLSA):
>> -            (id_,) = struct.unpack_from('!I', buffer(id_))
>> +            (id_,) = struct.unpack_from('!I', id_)
>>              value['opaque_type'] = (id_ & 0xff000000) >> 24
>>              value['opaque_id'] = (id_ & 0xffffff)
>>          else:
>> @@ -266,7 +266,7 @@ class RouterLSA(LSA):
>>              link = buf[:cls._PACK_LEN]
>>              rest = buf[cls._PACK_LEN:]
>>              (id_, data, type_, tos, metric) = \
>> -                struct.unpack_from(cls._PACK_STR, buffer(link))
>> +                struct.unpack_from(cls._PACK_STR, link)
>>              id_ = addrconv.ipv4.bin_to_text(id_)
>>              data = addrconv.ipv4.bin_to_text(data)
>>              return cls(id_, data, type_, tos, metric), rest
>> @@ -291,7 +291,7 @@ class RouterLSA(LSA):
>>          links = []
>>          hdr = buf[:cls._PACK_LEN]
>>          buf = buf[cls._PACK_LEN:]
>> -        (flags, padding, num) = struct.unpack_from(cls._PACK_STR, 
>> buffer(hdr))
>> +        (flags, padding, num) = struct.unpack_from(cls._PACK_STR, hdr)
>>          while buf:
>>              link, buf = cls.Link.parser(buf)
>>              links.append(link)
>> @@ -331,13 +331,13 @@ class NetworkLSA(LSA):
>>              raise stream_parser.StreamParser.TooSmallException(
>>                  '%d < %d' % (len(buf), cls._PACK_LEN))
>>          binmask = buf[:cls._PACK_LEN]
>> -        (mask,) = struct.unpack_from(cls._PACK_STR, buffer(binmask))
>> +        (mask,) = struct.unpack_from(cls._PACK_STR, binmask)
>>          mask = addrconv.ipv4.bin_to_text(mask)
>>          buf = buf[cls._PACK_LEN:]
>>          routers = []
>>          while buf:
>>              binrouter = buf[:cls._PACK_LEN]
>> -            (router,) = struct.unpack_from(cls._PACK_STR, buffer(binrouter))
>> +            (router,) = struct.unpack_from(cls._PACK_STR, binrouter)
>>              router = addrconv.ipv4.bin_to_text(router)
>>              routers.append(router)
>>              buf = buf[cls._PACK_LEN:]
>> @@ -376,7 +376,7 @@ class SummaryLSA(LSA):
>>                  '%d < %d' % (len(buf), cls_PACK_LEN))
>>          buf = buf[:cls._PACK_LEN]
>>          (mask, tos, metric_fst, metric_lst) = 
>> struct.unpack_from(cls._PACK_STR,
>> -                                                                 
>> buffer(buf))
>> +                                                                 buf)
>>          mask = addrconv.ipv4.bin_to_text(mask)
>>          metric = metric_fst << 16 | (metric_lst & 0xffff)
>>          return {
>> @@ -419,7 +419,7 @@ class ASExternalLSA(LSA):
>>              ext_nw = buf[:cls._PACK_LEN]
>>              rest = buf[cls._PACK_LEN:]
>>              (mask, flags, metric_fst, metric_lst, fwd_addr,
>> -             tag) = struct.unpack_from(cls._PACK_STR, buffer(ext_nw))
>> +             tag) = struct.unpack_from(cls._PACK_STR, ext_nw)
>>              mask = addrconv.ipv4.bin_to_text(mask)
>>              metric = metric_fst << 16 | (metric_lst & 0xffff)
>>              fwd_addr = addrconv.ipv4.bin_to_text(fwd_addr)
>> @@ -548,7 +548,6 @@ class OpaqueBody(StringifyMixin, _TypeDisp):
>>  class ExtendedPrefixOpaqueBody(OpaqueBody):
>>      @classmethod
>>      def parser(cls, buf):
>> -        buf = buffer(buf)
>>          tlvs = []
>>          while buf:
>>              (type_, length) = struct.unpack_from('!HH', buf)
>> @@ -567,7 +566,6 @@ class ExtendedPrefixOpaqueBody(OpaqueBody):
>>  class ExtendedLinkOpaqueBody(OpaqueBody):
>>      @classmethod
>>      def parser(cls, buf):
>> -        buf = buffer(buf)
>>          tlvs = []
>>          while buf:
>>              (type_, length) = struct.unpack_from('!HH', buf)
>> @@ -657,7 +655,7 @@ class OSPFMessage(packet_base.PacketBase, _TypeDisp):
>>              raise stream_parser.StreamParser.TooSmallException(
>>                  '%d < %d' % (len(buf), cls._HDR_LEN))
>>          (version, type_, length, router_id, area_id, checksum, au_type,
>> -         authentication) = struct.unpack_from(cls._HDR_PACK_STR, 
>> buffer(buf))
>> +         authentication) = struct.unpack_from(cls._HDR_PACK_STR, buf)
>>  
>>          # Exclude checksum and authentication field for checksum validation.
>>          if packet_utils.checksum(buf[:12] + buf[14:16] + 
>> buf[cls._HDR_LEN:]) \
>> @@ -731,7 +729,7 @@ class OSPFHello(OSPFMessage):
>>      def parser(cls, buf):
>>          (mask, hello_interval, options, priority, dead_interval,
>>           designated_router, backup_router) = 
>> struct.unpack_from(cls._PACK_STR,
>> -                                                                buffer(buf))
>> +                                                                buf)
>>          mask = addrconv.ipv4.bin_to_text(mask)
>>          designated_router = addrconv.ipv4.bin_to_text(designated_router)
>>          backup_router = addrconv.ipv4.bin_to_text(backup_router)
>> @@ -739,7 +737,7 @@ class OSPFHello(OSPFMessage):
>>          binneighbors = buf[cls._PACK_LEN:len(buf)]
>>          while binneighbors:
>>              n = binneighbors[:4]
>> -            n = addrconv.ipv4.bin_to_text(buffer(n))
>> +            n = addrconv.ipv4.bin_to_text(n)
>>              binneighbors = binneighbors[4:]
>>              neighbors.append(n)
>>          return {
>> @@ -793,7 +791,7 @@ class OSPFDBDesc(OSPFMessage):
>>      @classmethod
>>      def parser(cls, buf):
>>          (mtu, options, flags,
>> -         sequence_number) = struct.unpack_from(cls._PACK_STR, buffer(buf))
>> +         sequence_number) = struct.unpack_from(cls._PACK_STR, buf)
>>          i_flag = (flags >> 2) & 0x1
>>          m_flag = (flags >> 1) & 0x1
>>          ms_flag = flags & 0x1
>> @@ -848,7 +846,7 @@ class OSPFLSReq(OSPFMessage):
>>              link = buf[:cls._PACK_LEN]
>>              rest = buf[cls._PACK_LEN:]
>>              (type_, id_, adv_router) = struct.unpack_from(cls._PACK_STR,
>> -                                                          buffer(link))
>> +                                                          link)
>>              id_ = addrconv.ipv4.bin_to_text(id_)
>>              adv_router = addrconv.ipv4.bin_to_text(adv_router)
>>              return cls(type_, id_, adv_router), rest
>> @@ -899,7 +897,7 @@ class OSPFLSUpd(OSPFMessage):
>>      @classmethod
>>      def parser(cls, buf):
>>          binnum = buf[:cls._PACK_LEN]
>> -        (num,) = struct.unpack_from(cls._PACK_STR, buffer(binnum))
>> +        (num,) = struct.unpack_from(cls._PACK_STR, binnum)
>>  
>>          buf = buf[cls._PACK_LEN:]
>>          lsas = []
>> diff --git a/ryu/ofproto/ofproto_parser.py b/ryu/ofproto/ofproto_parser.py
>> index 7bc9214..6e1af26 100644
>> --- a/ryu/ofproto/ofproto_parser.py
>> +++ b/ryu/ofproto/ofproto_parser.py
>> @@ -14,6 +14,8 @@
>>  # See the License for the specific language governing permissions and
>>  # limitations under the License.
>>  
>> +import six
>> +
>>  import base64
>>  import collections
>>  import logging
>> @@ -29,11 +31,15 @@ from . import ofproto_common
>>  
>>  LOG = logging.getLogger('ryu.ofproto.ofproto_parser')
>>  
>> +# This is merely for API compatibility on python2
>> +if six.PY3:
>> +    buffer = bytes
>> +
>>  
>>  def header(buf):
>>      assert len(buf) >= ofproto_common.OFP_HEADER_SIZE
>>      # LOG.debug('len %d bufsize %d', len(buf), ofproto.OFP_HEADER_SIZE)
>> -    return struct.unpack_from(ofproto_common.OFP_HEADER_PACK_STR, 
>> buffer(buf))
>> +    return struct.unpack_from(ofproto_common.OFP_HEADER_PACK_STR, buf)
>>  
>>  
>>  _MSG_PARSERS = {}
>> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py 
>> b/ryu/ofproto/ofproto_v1_3_parser.py
>> index 52cad96..f62b31f 100644
>> --- a/ryu/ofproto/ofproto_v1_3_parser.py
>> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
>> @@ -228,7 +228,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', buf,
>>                                      ofproto.OFP_HEADER_SIZE)
>>          if type_ == ofproto.OFPET_EXPERIMENTER:
>>              return OFPErrorExperimenterMsg.parser(datapath, version, 
>> msg_type,
>> @@ -3614,7 +3614,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, buf,
>>              ofproto.OFP_HEADER_SIZE)
>>          stats_type_cls = cls._STATS_MSG_TYPES.get(type_)
>>          msg = super(OFPMultipartReply, stats_type_cls).parser(
>> @@ -4965,7 +4965,7 @@ class OFPTableFeatureProp(StringifyMixin):
>>  
>>      @classmethod
>>      def parse(cls, buf):
>> -        (type_, length,) = struct.unpack_from(cls._PACK_STR, buffer(buf), 0)
>> +        (type_, length,) = struct.unpack_from(cls._PACK_STR, buf, 0)
>>          bin_prop = buf[struct.calcsize(cls._PACK_STR):length]
>>          rest = buf[utils.round_up(length, 8):]
>>          try:
>> @@ -5014,7 +5014,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, buf, 0)
>>          rest = buf[len_:]
>>          return cls(type_=type_, len_=len_), rest
>>  
>> @@ -5066,7 +5066,7 @@ class 
>> OFPTableFeaturePropNextTables(OFPTableFeatureProp):
>>          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, rest, 0)
>>              rest = rest[struct.calcsize(cls._TABLE_ID_PACK_STR):]
>>              ids.append(i)
>>          return {
>> @@ -5101,7 +5101,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, buf, 0)
>>          rest = buf[len_:]
>>          return cls(type_=type_, len_=len_), rest
>>  
>> @@ -5178,7 +5178,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, 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.
>> @@ -5189,7 +5189,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)
>> +                                           rest, 0)
>>              rest = rest[struct.calcsize(cls._EXPERIMENTER_ID_PACK_STR):]
>>              subcls = OFPExperimenterOxmId
>>              return subcls(type_=type_, exp_id=exp_id, hasmask=hasmask,
>> diff --git a/ryu/tests/unit/lib/test_ofp_pktinfilter.py 
>> b/ryu/tests/unit/lib/test_ofp_pktinfilter.py
>> index cd8e2f8..c1eeffe 100644
>> --- a/ryu/tests/unit/lib/test_ofp_pktinfilter.py
>> +++ b/ryu/tests/unit/lib/test_ofp_pktinfilter.py
>> @@ -84,7 +84,7 @@ class Test_packet_in_filter(unittest.TestCase):
>>  
>>      def test_pkt_in_filter_truncated(self):
>>          datapath = ProtocolDesc(version=ofproto_v1_3.OFP_VERSION)
>> -        truncated_data = buffer('')
>> +        truncated_data = ''
>>          pkt_in = ofproto_v1_3_parser.OFPPacketIn(datapath,
>>                                                   data=truncated_data)
>>          ev = ofp_event.EventOFPPacketIn(pkt_in)
>> diff --git a/ryu/tests/unit/lib/test_pack_utils.py 
>> b/ryu/tests/unit/lib/test_pack_utils.py
>> index 3bf476f..edabda4 100644
>> --- a/ryu/tests/unit/lib/test_pack_utils.py
>> +++ b/ryu/tests/unit/lib/test_pack_utils.py
>> @@ -41,7 +41,7 @@ class TestMsgPackInto(unittest.TestCase):
>>          pack_utils.msg_pack_into(fmt, buf, offset, arg1, arg2)
>>  
>>          check_offset = len(buf) - len_
>> -        res = struct.unpack_from(fmt, buffer(buf), check_offset)
>> +        res = struct.unpack_from(fmt, buf, check_offset)
>>  
>>          eq_(arg1, res[0])
>>          eq_(arg2, res[1])
>> diff --git a/ryu/tests/unit/ofproto/test_ofproto_parser.py 
>> b/ryu/tests/unit/ofproto/test_ofproto_parser.py
>> index e31cf20..5bdb039 100644
>> --- a/ryu/tests/unit/ofproto/test_ofproto_parser.py
>> +++ b/ryu/tests/unit/ofproto/test_ofproto_parser.py
>> @@ -15,6 +15,8 @@
>>  
>>  # vim: tabstop=4 shiftwidth=4 softtabstop=4
>>  
>> +import six
>> +
>>  import binascii
>>  import unittest
>>  from nose.tools import *
>> @@ -27,6 +29,9 @@ from ryu.ofproto import ofproto_v1_0, ofproto_v1_0_parser
>>  import logging
>>  LOG = logging.getLogger(__name__)
>>  
>> +if six.PY3:
>> +    buffer = bytes
>> +
>>  
>>  class TestOfproto_Parser(unittest.TestCase):
>>      def setUp(self):
>> diff --git a/ryu/tests/unit/packet/test_icmpv6.py 
>> b/ryu/tests/unit/packet/test_icmpv6.py
>> index c2e7af1..a3d0741 100644
>> --- a/ryu/tests/unit/packet/test_icmpv6.py
>> +++ b/ryu/tests/unit/packet/test_icmpv6.py
>> @@ -77,7 +77,7 @@ class Test_icmpv6_header(unittest.TestCase):
>>          prev = ipv6(6, 0, 0, 4, 58, 255, src_ipv6, dst_ipv6)
>>  
>>          buf = self.icmp.serialize(bytearray(), prev)
>> -        (type_, code, csum) = struct.unpack(self.icmp._PACK_STR, 
>> buffer(buf))
>> +        (type_, code, csum) = struct.unpack(self.icmp._PACK_STR, buf)
>>  
>>          eq_(type_, self.type_)
>>          eq_(code, self.code)
>> @@ -153,7 +153,7 @@ class Test_icmpv6_echo_request(unittest.TestCase):
>>  
>>          echo = icmpv6.echo(self.id_, self.seq, echo_data)
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, echo)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          (id_, seq) = struct.unpack_from(echo._PACK_STR, buf, icmp._MIN_LEN)
>> @@ -303,7 +303,7 @@ class Test_icmpv6_neighbor_solicit(unittest.TestCase):
>>          nd_csum = icmpv6_csum(prev, self.buf)
>>  
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, nd)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          (res, dst) = struct.unpack_from(nd._PACK_STR, buf, icmp._MIN_LEN)
>> @@ -323,7 +323,7 @@ class Test_icmpv6_neighbor_solicit(unittest.TestCase):
>>          nd_csum = icmpv6_csum(prev, self.buf + self.data)
>>  
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, nd)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          (res, dst) = struct.unpack_from(nd._PACK_STR, buf, icmp._MIN_LEN)
>> @@ -446,7 +446,7 @@ class 
>> Test_icmpv6_neighbor_advert(Test_icmpv6_neighbor_solicit):
>>          nd_csum = icmpv6_csum(prev, self.buf + self.data)
>>  
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, nd)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          (res, dst) = struct.unpack_from(nd._PACK_STR, buf, icmp._MIN_LEN)
>> @@ -591,7 +591,7 @@ class Test_icmpv6_router_solicit(unittest.TestCase):
>>          rs_csum = icmpv6_csum(prev, self.buf)
>>  
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, rs)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          res = struct.unpack_from(rs._PACK_STR, buf, icmp._MIN_LEN)
>> @@ -610,7 +610,7 @@ class Test_icmpv6_router_solicit(unittest.TestCase):
>>          rs_csum = icmpv6_csum(prev, self.buf + self.data)
>>  
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, rs)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          res = struct.unpack_from(rs._PACK_STR, buf, icmp._MIN_LEN)
>> @@ -1007,7 +1007,7 @@ class Test_icmpv6_membership_query(unittest.TestCase):
>>  
>>          mld = icmpv6.mld(self.maxresp, self.address)
>>          icmp = icmpv6.icmpv6(self.type_, self.code, 0, mld)
>> -        buf = buffer(icmp.serialize(bytearray(), prev))
>> +        buf = icmp.serialize(bytearray(), prev)
>>  
>>          (type_, code, csum) = struct.unpack_from(icmp._PACK_STR, buf, 0)
>>          (maxresp, address) = struct.unpack_from(
>> @@ -1497,13 +1497,13 @@ class Test_mldv2_report(unittest.TestCase):
>>          (record_num, ) = struct.unpack_from(
>>              self.mld._PACK_STR, str(buf), icmp._MIN_LEN)
>>          offset = icmp._MIN_LEN + self.mld._MIN_LEN
>> -        rec1 = icmpv6.mldv2_report_group.parser(buffer(buf[offset:]))
>> +        rec1 = icmpv6.mldv2_report_group.parser(buf[offset:])
>>          offset += len(rec1)
>> -        rec2 = icmpv6.mldv2_report_group.parser(buffer(buf[offset:]))
>> +        rec2 = icmpv6.mldv2_report_group.parser(buf[offset:])
>>          offset += len(rec2)
>> -        rec3 = icmpv6.mldv2_report_group.parser(buffer(buf[offset:]))
>> +        rec3 = icmpv6.mldv2_report_group.parser(buf[offset:])
>>          offset += len(rec3)
>> -        rec4 = icmpv6.mldv2_report_group.parser(buffer(buf[offset:]))
>> +        rec4 = icmpv6.mldv2_report_group.parser(buf[offset:])
>>  
>>          eq_(type_, self.type_)
>>          eq_(code, self.code)
>> @@ -1800,7 +1800,7 @@ class Test_mldv2_report_group(unittest.TestCase):
>>      def test_serialize(self):
>>          buf = self.mld.serialize()
>>          res = struct.unpack_from(
>> -            icmpv6.mldv2_report_group._PACK_STR, buffer(buf))
>> +            icmpv6.mldv2_report_group._PACK_STR, buf)
>>  
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> @@ -1811,9 +1811,9 @@ class Test_mldv2_report_group(unittest.TestCase):
>>          self.setUp_with_srcs()
>>          buf = self.mld.serialize()
>>          res = struct.unpack_from(
>> -            icmpv6.mldv2_report_group._PACK_STR, buffer(buf))
>> +            icmpv6.mldv2_report_group._PACK_STR, buf)
>>          (src1, src2, src3) = struct.unpack_from(
>> -            '16s16s16s', buffer(buf), icmpv6.mldv2_report_group._MIN_LEN)
>> +            '16s16s16s', buf, icmpv6.mldv2_report_group._MIN_LEN)
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>>          eq_(res[2], self.num)
>> @@ -1826,9 +1826,9 @@ class Test_mldv2_report_group(unittest.TestCase):
>>          self.setUp_with_aux()
>>          buf = self.mld.serialize()
>>          res = struct.unpack_from(
>> -            icmpv6.mldv2_report_group._PACK_STR, buffer(buf))
>> +            icmpv6.mldv2_report_group._PACK_STR, buf)
>>          (aux, ) = struct.unpack_from(
>> -            '%ds' % (self.aux_len * 4), buffer(buf),
>> +            '%ds' % (self.aux_len * 4), buf,
>>              icmpv6.mldv2_report_group._MIN_LEN)
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> @@ -1840,11 +1840,11 @@ class Test_mldv2_report_group(unittest.TestCase):
>>          self.setUp_with_srcs_and_aux()
>>          buf = self.mld.serialize()
>>          res = struct.unpack_from(
>> -            icmpv6.mldv2_report_group._PACK_STR, buffer(buf))
>> +            icmpv6.mldv2_report_group._PACK_STR, buf)
>>          (src1, src2, src3) = struct.unpack_from(
>> -            '16s16s16s', buffer(buf), icmpv6.mldv2_report_group._MIN_LEN)
>> +            '16s16s16s', buf, icmpv6.mldv2_report_group._MIN_LEN)
>>          (aux, ) = struct.unpack_from(
>> -            '%ds' % (self.aux_len * 4), buffer(buf),
>> +            '%ds' % (self.aux_len * 4), buf,
>>              icmpv6.mldv2_report_group._MIN_LEN + 16 * 3)
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> diff --git a/ryu/tests/unit/packet/test_igmp.py 
>> b/ryu/tests/unit/packet/test_igmp.py
>> index d99253d..6da5da9 100644
>> --- a/ryu/tests/unit/packet/test_igmp.py
>> +++ b/ryu/tests/unit/packet/test_igmp.py
>> @@ -813,7 +813,7 @@ class Test_igmpv3_report_group(unittest.TestCase):
>>  
>>      def test_serialize(self):
>>          buf = self.g.serialize()
>> -        res = unpack_from(igmpv3_report_group._PACK_STR, buffer(buf))
>> +        res = unpack_from(igmpv3_report_group._PACK_STR, buf)
>>  
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> @@ -823,8 +823,8 @@ class Test_igmpv3_report_group(unittest.TestCase):
>>      def test_serialize_with_srcs(self):
>>          self.setUp_with_srcs()
>>          buf = self.g.serialize()
>> -        res = unpack_from(igmpv3_report_group._PACK_STR, buffer(buf))
>> -        (src1, src2, src3) = unpack_from('4s4s4s', buffer(buf),
>> +        res = unpack_from(igmpv3_report_group._PACK_STR, buf)
>> +        (src1, src2, src3) = unpack_from('4s4s4s', buf,
>>                                           igmpv3_report_group._MIN_LEN)
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> @@ -837,8 +837,8 @@ class Test_igmpv3_report_group(unittest.TestCase):
>>      def test_serialize_with_aux(self):
>>          self.setUp_with_aux()
>>          buf = self.g.serialize()
>> -        res = unpack_from(igmpv3_report_group._PACK_STR, buffer(buf))
>> -        (aux, ) = unpack_from('%ds' % (self.aux_len * 4), buffer(buf),
>> +        res = unpack_from(igmpv3_report_group._PACK_STR, buf)
>> +        (aux, ) = unpack_from('%ds' % (self.aux_len * 4), buf,
>>                                igmpv3_report_group._MIN_LEN)
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> @@ -849,10 +849,10 @@ class Test_igmpv3_report_group(unittest.TestCase):
>>      def test_serialize_with_srcs_and_aux(self):
>>          self.setUp_with_srcs_and_aux()
>>          buf = self.g.serialize()
>> -        res = unpack_from(igmpv3_report_group._PACK_STR, buffer(buf))
>> -        (src1, src2, src3) = unpack_from('4s4s4s', buffer(buf),
>> +        res = unpack_from(igmpv3_report_group._PACK_STR, buf)
>> +        (src1, src2, src3) = unpack_from('4s4s4s', buf,
>>                                           igmpv3_report_group._MIN_LEN)
>> -        (aux, ) = unpack_from('%ds' % (self.aux_len * 4), buffer(buf),
>> +        (aux, ) = unpack_from('%ds' % (self.aux_len * 4), buf,
>>                                igmpv3_report_group._MIN_LEN + 12)
>>          eq_(res[0], self.type_)
>>          eq_(res[1], self.aux_len)
>> -- 
>> 2.1.4
>> 
>> 
> 
> 
> ------------------------------------------------------------------------------
> Monitor 25 network devices or servers for free with OpManager!
> OpManager is web-based network management software that monitors 
> network devices and physical & virtual servers, alerts via email & sms 
> for fault. Monitor 25 devices for free with no restriction. Download now
> http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to