def _query(self, ifaceobj, **kwargs):
""" add default policy attributes supported by the module """
- if not (ifaceobj.link_kind & ifaceLinkKind.BRIDGE):
+ if (not (ifaceobj.link_kind & ifaceLinkKind.BRIDGE) or
+ ifaceobj.get_attr_value_first('bridge-stp')):
return
if self.default_stp_on:
ifaceobj.update_config('bridge-stp', 'yes')
return
+ def _query(self, ifaceobj, **kwargs):
+ """ add default policy attributes supported by the module """
+ if ifaceobj.link_kind:
+ return
+ for attr in ['speed', 'duplex', 'autoneg']:
+ if ifaceobj.get_attr_value_first('link-%s'%attr):
+ continue
+ default = policymanager.policymanager_api.get_iface_default(
+ module_name='ethtool',
+ ifname=ifaceobj.name,
+ attr='link-%s' %attr)
+ if not default:
+ continue
+ ifaceobj.update_config('link-%s' %attr, default)
+
_run_ops = {'pre-down' : _pre_down,
'post-up' : _post_up,
'query-checkcurr' : _query_check,
- 'query-running' : _query_running }
+ 'query-running' : _query_running,
+ 'query' : _query}
def get_ops(self):
""" returns list of ops supported by this module """
except Exception, e:
self.log_warn(str(e))
+ def _query(self, ifaceobj, **kwargs):
+ if not self.vrf_helper:
+ return
+ if (ifaceobj.link_kind & ifaceLinkKind.VRF):
+ ifaceobj.update_config('vrf-helper', '%s %s' %(self.vrf_helper,
+ ifaceobj.name))
+
_run_ops = {'pre-up' : _up,
'post-down' : _down,
'query-running' : _query_running,
- 'query-checkcurr' : _query_check}
+ 'query-checkcurr' : _query_check,
+ 'query' : _query}
def get_ops(self):
""" returns list of ops supported by this module """