Merge pull request #7607 from pguibert6WIND/topo_python3_preparation

Topo python3 preparation
This commit is contained in:
Mark Stapp 2020-11-25 14:22:10 -05:00 committed by GitHub
commit 3abf06b722
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 32 additions and 31 deletions

View File

@ -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,

View File

@ -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))
)

View File

@ -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"

View File

@ -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")

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
luCommand(
"ce1",

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
luCommand(
"r1",

View File

@ -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"

View File

@ -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)

View File

@ -1,4 +1,4 @@
from lutil import luCommand, luLast
from lib.lutil import luCommand, luLast
from lib import topotest
ret = luCommand(

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
from customize import l3mdev_accept
l3mdev_rtrs = ["r1", "r3", "r4", "ce4"]

View File

@ -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

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
luCommand(
"r1",

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
luCommand(
"r1",

View File

@ -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:

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
ret = luCommand(
"ce1",

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
num = 50000
b = int(num / (256 * 256))

View File

@ -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])

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
holddownFactorSet = luCommand(
"r1",

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
holddownFactorSet = luCommand(
"r1",

View File

@ -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")

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
holddownFactorSet = luCommand(
"r1",

View File

@ -1,4 +1,4 @@
from lutil import luCommand
from lib.lutil import luCommand
luCommand(
"r1",

View File

@ -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))

View File

@ -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:

View File

@ -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)