X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Futil.py;h=ae887a5454375f3b8f6f417e53eb1c9eaccae4bb;hb=d81da8c0b5094de6635ad9575a2a2bb6f44070dc;hp=6658febfdb1a94e1c0eab20b772f5f25f5625f81;hpb=724f64ccf691e170973bdcdc6c09bfdc7e2ab5e4;p=vpp.git 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