Update frr.py

updates to generate interface up/down commands for node interfaces
This commit is contained in:
bharnden 2020-01-28 13:33:34 -08:00 committed by GitHub
parent 89af081712
commit 53dd1de090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -131,7 +131,7 @@ class FRRZebra(CoreService):
frr_sbin_search = node.session.options.get_config( frr_sbin_search = node.session.options.get_config(
"frr_sbin_search", default='"/usr/local/sbin /usr/sbin /usr/lib/frr"' "frr_sbin_search", default='"/usr/local/sbin /usr/sbin /usr/lib/frr"'
) )
return """\ cfg = """\
#!/bin/sh #!/bin/sh
# auto-generated by zebra service (frr.py) # auto-generated by zebra service (frr.py)
FRR_CONF=%s FRR_CONF=%s
@ -226,28 +226,19 @@ if [ "$1" != "zebra" ]; then
exit 1 exit 1
fi fi
resetinterfaces()
{
for iface in $(ip -o link show up | awk -F': ' '{print $2}')
do
if [ "$iface" != "lo" ]
then
ip link set dev $iface down
sleep 1
ip link set dev $iface up
fi
done
}
confcheck confcheck
bootfrr bootfrr
resetinterfaces
""" % ( """ % (
cls.configs[0], cls.configs[0],
frr_sbin_search, frr_sbin_search,
frr_bin_search, frr_bin_search,
constants.FRR_STATE_DIR, constants.FRR_STATE_DIR,
) )
for ifc in node.netifs():
cfg += f"ip link set dev {ifc.name} down\n"
cfg += "sleep 1\n"
cfg += f"ip link set dev {ifc.name} up\n"
return cfg
@classmethod @classmethod
def generateFrrDaemons(cls, node): def generateFrrDaemons(cls, node):