On Tue, 18 Jun 2013 16:35:31 +0900
YAMAMOTO Takashi <[email protected]> wrote:

> instead of UINTxx_MAX, [], a lack of the "mask" attribute, etc
>
> remove automatic-mask functionality.
> it's caller's responsibility to ensure (value & mask) == value now.

Can we preserve the above? It would be always better not to break the
existing behavior.

> Signed-off-by: YAMAMOTO Takashi <[email protected]>
> ---
>  ryu/ofproto/ofproto_v1_2_parser.py        | 110 
> ++++++++++++++----------------
>  ryu/tests/unit/ofproto/test_parser_v12.py |  81 +++++++++++-----------
>  2 files changed, 90 insertions(+), 101 deletions(-)
> 
> diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
> b/ryu/ofproto/ofproto_v1_2_parser.py
> index 2703c55..a4ad82e 100644
> --- a/ryu/ofproto/ofproto_v1_2_parser.py
> +++ b/ryu/ofproto/ofproto_v1_2_parser.py
> @@ -1455,11 +1455,6 @@ class OFPRoleReply(MsgBase):
>          return msg
>  
>  
> -UINT64_MAX = (1 << 64) - 1
> -UINT32_MAX = (1 << 32) - 1
> -UINT16_MAX = (1 << 16) - 1
> -
> -
>  class Flow(object):
>      def __init__(self):
>          self.in_port = 0
> @@ -1502,19 +1497,19 @@ class Flow(object):
>  
>  class FlowWildcards(object):
>      def __init__(self):
> -        self.metadata_mask = 0
> -        self.dl_dst_mask = 0
> -        self.dl_src_mask = 0
> -        self.vlan_vid_mask = 0
> -        self.ipv4_src_mask = 0
> -        self.ipv4_dst_mask = 0
> -        self.arp_spa_mask = 0
> -        self.arp_tpa_mask = 0
> -        self.arp_sha_mask = 0
> -        self.arp_tha_mask = 0
> -        self.ipv6_src_mask = []
> -        self.ipv6_dst_mask = []
> -        self.ipv6_flabel_mask = 0
> +        self.metadata_mask = None
> +        self.dl_dst_mask = None
> +        self.dl_src_mask = None
> +        self.vlan_vid_mask = None
> +        self.ipv4_src_mask = None
> +        self.ipv4_dst_mask = None
> +        self.arp_spa_mask = None
> +        self.arp_tpa_mask = None
> +        self.arp_sha_mask = None
> +        self.arp_tha_mask = None
> +        self.ipv6_src_mask = None
> +        self.ipv6_dst_mask = None
> +        self.ipv6_flabel_mask = None
>          self.wildcards = (1 << 64) - 1
>  
>      def ft_set(self, shift):
> @@ -1544,7 +1539,7 @@ class OFPMatch(object):
>                                self._flow.in_phy_port)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_METADATA):
> -            if self._wc.metadata_mask == UINT64_MAX:
> +            if self._wc.metadata_mask is None:
>                  header = ofproto_v1_2.OXM_OF_METADATA
>              else:
>                  header = ofproto_v1_2.OXM_OF_METADATA_W
> @@ -1552,24 +1547,24 @@ class OFPMatch(object):
>                                self._wc.metadata_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ETH_DST):
> -            if self._wc.dl_dst_mask:
> -                header = ofproto_v1_2.OXM_OF_ETH_DST_W
> -            else:
> +            if self._wc.dl_dst_mask is None:
>                  header = ofproto_v1_2.OXM_OF_ETH_DST
> +            else:
> +                header = ofproto_v1_2.OXM_OF_ETH_DST_W
>              self.append_field(header, self._flow.dl_dst, 
> self._wc.dl_dst_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ETH_SRC):
> -            if self._wc.dl_src_mask:
> -                header = ofproto_v1_2.OXM_OF_ETH_SRC_W
> -            else:
> +            if self._wc.dl_src_mask is None:
>                  header = ofproto_v1_2.OXM_OF_ETH_SRC
> +            else:
> +                header = ofproto_v1_2.OXM_OF_ETH_SRC_W
>              self.append_field(header, self._flow.dl_src, 
> self._wc.dl_src_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ETH_TYPE):
>              self.append_field(ofproto_v1_2.OXM_OF_ETH_TYPE, 
> self._flow.dl_type)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_VLAN_VID):
> -            if self._wc.vlan_vid_mask == UINT16_MAX:
> +            if self._wc.vlan_vid_mask is None:
>                  header = ofproto_v1_2.OXM_OF_VLAN_VID
>              else:
>                  header = ofproto_v1_2.OXM_OF_VLAN_VID_W
> @@ -1591,7 +1586,7 @@ class OFPMatch(object):
>                                self._flow.ip_proto)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV4_SRC):
> -            if self._wc.ipv4_src_mask == UINT32_MAX:
> +            if self._wc.ipv4_src_mask is None:
>                  header = ofproto_v1_2.OXM_OF_IPV4_SRC
>              else:
>                  header = ofproto_v1_2.OXM_OF_IPV4_SRC_W
> @@ -1599,7 +1594,7 @@ class OFPMatch(object):
>                                self._wc.ipv4_src_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV4_DST):
> -            if self._wc.ipv4_dst_mask == UINT32_MAX:
> +            if self._wc.ipv4_dst_mask is None:
>                  header = ofproto_v1_2.OXM_OF_IPV4_DST
>              else:
>                  header = ofproto_v1_2.OXM_OF_IPV4_DST_W
> @@ -1638,7 +1633,7 @@ class OFPMatch(object):
>              self.append_field(ofproto_v1_2.OXM_OF_ARP_OP, self._flow.arp_op)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_SPA):
> -            if self._wc.arp_spa_mask == UINT32_MAX:
> +            if self._wc.arp_spa_mask is None:
>                  header = ofproto_v1_2.OXM_OF_ARP_SPA
>              else:
>                  header = ofproto_v1_2.OXM_OF_ARP_SPA_W
> @@ -1646,7 +1641,7 @@ class OFPMatch(object):
>                                self._wc.arp_spa_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_TPA):
> -            if self._wc.arp_tpa_mask == UINT32_MAX:
> +            if self._wc.arp_tpa_mask is None:
>                  header = ofproto_v1_2.OXM_OF_ARP_TPA
>              else:
>                  header = ofproto_v1_2.OXM_OF_ARP_TPA_W
> @@ -1654,39 +1649,39 @@ class OFPMatch(object):
>                                self._wc.arp_tpa_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_SHA):
> -            if self._wc.arp_sha_mask:
> -                header = ofproto_v1_2.OXM_OF_ARP_SHA_W
> -            else:
> +            if self._wc.arp_sha_mask is None:
>                  header = ofproto_v1_2.OXM_OF_ARP_SHA
> +            else:
> +                header = ofproto_v1_2.OXM_OF_ARP_SHA_W
>              self.append_field(header, self._flow.arp_sha,
>                                self._wc.arp_sha_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_ARP_THA):
> -            if self._wc.arp_tha_mask:
> -                header = ofproto_v1_2.OXM_OF_ARP_THA_W
> -            else:
> +            if self._wc.arp_tha_mask is None:
>                  header = ofproto_v1_2.OXM_OF_ARP_THA
> +            else:
> +                header = ofproto_v1_2.OXM_OF_ARP_THA_W
>              self.append_field(header, self._flow.arp_tha,
>                                self._wc.arp_tha_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_SRC):
> -            if len(self._wc.ipv6_src_mask):
> -                header = ofproto_v1_2.OXM_OF_IPV6_SRC_W
> -            else:
> +            if self._wc.ipv6_src_mask is None:
>                  header = ofproto_v1_2.OXM_OF_IPV6_SRC
> +            else:
> +                header = ofproto_v1_2.OXM_OF_IPV6_SRC_W
>              self.append_field(header, self._flow.ipv6_src,
>                                self._wc.ipv6_src_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_DST):
> -            if len(self._wc.ipv6_dst_mask):
> -                header = ofproto_v1_2.OXM_OF_IPV6_DST_W
> -            else:
> +            if self._wc.ipv6_dst_mask is None:
>                  header = ofproto_v1_2.OXM_OF_IPV6_DST
> +            else:
> +                header = ofproto_v1_2.OXM_OF_IPV6_DST_W
>              self.append_field(header, self._flow.ipv6_dst,
>                                self._wc.ipv6_dst_mask)
>  
>          if self._wc.ft_test(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL):
> -            if self._wc.ipv6_flabel_mask == UINT32_MAX:
> +            if self._wc.ipv6_flabel_mask is None:
>                  header = ofproto_v1_2.OXM_OF_IPV6_FLABEL
>              else:
>                  header = ofproto_v1_2.OXM_OF_IPV6_FLABEL_W
> @@ -1762,12 +1757,12 @@ class OFPMatch(object):
>          self._flow.in_phy_port = phy_port
>  
>      def set_metadata(self, metadata):
> -        self.set_metadata_masked(metadata, UINT64_MAX)
> +        self.set_metadata_masked(metadata, None)
>  
>      def set_metadata_masked(self, metadata, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_METADATA)
>          self._wc.metadata_mask = mask
> -        self._flow.metadata = metadata & mask
> +        self._flow.metadata = metadata
>  
>      def set_dl_dst(self, dl_dst):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ETH_DST)
> @@ -1776,8 +1771,7 @@ class OFPMatch(object):
>      def set_dl_dst_masked(self, dl_dst, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ETH_DST)
>          self._wc.dl_dst_mask = mask
> -        # bit-wise and of the corresponding elements of dl_dst and mask
> -        self._flow.dl_dst = mac.haddr_bitand(dl_dst, mask)
> +        self._flow.dl_dst = dl_dst
>  
>      def set_dl_src(self, dl_src):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ETH_SRC)
> @@ -1786,14 +1780,14 @@ class OFPMatch(object):
>      def set_dl_src_masked(self, dl_src, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ETH_SRC)
>          self._wc.dl_src_mask = mask
> -        self._flow.dl_src = mac.haddr_bitand(dl_src, mask)
> +        self._flow.dl_src = dl_src
>  
>      def set_dl_type(self, dl_type):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ETH_TYPE)
>          self._flow.dl_type = dl_type
>  
>      def set_vlan_vid(self, vid):
> -        self.set_vlan_vid_masked(vid, UINT16_MAX)
> +        self.set_vlan_vid_masked(vid, None)
>  
>      def set_vlan_vid_masked(self, vid, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_VLAN_VID)
> @@ -1817,7 +1811,7 @@ class OFPMatch(object):
>          self._flow.ip_proto = ip_proto
>  
>      def set_ipv4_src(self, ipv4_src):
> -        self.set_ipv4_src_masked(ipv4_src, UINT32_MAX)
> +        self.set_ipv4_src_masked(ipv4_src, None)
>  
>      def set_ipv4_src_masked(self, ipv4_src, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV4_SRC)
> @@ -1825,7 +1819,7 @@ class OFPMatch(object):
>          self._wc.ipv4_src_mask = mask
>  
>      def set_ipv4_dst(self, ipv4_dst):
> -        self.set_ipv4_dst_masked(ipv4_dst, UINT32_MAX)
> +        self.set_ipv4_dst_masked(ipv4_dst, None)
>  
>      def set_ipv4_dst_masked(self, ipv4_dst, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV4_DST)
> @@ -1869,7 +1863,7 @@ class OFPMatch(object):
>          self._flow.arp_op = arp_op
>  
>      def set_arp_spa(self, arp_spa):
> -        self.set_arp_spa_masked(arp_spa, UINT32_MAX)
> +        self.set_arp_spa_masked(arp_spa, None)
>  
>      def set_arp_spa_masked(self, arp_spa, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_SPA)
> @@ -1877,7 +1871,7 @@ class OFPMatch(object):
>          self._flow.arp_spa = arp_spa
>  
>      def set_arp_tpa(self, arp_tpa):
> -        self.set_arp_tpa_masked(arp_tpa, UINT32_MAX)
> +        self.set_arp_tpa_masked(arp_tpa, None)
>  
>      def set_arp_tpa_masked(self, arp_tpa, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_TPA)
> @@ -1891,7 +1885,7 @@ class OFPMatch(object):
>      def set_arp_sha_masked(self, arp_sha, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_SHA)
>          self._wc.arp_sha_mask = mask
> -        self._flow.arp_sha = mac.haddr_bitand(arp_sha, mask)
> +        self._flow.arp_sha = arp_sha
>  
>      def set_arp_tha(self, arp_tha):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_THA)
> @@ -1900,7 +1894,7 @@ class OFPMatch(object):
>      def set_arp_tha_masked(self, arp_tha, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_ARP_THA)
>          self._wc.arp_tha_mask = mask
> -        self._flow.arp_tha = mac.haddr_bitand(arp_tha, mask)
> +        self._flow.arp_tha = arp_tha
>  
>      def set_ipv6_src(self, src):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_SRC)
> @@ -1909,7 +1903,7 @@ class OFPMatch(object):
>      def set_ipv6_src_masked(self, src, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_SRC)
>          self._wc.ipv6_src_mask = mask
> -        self._flow.ipv6_src = [x & y for (x, y) in itertools.izip(src, mask)]
> +        self._flow.ipv6_src = src
>  
>      def set_ipv6_dst(self, dst):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_DST)
> @@ -1918,10 +1912,10 @@ class OFPMatch(object):
>      def set_ipv6_dst_masked(self, dst, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_DST)
>          self._wc.ipv6_dst_mask = mask
> -        self._flow.ipv6_dst = [x & y for (x, y) in itertools.izip(dst, mask)]
> +        self._flow.ipv6_dst = dst
>  
>      def set_ipv6_flabel(self, flabel):
> -        self.set_ipv6_flabel_masked(flabel, UINT32_MAX)
> +        self.set_ipv6_flabel_masked(flabel, None)
>  
>      def set_ipv6_flabel_masked(self, flabel, mask):
>          self._wc.ft_set(ofproto_v1_2.OFPXMT_OFB_IPV6_FLABEL)
> diff --git a/ryu/tests/unit/ofproto/test_parser_v12.py 
> b/ryu/tests/unit/ofproto/test_parser_v12.py
> index 6eb7613..550a47b 100644
> --- a/ryu/tests/unit/ofproto/test_parser_v12.py
> +++ b/ryu/tests/unit/ofproto/test_parser_v12.py
> @@ -6583,19 +6583,19 @@ class TestOFPMatch(unittest.TestCase):
>          res = OFPMatch()
>  
>          # wc check
> -        eq_(res._wc.metadata_mask, 0)
> -        eq_(res._wc.dl_dst_mask, 0)
> -        eq_(res._wc.dl_src_mask, 0)
> -        eq_(res._wc.vlan_vid_mask, 0)
> -        eq_(res._wc.ipv4_src_mask, 0)
> -        eq_(res._wc.ipv4_dst_mask, 0)
> -        eq_(res._wc.arp_spa_mask, 0)
> -        eq_(res._wc.arp_tpa_mask, 0)
> -        eq_(res._wc.arp_sha_mask, 0)
> -        eq_(res._wc.arp_tha_mask, 0)
> -        eq_(res._wc.ipv6_src_mask, [])
> -        eq_(res._wc.ipv6_dst_mask, [])
> -        eq_(res._wc.ipv6_flabel_mask, 0)
> +        ok_(res._wc.metadata_mask is None)
> +        ok_(res._wc.dl_dst_mask is None)
> +        ok_(res._wc.dl_src_mask is None)
> +        ok_(res._wc.vlan_vid_mask is None)
> +        ok_(res._wc.ipv4_src_mask is None)
> +        ok_(res._wc.ipv4_dst_mask is None)
> +        ok_(res._wc.arp_spa_mask is None)
> +        ok_(res._wc.arp_tpa_mask is None)
> +        ok_(res._wc.arp_sha_mask is None)
> +        ok_(res._wc.arp_tha_mask is None)
> +        ok_(res._wc.ipv6_src_mask is None)
> +        ok_(res._wc.ipv6_dst_mask is None)
> +        ok_(res._wc.ipv6_flabel_mask is None)
>          eq_(res._wc.wildcards, (1 << 64) - 1)
>  
>          # flow check
> @@ -6727,8 +6727,7 @@ class TestOFPMatch(unittest.TestCase):
>          if mask is None:
>              match.set_metadata(metadata)
>          else:
> -            if (mask + 1) >> 64 != 1:
> -                header = ofproto_v1_2.OXM_OF_METADATA_W
> +            header = ofproto_v1_2.OXM_OF_METADATA_W
>              match.set_metadata_masked(metadata, mask)
>              metadata &= mask
>          self._test_serialize_and_parser(match, header, metadata, mask)
> @@ -6743,13 +6742,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_metadata(0)
>  
>      def test_set_metadata_masked_mid(self):
> -        self._test_set_metadata(0x1212121212121212, 0xff00ff00ff00ff00)
> +        self._test_set_metadata(0x1200120012001200, 0xff00ff00ff00ff00)
>  
>      def test_set_metadata_masked_max(self):
>          self._test_set_metadata(0x1212121212121212, 0xffffffffffffffff)
>  
>      def test_set_metadata_masked_min(self):
> -        self._test_set_metadata(0x1212121212121212, 0)
> +        self._test_set_metadata(0, 0)
>  
>      # set_dl_dst
>      def _test_set_dl_dst(self, dl_dst, mask=None):
> @@ -6775,13 +6774,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_dl_dst('00:00:00:00:00:00')
>  
>      def test_set_dl_dst_masked_mid(self):
> -        self._test_set_dl_dst('e2:7a:09:79:0b:0f', 'ff:00:ff:00:ff:00')
> +        self._test_set_dl_dst('e2:00:09:00:0b:00', 'ff:00:ff:00:ff:00')
>  
>      def test_set_dl_dst_masked_max(self):
>          self._test_set_dl_dst('e2:7a:09:79:0b:0f', 'ff:ff:ff:ff:ff:ff')
>  
>      def test_set_dl_dst_masked_min(self):
> -        self._test_set_dl_dst('e2:7a:09:79:0b:0f', '00:00:00:00:00:00')
> +        self._test_set_dl_dst('00:00:00:00:00:00', '00:00:00:00:00:00')
>  
>      # set_dl_src
>      def _test_set_dl_src(self, dl_src, mask=None):
> @@ -6807,13 +6806,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_dl_src('00:00:00:00:00:00')
>  
>      def test_set_dl_src_masked_mid(self):
> -        self._test_set_dl_src('d0:98:79:b4:75:b5', 'f0:f0:f0:f0:f0:f0')
> +        self._test_set_dl_src('d0:90:70:b0:70:b0', 'f0:f0:f0:f0:f0:f0')
>  
>      def test_set_dl_src_masked_max(self):
>          self._test_set_dl_src('d0:98:79:b4:75:b5', 'ff:ff:ff:ff:ff:ff')
>  
>      def test_set_dl_src_masked_min(self):
> -        self._test_set_dl_src('d0:98:79:b4:75:b5', '00:00:00:00:00:00')
> +        self._test_set_dl_src('00:00:00:00:00:00', '00:00:00:00:00:00')
>  
>      # set_dl_type
>      def _test_set_dl_type(self, value):
> @@ -6949,8 +6948,7 @@ class TestOFPMatch(unittest.TestCase):
>              match.set_ipv4_src(ip)
>          else:
>              mask = unpack('!I', socket.inet_aton(mask))[0]
> -            if (mask + 1) >> 32 != 1:
> -                header = ofproto_v1_2.OXM_OF_IPV4_SRC_W
> +            header = ofproto_v1_2.OXM_OF_IPV4_SRC_W
>              match.set_ipv4_src_masked(ip, mask)
>          self._test_serialize_and_parser(match, header, ip, mask)
>  
> @@ -6981,8 +6979,7 @@ class TestOFPMatch(unittest.TestCase):
>              match.set_ipv4_dst(ip)
>          else:
>              mask = unpack('!I', socket.inet_aton(mask))[0]
> -            if (mask + 1) >> 32 != 1:
> -                header = ofproto_v1_2.OXM_OF_IPV4_DST_W
> +            header = ofproto_v1_2.OXM_OF_IPV4_DST_W
>              match.set_ipv4_dst_masked(ip, mask)
>          self._test_serialize_and_parser(match, header, ip, mask)
>  
> @@ -7157,8 +7154,7 @@ class TestOFPMatch(unittest.TestCase):
>              match.set_arp_spa(ip)
>          else:
>              mask = unpack('!I', socket.inet_aton(mask))[0]
> -            if (mask + 1) >> 32 != 1:
> -                header = ofproto_v1_2.OXM_OF_ARP_SPA_W
> +            header = ofproto_v1_2.OXM_OF_ARP_SPA_W
>              match.set_arp_spa_masked(ip, mask)
>          self._test_serialize_and_parser(match, header, ip, mask)
>  
> @@ -7172,13 +7168,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_arp_spa('0.0.0.0')
>  
>      def test_set_arp_spa_masked_mid(self):
> -        self._test_set_arp_spa('192.168.227.57', '255.255.0.0')
> +        self._test_set_arp_spa('192.168.0.0', '255.255.0.0')
>  
>      def test_set_arp_spa_masked_max(self):
>          self._test_set_arp_spa('192.168.227.57', '255.255.255.255')
>  
>      def test_set_arp_spa_masked_min(self):
> -        self._test_set_arp_spa('192.168.227.57', '0.0.0.0')
> +        self._test_set_arp_spa('0.0.0.0', '0.0.0.0')
>  
>      # set_arp_tpa
>      def _test_set_arp_tpa(self, ip, mask=None):
> @@ -7189,8 +7185,7 @@ class TestOFPMatch(unittest.TestCase):
>              match.set_arp_tpa(ip)
>          else:
>              mask = unpack('!I', socket.inet_aton(mask))[0]
> -            if (mask + 1) >> 32 != 1:
> -                header = ofproto_v1_2.OXM_OF_ARP_TPA_W
> +            header = ofproto_v1_2.OXM_OF_ARP_TPA_W
>              match.set_arp_tpa_masked(ip, mask)
>          self._test_serialize_and_parser(match, header, ip, mask)
>  
> @@ -7204,13 +7199,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_arp_tpa('0.0.0.0')
>  
>      def test_set_arp_tpa_masked_mid(self):
> -        self._test_set_arp_tpa('192.168.227.57', '255.255.0.0')
> +        self._test_set_arp_tpa('192.168.0.0', '255.255.0.0')
>  
>      def test_set_arp_tpa_masked_max(self):
>          self._test_set_arp_tpa('192.168.227.57', '255.255.255.255')
>  
>      def test_set_arp_tpa_masked_min(self):
> -        self._test_set_arp_tpa('192.168.227.57', '0.0.0.0')
> +        self._test_set_arp_tpa('0.0.0.0', '0.0.0.0')
>  
>      # set_arp_sha
>      def _test_set_arp_sha(self, arp_sha, mask=None):
> @@ -7236,13 +7231,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_arp_sha('00:00:00:00:00:00')
>  
>      def test_set_arp_sha_masked_mid(self):
> -        self._test_set_arp_sha('3e:ec:13:9b:f3:0b', 'ff:ff:ff:00:00:00')
> +        self._test_set_arp_sha('3e:ec:13:00:00:00', 'ff:ff:ff:00:00:00')
>  
>      def test_set_arp_sha_masked_max(self):
>          self._test_set_arp_sha('3e:ec:13:9b:f3:0b', 'ff:ff:ff:ff:ff:ff')
>  
>      def test_set_arp_sha_masked_min(self):
> -        self._test_set_arp_sha('3e:ec:13:9b:f3:0b', '00:00:00:00:00:00')
> +        self._test_set_arp_sha('00:00:00:00:00:00', '00:00:00:00:00:00')
>  
>      # set_arp_tha
>      def _test_set_arp_tha(self, arp_tha, mask=None):
> @@ -7268,13 +7263,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_arp_tha('00:00:00:00:00:00')
>  
>      def test_set_arp_tha_masked_mid(self):
> -        self._test_set_arp_tha('83:6c:21:52:49:68', 'ff:ff:ff:00:00:00')
> +        self._test_set_arp_tha('83:6c:21:00:00:00', 'ff:ff:ff:00:00:00')
>  
>      def test_set_arp_tha_masked_max(self):
>          self._test_set_arp_tha('83:6c:21:52:49:68', 'ff:ff:ff:ff:ff:ff')
>  
>      def test_set_arp_tha_masked_min(self):
> -        self._test_set_arp_tha('83:6c:21:52:49:68', '00:00:00:00:00:00')
> +        self._test_set_arp_tha('00:00:00:00:00:00', '00:00:00:00:00:00')
>  
>      # set_ipv6_src
>      def _test_set_ipv6_src(self, ipv6, mask=None):
> @@ -7303,7 +7298,7 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_ipv6_src(ipv6)
>  
>      def test_set_ipv6_src_masked_mid(self):
> -        ipv6 = '2001:db8:bd05:1d2:288a:1fc0:1:10ee'
> +        ipv6 = '2001:db8:bd05:1d2:0:0:0:0'
>          mask = 'ffff:ffff:ffff:ffff:0:0:0:0'
>          self._test_set_ipv6_src(ipv6, mask)
>  
> @@ -7313,7 +7308,7 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_ipv6_src(ipv6, mask)
>  
>      def test_set_ipv6_src_masked_min(self):
> -        ipv6 = '2001:db8:bd05:1d2:288a:1fc0:1:10ee'
> +        ipv6 = '0:0:0:0:0:0:0:0'
>          mask = '0:0:0:0:0:0:0:0'
>          self._test_set_ipv6_src(ipv6, mask)
>  
> @@ -7344,7 +7339,7 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_ipv6_dst(ipv6)
>  
>      def test_set_ipv6_dst_mask_mid(self):
> -        ipv6 = 'e9e8:9ea5:7d67:82cc:ca54:1fc0:2d24:f038'
> +        ipv6 = 'e9e8:9ea5:7d67:82cc:0:0:0:0'
>          mask = ':'.join(['ffff'] * 4 + ['0'] * 4)
>          self._test_set_ipv6_dst(ipv6, mask)
>  
> @@ -7354,7 +7349,7 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_ipv6_dst(ipv6, mask)
>  
>      def test_set_ipv6_dst_mask_min(self):
> -        ipv6 = 'e9e8:9ea5:7d67:82cc:ca54:1fc0:2d24:f038'
> +        ipv6 = '0:0:0:0:0:0:0:0'
>          mask = ':'.join(['0'] * 8)
>          self._test_set_ipv6_dst(ipv6, mask)
>  
> @@ -7379,13 +7374,13 @@ class TestOFPMatch(unittest.TestCase):
>          self._test_set_ipv6_flabel(0)
>  
>      def test_set_ipv6_flabel_masked_mid(self):
> -        self._test_set_ipv6_flabel(0xc5384, 0xfff00)
> +        self._test_set_ipv6_flabel(0xc5300, 0xfff00)
>  
>      def test_set_ipv6_flabel_masked_max(self):
>          self._test_set_ipv6_flabel(0xc5384, 0xfffff)
>  
>      def test_set_ipv6_flabel_masked_min(self):
> -        self._test_set_ipv6_flabel(0xc5384, 0)
> +        self._test_set_ipv6_flabel(0, 0)
>  
>      # set_icmpv6_type
>      def _test_set_icmpv6_type(self, icmpv6_type):
> -- 
> 1.8.1.5
> 
> 
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
> 
> Build for Windows Store.
> 
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to