mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 13:56:09 +02:00
python3: Use zip instead of itertools.izip
Avoid itertools micro-optimization and simply use zip. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
f4b405f31a
commit
5ab96772b8
@ -263,14 +263,14 @@ class ClsRule(object):
|
||||
|
||||
def set_ipv6_src_masked(self, src, mask):
|
||||
self.wc.ipv6_src_mask = mask
|
||||
self.flow.ipv6_src = [x & y for (x, y) in itertools.izip(src, mask)]
|
||||
self.flow.ipv6_src = [x & y for (x, y) in zip(src, mask)]
|
||||
|
||||
def set_ipv6_src(self, src):
|
||||
self.flow.ipv6_src = src
|
||||
|
||||
def set_ipv6_dst_masked(self, dst, mask):
|
||||
self.wc.ipv6_dst_mask = mask
|
||||
self.flow.ipv6_dst = [x & y for (x, y) in itertools.izip(dst, mask)]
|
||||
self.flow.ipv6_dst = [x & y for (x, y) in zip(dst, mask)]
|
||||
|
||||
def set_ipv6_dst(self, dst):
|
||||
self.flow.ipv6_dst = dst
|
||||
@ -278,7 +278,7 @@ class ClsRule(object):
|
||||
def set_nd_target_masked(self, target, mask):
|
||||
self.wc.nd_target_mask = mask
|
||||
self.flow.nd_target = [x & y for (x, y) in
|
||||
itertools.izip(target, mask)]
|
||||
zip(target, mask)]
|
||||
|
||||
def set_nd_target(self, target):
|
||||
self.flow.nd_target = target
|
||||
|
||||
@ -3971,7 +3971,7 @@ class OFPMatch(StringifyMixin):
|
||||
def set_ipv6_src_masked(self, src, mask):
|
||||
self._wc.ft_set(ofproto.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 = [x & y for (x, y) in zip(src, mask)]
|
||||
|
||||
def set_ipv6_dst(self, dst):
|
||||
self._wc.ft_set(ofproto.OFPXMT_OFB_IPV6_DST)
|
||||
@ -3980,7 +3980,7 @@ class OFPMatch(StringifyMixin):
|
||||
def set_ipv6_dst_masked(self, dst, mask):
|
||||
self._wc.ft_set(ofproto.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 = [x & y for (x, y) in zip(dst, mask)]
|
||||
|
||||
def set_ipv6_flabel(self, flabel):
|
||||
self.set_ipv6_flabel_masked(flabel, UINT32_MAX)
|
||||
|
||||
@ -1436,7 +1436,7 @@ class OFPMatch(StringifyMixin):
|
||||
def set_ipv6_src_masked(self, src, mask):
|
||||
self._wc.ft_set(ofproto.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 = [x & y for (x, y) in zip(src, mask)]
|
||||
|
||||
def set_ipv6_dst(self, dst):
|
||||
self._wc.ft_set(ofproto.OFPXMT_OFB_IPV6_DST)
|
||||
@ -1445,7 +1445,7 @@ class OFPMatch(StringifyMixin):
|
||||
def set_ipv6_dst_masked(self, dst, mask):
|
||||
self._wc.ft_set(ofproto.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 = [x & y for (x, y) in zip(dst, mask)]
|
||||
|
||||
def set_ipv6_flabel(self, flabel):
|
||||
self.set_ipv6_flabel_masked(flabel, UINT32_MAX)
|
||||
|
||||
@ -7318,7 +7318,7 @@ class TestOFPMatch(unittest.TestCase):
|
||||
header = ofproto.OXM_OF_IPV6_SRC_W
|
||||
mask = [int(x, 16) for x in mask.split(":")]
|
||||
match.set_ipv6_src_masked(ipv6, mask)
|
||||
ipv6 = [x & y for (x, y) in itertools.izip(ipv6, mask)]
|
||||
ipv6 = [x & y for (x, y) in zip(ipv6, mask)]
|
||||
self._test_serialize_and_parser(match, header, ipv6, mask)
|
||||
|
||||
def test_set_ipv6_src_mid(self):
|
||||
@ -7359,7 +7359,7 @@ class TestOFPMatch(unittest.TestCase):
|
||||
header = ofproto.OXM_OF_IPV6_DST_W
|
||||
mask = [int(x, 16) for x in mask.split(":")]
|
||||
match.set_ipv6_dst_masked(ipv6, mask)
|
||||
ipv6 = [x & y for (x, y) in itertools.izip(ipv6, mask)]
|
||||
ipv6 = [x & y for (x, y) in zip(ipv6, mask)]
|
||||
self._test_serialize_and_parser(match, header, ipv6, mask)
|
||||
|
||||
def test_set_ipv6_dst_mid(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user