]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
addons: vrf: add support for 'link-down yes' on VRF slaves
authorJulien Fortin <julien@cumulusnetworks.com>
Thu, 21 Jun 2018 09:36:10 +0000 (11:36 +0200)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 21 Jun 2018 13:52:32 +0000 (15:52 +0200)
$ 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>
debian/changelog
ifupdown2/addons/vrf.py

index e6570a486c90ce4605b5ce3cdc8e7657dae52dd8..7ed6b94f5584e922e69b6e0e9d15e55fe81180b9 100644 (file)
@@ -2,6 +2,7 @@ ifupdown2 (1.2.0) UNRELEASED; urgency=medium
   * Package architecture refactoring and cleanups
   * Package can be build/install as debian, pip or rpm package
   * Makefile to easily perform tasks (i.e.: install, build, test, upload..)
+  * VRF slaves: add support for link-down yes
   * Closes #48: Run up/down on "manual" interfaces, but ignore any errors.
   * Closes #58: ifupdown2.conf: vlan_aware_bridge_address_support on/off
   * Traditional bridge support for mstpctl attr: (portautoedge, portrestrrole)
index 7c98d9ace70e64a5fc60cbd4627c4e50912657eb..7cba995f311fe597ce7eae475c16726a185ad996 100644 (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)