mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-08-02 08:33:36 +00:00
Merge pull request #13109 from LabNConsulting/topotest-cleanup
minor topotest cleanup
This commit is contained in:
commit
d5243675f2
@ -288,6 +288,17 @@ def test_converge_protocols():
|
||||
|
||||
thisDir = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# We need loopback to have a link local so it always is the
|
||||
# "selected" router for fe80::/64 when we static compare below.
|
||||
print("Adding link-local to loopback for stable results")
|
||||
cmd = (
|
||||
"mac=`cat /sys/class/net/lo/address`; echo lo: $mac;"
|
||||
" [ -z \"$mac\" ] && continue; IFS=':'; set $mac; unset IFS;"
|
||||
" ip address add dev lo scope link"
|
||||
" fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6/64"
|
||||
)
|
||||
net["r1"].cmd_raises(cmd)
|
||||
|
||||
print("\n\n** Waiting for protocols convergence")
|
||||
print("******************************************\n")
|
||||
|
||||
|
||||
@ -161,12 +161,10 @@ class Mininet(Micronet):
|
||||
|
||||
g_mnet_inst = None
|
||||
|
||||
def __init__(self, controller=None):
|
||||
def __init__(self):
|
||||
"""
|
||||
Create a Micronet.
|
||||
"""
|
||||
assert not controller
|
||||
|
||||
if Mininet.g_mnet_inst is not None:
|
||||
Mininet.g_mnet_inst.stop()
|
||||
Mininet.g_mnet_inst = self
|
||||
|
||||
@ -212,7 +212,10 @@ class Topogen(object):
|
||||
# Mininet(Micronet) to build the actual topology.
|
||||
assert not inspect.isclass(topodef)
|
||||
|
||||
self.net = Mininet(controller=None)
|
||||
self.net = Mininet()
|
||||
|
||||
# Adjust the parent namespace
|
||||
topotest.fix_netns_limits(self.net)
|
||||
|
||||
# New direct way: Either a dictionary defines the topology or a build function
|
||||
# is supplied, or a json filename all of which build the topology by calling
|
||||
@ -799,7 +802,7 @@ class TopoRouter(TopoGear):
|
||||
grep_cmd = "grep 'ip {}' {}".format(daemonstr, source)
|
||||
else:
|
||||
grep_cmd = "grep 'router {}' {}".format(daemonstr, source)
|
||||
result = self.run(grep_cmd).strip()
|
||||
result = self.run(grep_cmd, warn=False).strip()
|
||||
if result:
|
||||
self.load_config(daemon)
|
||||
else:
|
||||
|
||||
@ -1526,7 +1526,10 @@ class Router(Node):
|
||||
def removeIPs(self):
|
||||
for interface in self.intfNames():
|
||||
try:
|
||||
self.intf_ip_cmd(interface, "ip address flush " + interface)
|
||||
self.intf_ip_cmd(interface, "ip -4 address flush " + interface)
|
||||
self.intf_ip_cmd(
|
||||
interface, "ip -6 address flush " + interface + " scope global"
|
||||
)
|
||||
except Exception as ex:
|
||||
logger.error("%s can't remove IPs %s", self, str(ex))
|
||||
# pdb.set_trace()
|
||||
@ -1888,15 +1891,6 @@ class Router(Node):
|
||||
while "snmpd" in daemons_list:
|
||||
daemons_list.remove("snmpd")
|
||||
|
||||
if daemons is None:
|
||||
# Fix Link-Local Addresses on initial startup
|
||||
# Somehow (on Mininet only), Zebra removes the IPv6 Link-Local addresses on start. Fix this
|
||||
_, output, _ = self.cmd_status(
|
||||
"for i in `ls /sys/class/net/` ; do mac=`cat /sys/class/net/$i/address`; echo $i: $mac; [ -z \"$mac\" ] && continue; IFS=':'; set $mac; unset IFS; ip address add dev $i scope link fe80::$(printf %02x $((0x$1 ^ 2)))$2:${3}ff:fe$4:$5$6/64; done",
|
||||
stderr=subprocess.STDOUT,
|
||||
)
|
||||
logger.debug("Set MACs:\n%s", output)
|
||||
|
||||
# Now start all the other daemons
|
||||
for daemon in daemons_list:
|
||||
if self.daemons[daemon] == 0:
|
||||
|
||||
@ -51,7 +51,8 @@ def config_macvlan(tgen, r_str, device, macvlan):
|
||||
|
||||
def setup_module(mod):
|
||||
"Sets up the pytest environment"
|
||||
topodef = {"s1": ("r1", "r1", "r1", "r1", "r1", "r1", "r1", "r1")}
|
||||
# 8 links to 8 switches on r1
|
||||
topodef = {"s{}".format(x): ("r1",) for x in range(1, 9)}
|
||||
tgen = Topogen(topodef, mod.__name__)
|
||||
tgen.start_topology()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user