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

addons: vrf: fix check in vrf map initialization when no running vrfs present

Ticket: CM-10178
Review: trivial
Testing: tested with failing testcase in the CM

This patch fixes a check in vrf map initialization code which did
not account for running vrfs correctly. This caused the case where
there were no running vrfs but stale map file to fail.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>

addons,ifupdown,sbin: adding ifquery --with-defaults option

Ticket: CM-7840
Reviewed By: Roopa Prabhu
Testing Done: yes, by installing ifupdown .deb file onto dell-s3000-02

This patch adds a new argument '--with-defaults' to 'ifquery'
when 'ifquery --with-defaults' is executed, running states of all interface
attributes are compared against respective configured attributes from
/etc/network/interfaces file, if configured. Otherwise, compared against
default attributes from policy file

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
This commit is contained in:
Roopa Prabhu
2016-04-19 15:25:23 -07:00
committed by Nikhil
parent fdf548b091
commit 669b422add
7 changed files with 77 additions and 43 deletions

View File

@@ -744,7 +744,8 @@ class vrf(moduleBase):
except Exception, e:
self.log_warn(str(e))
def _query_check_vrf_dev(self, ifaceobj, ifaceobjcurr, vrf_table):
def _query_check_vrf_dev(self, ifaceobj, ifaceobjcurr, vrf_table,
withdefaults):
try:
if not self.ipcmd.link_exists(ifaceobj.name):
self.logger.info('%s: vrf: does not exist' %(ifaceobj.name))
@@ -767,15 +768,28 @@ class vrf(moduleBase):
else:
ifaceobjcurr.update_config_with_status('vrf-table',
running_table, 0)
if not withdefaults:
return
if self.vrf_helper:
ret_vrfhelper = self.exec_command('%s verify %s %s'
%(self.vrf_helper,
ifaceobj.name, vrf_table))
if 'default routes are installed' not in ret_vrfhelper:
ifaceobjcurr.update_config_with_status('vrf-default-route',
'no', 1)
else:
ifaceobjcurr.update_config_with_status('vrf-default-route',
'yes',0)
except Exception, e:
self.log_warn(str(e))
def _query_check(self, ifaceobj, ifaceobjcurr):
def _query_check(self, ifaceobj, ifaceobjcurr, withdefaults):
try:
vrf_table = ifaceobj.get_attr_value_first('vrf-table')
if vrf_table:
self._iproute2_vrf_map_initialize()
self._query_check_vrf_dev(ifaceobj, ifaceobjcurr, vrf_table)
self._query_check_vrf_dev(ifaceobj, ifaceobjcurr, vrf_table,
withdefaults)
else:
vrf = ifaceobj.get_attr_value_first('vrf')
if vrf:
@@ -841,6 +855,7 @@ class vrf(moduleBase):
return
self._init_command_handlers()
if operation == 'query-checkcurr':
op_handler(self, ifaceobj, query_ifaceobj)
op_handler(self, ifaceobj, query_ifaceobj,
extra_args['withdefaults'] if 'withdefaults' in extra_args else False)
else:
op_handler(self, ifaceobj, ifaceobj_getfunc=ifaceobj_getfunc)