summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/topotests/all-protocol-startup/test_all_protocol_startup.py4
-rw-r--r--tests/topotests/bgp_features/test_bgp_features.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py4
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py2
-rw-r--r--tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py2
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py2
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py2
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py2
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py2
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py2
-rwxr-xr-xtests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py2
-rw-r--r--tests/topotests/lib/bgprib.py4
-rw-r--r--tests/topotests/lib/lutil.py9
25 files changed, 32 insertions, 31 deletions
diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
index 0254ff6af6..96b88914a7 100644
--- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
+++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py
@@ -1065,7 +1065,7 @@ def test_bgp_ipv4():
if not success:
resultstr = "No template matched.\n"
- for f in diffresult.iterkeys():
+ for f in diffresult.keys():
resultstr += "template %s: r%s failed SHOW BGP IPv4 check:\n%s\n" % (
f,
i,
@@ -1134,7 +1134,7 @@ def test_bgp_ipv6():
if not success:
resultstr = "No template matched.\n"
- for f in diffresult.iterkeys():
+ for f in diffresult.keys():
resultstr += "template %s: r%s failed SHOW BGP IPv6 check:\n%s\n" % (
f,
i,
diff --git a/tests/topotests/bgp_features/test_bgp_features.py b/tests/topotests/bgp_features/test_bgp_features.py
index bd092c4340..9dce9d668b 100644
--- a/tests/topotests/bgp_features/test_bgp_features.py
+++ b/tests/topotests/bgp_features/test_bgp_features.py
@@ -102,7 +102,7 @@ def setup_module(module):
# Starting Routers
router_list = tgen.routers()
- for rname, router in router_list.iteritems():
+ for rname, router in router_list.items():
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py
index 3f1157ad72..0deb181f3e 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"r1", 'vtysh -c "show bgp next"', "99.0.0.. valid", "wait", "See CE static NH"
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py
index ea059c576e..789f93b837 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand("ce1", "ping 192.168.1.1 -c 1", " 0. packet loss", "pass", "CE->PE ping")
luCommand("ce2", "ping 192.168.1.1 -c 1", " 0. packet loss", "pass", "CE->PE ping")
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py
index 96b4978261..af39a951b7 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"ce1",
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py
index 9f21d99913..38eac14c64 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"r1",
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py
index 5c7427763d..375bca8a63 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"r1", 'vtysh -c "add vrf r1-cust1 prefix 99.0.0.1/32"', ".", "none", "IP Address"
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py
index 53cf353fa0..f5145753a5 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand("ce1", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180)
luCommand("ce2", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180)
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
index 20113b1058..a5f95f94bf 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
@@ -1,4 +1,4 @@
-from lutil import luCommand, luLast
+from lib.lutil import luCommand, luLast
from lib import topotest
ret = luCommand(
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
index b552ea0406..7c154ecd15 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
from customize import l3mdev_accept
l3mdev_rtrs = ["r1", "r3", "r4", "ce4"]
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
index 98d2a3bafc..d55169a19e 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
@@ -1,5 +1,5 @@
-from lutil import luCommand
-from bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes
+from lib.lutil import luCommand
+from lib.bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes
########################################################################
# CE routers: contain routes they originate
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py
index af77ab01c1..a27b178548 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"r1",
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py
index 477578bdbd..fcbc3df6ef 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"r1",
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py
index 2b0a85a91a..dd2e24722f 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
rtrs = ["ce1", "ce2", "ce3", "r1", "r2", "r3", "r4"]
for rtr in rtrs:
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py
index 7990533f3a..6ce81baf11 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
ret = luCommand(
"ce1",
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py
index 3c768640a1..04ca03973d 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
num = 50000
b = int(num / (256 * 256))
diff --git a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py
index 6344f7bb40..7635f74125 100644
--- a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py
+++ b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py
@@ -332,7 +332,7 @@ def test_bgp_routingTable():
if not success:
resultstr = "No template matched.\n"
- for f in diffresult.iterkeys():
+ for f in diffresult.keys():
resultstr += (
"template %s: r%s failed Routing Table Check for view %s:\n%s\n"
% (f, i, view, diffresult[f])
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py
index f4b4da55d2..bc47dfc85c 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
holddownFactorSet = luCommand(
"r1",
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py
index 9fdef84cdf..e68fac86fa 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
holddownFactorSet = luCommand(
"r1",
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py
index 1caa827ce2..24b3cba96e 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand("r1", 'vtysh -c "show bgp ipv4 vpn"', "", "none", "VPN SAFI")
luCommand("r2", 'vtysh -c "show bgp ipv4 vpn"', "", "none", "VPN SAFI")
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py
index e68e9e93ab..f5c2db25ff 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
holddownFactorSet = luCommand(
"r1",
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py
index eea977bfaf..7201ac8111 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py
@@ -1,4 +1,4 @@
-from lutil import luCommand
+from lib.lutil import luCommand
luCommand(
"r1",
diff --git a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py
index 6bc097b0e7..514ea53552 100755
--- a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py
+++ b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py
@@ -179,7 +179,7 @@ def setup_module(mod):
router_list = tgen.routers()
# For all registered routers, load the zebra configuration file
- for rname, router in router_list.iteritems():
+ for rname, router in router_list.items():
router.load_config(
TopoRouter.RD_ZEBRA,
os.path.join(CWD, '{}/zebra.conf'.format(rname))
diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py
index a23092de83..abab9600a1 100644
--- a/tests/topotests/lib/bgprib.py
+++ b/tests/topotests/lib/bgprib.py
@@ -45,7 +45,7 @@ class BgpRib:
def routes_include_wanted(self, pfxtbl, want, debug):
# helper function to RequireVpnRoutes
- for pfx in pfxtbl.iterkeys():
+ for pfx in pfxtbl.keys():
if debug:
self.log("trying pfx %s" % pfx)
if pfx != want["p"]:
@@ -107,7 +107,7 @@ class BgpRib:
found = 0
if debug:
self.log("want rd %s" % want["rd"])
- for rd in rds.iterkeys():
+ for rd in rds.keys():
if rd != want["rd"]:
continue
if debug:
diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py
index 1fb4f48b0f..9cbea67af1 100644
--- a/tests/topotests/lib/lutil.py
+++ b/tests/topotests/lib/lutil.py
@@ -23,7 +23,7 @@ import time
import datetime
import json
import math
-from topolog import logger
+from lib.topolog import logger
from mininet.net import Mininet
@@ -58,14 +58,14 @@ class lUtil:
def log(self, str, level=6):
if self.l_level > 0:
if self.fout == "":
- self.fout = open(self.fout_name, "w", 0)
+ self.fout = open(self.fout_name, "w")
self.fout.write(str + "\n")
if level <= self.l_level:
print(str)
def summary(self, str):
if self.fsum == "":
- self.fsum = open(self.fsum_name, "w", 0)
+ self.fsum = open(self.fsum_name, "w")
self.fsum.write(
"\
******************************************************************************\n"
@@ -380,7 +380,8 @@ def luInclude(filename, CallOnFail=None):
LUtil.setCallOnFail(CallOnFail)
if filename.endswith(".py"):
LUtil.log("luInclude: execfile " + tstFile)
- execfile(tstFile)
+ with open(tstFile) as infile:
+ exec(infile.read())
else:
LUtil.log("luInclude: execTestFile " + tstFile)
LUtil.execTestFile(tstFile)