1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: vrf: add support for 'link-down yes' on VRF slaves

$ ifquery -a
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
	vrf mgmt
	link-down yes

auto mgmt
iface mgmt
	vrf-table auto

$ ifup -a -d
...
...
debug: mgmt: pre-up : running module vrf
info: executing /usr/lib/vrf/vrf-helper create mgmt 1001
debug: mgmt: eth0: slave configured with link-down yes
info: mgmt: netlink: ip link set dev mgmt up
...
$ ip link show eth0
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master mgmt state DOWN mode DEFAULT group default qlen 1000
    link/ether 08:00:27:80:e2:97 brd ff:ff:ff:ff:ff:ff

Reviewed-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2018-06-21 11:36:10 +02:00
parent cc99b41d8c
commit 7cdb931e5d
2 changed files with 8 additions and 2 deletions

View File

@@ -495,7 +495,7 @@ class vrf(moduleBase):
master_exists = False
else:
master_exists = False
if master_exists:
if master_exists and not ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
netlink.link_set_updown(ifacename, "up")
else:
self.log_error('vrf %s not around, skipping vrf config'
@@ -673,6 +673,9 @@ class vrf(moduleBase):
if ifaceobj.link_type == ifaceLinkType.LINK_MASTER:
for s in config_slaves:
try:
for slave_ifaceobj in ifaceobj_getfunc(s) or []:
if ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
raise Exception('%s: slave configured with link-down yes')
netlink.link_set_updown(s, "up")
except Exception, e:
self.logger.debug('%s: %s' % (ifaceobj.name, str(e)))
@@ -774,7 +777,9 @@ class vrf(moduleBase):
if add_slaves:
self._add_vrf_slaves(ifaceobj, ifaceobj_getfunc)
self._set_vrf_dev_processed_flag(ifaceobj)
netlink.link_set_updown(ifaceobj.name, "up")
if not ifaceobj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
netlink.link_set_updown(ifaceobj.name, "up")
except Exception, e:
self.log_error('%s: %s' %(ifaceobj.name, str(e)), ifaceobj)