tests: in isis_topo1_vrf, only configure valid interfaces

Fix a loop in the setup phase of isis_topo1_vrf: only configure
interfaces that each router actually has.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
This commit is contained in:
Mark Stapp 2021-10-11 11:57:30 -04:00
parent 5b9414484c
commit 4008633d7b

View File

@ -105,15 +105,21 @@ def setup_module(mod):
"ip link add {0}-cust1 type vrf table 1001",
"ip link add loop1 type dummy",
"ip link set {0}-eth0 master {0}-cust1",
"ip link set {0}-eth1 master {0}-cust1",
]
eth1_cmds = ["ip link set {0}-eth1 master {0}-cust1"]
# For all registered routers, load the zebra configuration file
for rname, router in tgen.routers().items():
# create VRF rx-cust1 and link rx-eth0 to rx-cust1
for cmd in cmds:
output = tgen.net[rname].cmd(cmd.format(rname))
# If router has an rX-eth1, link that to vrf also
if "{}-eth1".format(rname) in router.links.keys():
for cmd in eth1_cmds:
output = output + tgen.net[rname].cmd(cmd.format(rname))
for rname, router in tgen.routers().items():
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))