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

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

This patch also: (1) fixes ifquery check failure for bridge-* stp attributes.
(2) removes vrf-default-route and vrf-cgroup attributes from ifupdown2 policy
and just have the vrf-helper attribute

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
This commit is contained in:
Nikhil
2016-04-20 03:02:26 -07:00
parent 669b422add
commit 6e16e5ae90
9 changed files with 84 additions and 85 deletions

View File

@@ -13,6 +13,7 @@ try:
from ifupdownaddons.utilsbase import *
from ifupdownaddons.modulebase import moduleBase
from ifupdownaddons.iproute2 import iproute2
import ifupdown.ifupdownflags as ifupdownflags
except ImportError, e:
raise ImportError (str(e) + "- required module not found")
@@ -123,7 +124,7 @@ class ethtool(moduleBase,utilsBase):
def _pre_down(self, ifaceobj):
pass #self._post_up(ifaceobj,operation="_pre_down")
def _query_check(self, ifaceobj, ifaceobjcurr, withdefaults):
def _query_check(self, ifaceobj, ifaceobjcurr):
"""
_query_check() needs to compare the configured (or running)
attribute with the running attribute.
@@ -133,12 +134,11 @@ class ethtool(moduleBase,utilsBase):
This is because a reboot will lose their running attribute
(the default will get set).
"""
# Add default attributes if --with-defaults is set
for attr in ['speed', 'duplex', 'autoneg']:
configured = ifaceobj.get_attr_value_first('link-%s'%attr)
# if there is nothing configured, do not check
if not configured:
if not withdefaults:
if not ifupdownflags.flags.WITHDEFAULTS:
continue
default = policymanager.policymanager_api.get_iface_default(
module_name='ethtool',
@@ -268,7 +268,6 @@ class ethtool(moduleBase,utilsBase):
self._init_command_handlers()
if operation == 'query-checkcurr':
op_handler(self, ifaceobj, query_ifaceobj,
extra_args['withdefaults'] if 'withdefaults' in extra_args else False)
op_handler(self, ifaceobj, query_ifaceobj)
else:
op_handler(self, ifaceobj)