summaryrefslogtreecommitdiffstats
path: root/test/util.py
diff options
context:
space:
mode:
authorEyal Bari <ebari@cisco.com>2017-01-11 13:39:54 +0200
committerJohn Lo <loj@cisco.com>2017-01-11 15:08:18 +0000
commitd81da8c0b5094de6635ad9575a2a2bb6f44070dc (patch)
treefc0c13e143b82a6c08e6d5253c38c1ceac4f4a5e /test/util.py
parent724f64ccf691e170973bdcdc6c09bfdc7e2ab5e4 (diff)
vxlan unit test - minor fixes
moved ip4_range and ip4n_range to util added n_ucast_tunnels Change-Id: I9140c4e54a0636d90a97db03da842f5183319af5 Signed-off-by: Eyal Bari <ebari@cisco.com>
Diffstat (limited to 'test/util.py')
-rw-r--r--test/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/util.py b/test/util.py
index 6658febfdb1..ae887a54543 100644
--- a/test/util.py
+++ b/test/util.py
@@ -34,6 +34,16 @@ def ppc(headline, capture, limit=10):
return "%s\n%s%s" % (headline, body, tail)
+def ip4_range(ip4, s, e):
+ tmp = ip4.rsplit('.', 1)[0]
+ return ("%s.%d" % (tmp, i) for i in range(s, e))
+
+
+def ip4n_range(ip4n, s, e):
+ ip4 = socket.inet_ntop(socket.AF_INET, ip4n)
+ return (socket.inet_pton(socket.AF_INET, ip) for ip in ip4_range(ip4, s, e))
+
+
class NumericConstant(object):
__metaclass__ = ABCMeta