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

Merge branch 'dev' into release/cl-stable

This commit is contained in:
Roopa Prabhu
2016-08-11 16:59:14 -07:00
14 changed files with 360 additions and 239 deletions

View File

@@ -10,6 +10,7 @@ import errno
import fcntl
import atexit
import re
from sets import Set
from ifupdown.iface import *
from ifupdown.utils import utils
import ifupdown.policymanager as policymanager
@@ -34,7 +35,7 @@ class vrf(moduleBase):
'creating a vrf device. ' +
'Table id is either \'auto\' or '+
'\'valid routing table id\'',
'validvals': ['<auto>', '<number>'],
'validvals': ['auto', '<number>'],
'example': ['vrf-table auto', 'vrf-table 1001']},
'vrf':
{'help' : 'vrf the interface is part of.',
@@ -305,7 +306,7 @@ class vrf(moduleBase):
return True
def _up_vrf_slave_without_master(self, ifacename, vrfname, ifaceobj,
ifaceobj_getfunc):
vrf_master_objs):
""" If we have a vrf slave that has dhcp configured, bring up the
vrf master now. This is needed because vrf has special handling
in dhclient hook which requires the vrf master to be present """
@@ -318,10 +319,6 @@ class vrf(moduleBase):
self.logger.info('%s: vrf master %s exists returning'
%(ifacename, vrf_master))
return
vrf_master_objs = ifaceobj_getfunc(vrf_master)
if not vrf_master_objs:
self.logger.warn('%s: vrf master ifaceobj not found' %ifacename)
return
self.logger.info('%s: bringing up vrf master %s'
%(ifacename, vrf_master))
for mobj in vrf_master_objs:
@@ -373,14 +370,26 @@ class vrf(moduleBase):
if not upper or upper != vrfname:
self._handle_existing_connections(ifaceobj, vrfname)
self.ipcmd.link_set(ifacename, 'master', vrfname)
elif ifupdownflags.flags.ALL and ifaceobj:
self._up_vrf_slave_without_master(ifacename, vrfname, ifaceobj,
ifaceobj_getfunc)
elif ifaceobj:
vrf_master_objs = ifaceobj_getfunc(vrfname)
if not vrf_master_objs:
self.logger.warn('%s: vrf master ifaceobj not found'
%ifacename)
return
if (ifupdownflags.flags.ALL or
(ifupdownflags.flags.CLASS and
ifaceobj.classes and vrf_master_objs[0].classes and
Set(ifaceobj.classes).intersection(vrf_master_objs[0].classes))):
self._up_vrf_slave_without_master(ifacename, vrfname,
ifaceobj,
vrf_master_objs)
else:
master_exists = False
else:
master_exists = False
if master_exists:
netlink.link_set_updown(ifacename, "up")
elif ifupdownflags.flags.ALL:
else:
self.log_error('vrf %s not around, skipping vrf config'
%(vrfname), ifaceobj)
except Exception, e: