mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Fix a few minor ifquery check failures
Ticket: CM-3346 Reviewed By: Testing Done: Tested ifupdown2 sanity and query check failures.
This commit is contained in:
@@ -259,6 +259,7 @@ class address(moduleBase):
|
||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
||||
self.logger.debug('iface %s not found' %ifaceobj.name)
|
||||
return
|
||||
addr_method = ifaceobj.addr_method
|
||||
self.query_n_update_ifaceobjcurr_attr(ifaceobj, ifaceobjcurr,
|
||||
'mtu', self.ipcmd.link_get_mtu)
|
||||
hwaddress = ifaceobj.get_attr_value_first('hwaddress')
|
||||
@@ -278,6 +279,8 @@ class address(moduleBase):
|
||||
self.query_n_update_ifaceobjcurr_attr(ifaceobj, ifaceobjcurr,
|
||||
'alias', self.ipcmd.link_get_alias)
|
||||
# compare addresses
|
||||
if addr_method == 'dhcp':
|
||||
return
|
||||
addrs = self._get_iface_addresses(ifaceobj)
|
||||
runningaddrsdict = self.ipcmd.addr_get(ifaceobj.name)
|
||||
|
||||
@@ -320,7 +323,6 @@ class address(moduleBase):
|
||||
def _query_running(self, ifaceobjrunning):
|
||||
if not self.ipcmd.link_exists(ifaceobjrunning.name):
|
||||
self.logger.debug('iface %s not found' %ifaceobjrunning.name)
|
||||
ifaceobjrunning.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
dhclientcmd = dhclient()
|
||||
if (dhclientcmd.is_running(ifaceobjrunning.name) or
|
||||
|
@@ -1084,7 +1084,6 @@ class bridge(moduleBase):
|
||||
return
|
||||
if not self.brctlcmd.bridge_exists(ifaceobj.name):
|
||||
self.logger.info('%s: bridge: does not exist' %(ifaceobj.name))
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
|
||||
ifaceattrs = self.dict_key_subset(ifaceobj.config,
|
||||
|
@@ -119,6 +119,7 @@ class bridgevlan(moduleBase):
|
||||
else:
|
||||
ifaceobjcurr.update_config_with_status(
|
||||
'bridge-igmp-querier-src', attrval, 0)
|
||||
ifaceobjcurr.status = ifaceStatus.SUCCESS
|
||||
return
|
||||
|
||||
def _query_running(self, ifaceobjrunning):
|
||||
|
@@ -61,19 +61,19 @@ class dhcp(moduleBase):
|
||||
if ifaceobj.addr_family != 'inet':
|
||||
ifaceobjcurr.status = ifaceStatus.ERROR
|
||||
ifaceobjcurr.addr_method = 'dhcp'
|
||||
ifaceobjcurr.status = ifaceStatus.SUCCESS
|
||||
elif self.dhclientcmd.is_running6(ifaceobjcurr.name):
|
||||
ifaceobjcurr.addr_family = 'inet6'
|
||||
if ifaceobj.addr_family != 'inet6':
|
||||
ifaceobjcurr.status = ifaceStatus.ERROR
|
||||
ifaceobjcurr.addr_method = 'dhcp'
|
||||
ifaceobjcurr.status = ifaceStatus.SUCCESS
|
||||
else:
|
||||
ifaceobjcurr.addr_family = None
|
||||
ifaceobjcurr.status = ifaceStatus.ERROR
|
||||
|
||||
def _query_running(self, ifaceobjrunning):
|
||||
if not self.ipcmd.link_exists(ifaceobjrunning.name):
|
||||
self.logger.debug('iface %s not found' %ifaceobjrunning.name)
|
||||
ifaceobjrunning.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
if self.dhclientcmd.is_running(ifaceobjrunning.name):
|
||||
ifaceobjrunning.addr_family = 'inet'
|
||||
|
@@ -259,7 +259,6 @@ class ifenslave(moduleBase):
|
||||
if not self.ifenslavecmd.bond_exists(ifaceobj.name):
|
||||
self.logger.debug('bond iface %s' %ifaceobj.name +
|
||||
' does not exist')
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
|
||||
ifaceattrs = self.dict_key_subset(ifaceobj.config,
|
||||
|
@@ -36,7 +36,6 @@ class loopback(moduleBase):
|
||||
|
||||
def _query_check(self, ifaceobj, ifaceobjcurr):
|
||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
|
||||
_run_ops = {'pre-up' : _up,
|
||||
|
@@ -510,7 +510,6 @@ class mstpctl(moduleBase):
|
||||
|
||||
bridgeattrdict.update({k : [v] for k, v in portconfig.items()
|
||||
if v})
|
||||
self.logger.debug(bridgeattrdict)
|
||||
return bridgeattrdict
|
||||
|
||||
def _query_check_bridge(self, ifaceobj, ifaceobjcurr):
|
||||
@@ -519,7 +518,6 @@ class mstpctl(moduleBase):
|
||||
'mstpctl-treeportprio', 'mstpctl-treeportcost']
|
||||
if not self.brctlcmd.bridge_exists(ifaceobj.name):
|
||||
self.logger.debug('bridge %s does not exist' %ifaceobj.name)
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
ifaceattrs = self.dict_key_subset(ifaceobj.config,
|
||||
self.get_mod_attrs())
|
||||
@@ -617,8 +615,8 @@ class mstpctl(moduleBase):
|
||||
return
|
||||
bridgename = self.ipcmd.bridge_port_get_bridge_name(ifaceobj.name)
|
||||
# list of attributes that are not supported currently
|
||||
blacklistedattrs = ['mstpctl-pathcost',
|
||||
'mstpctl-treeprio', 'mstpctl-treecost']
|
||||
blacklistedattrs = ['mstpctl-portpathcost',
|
||||
'mstpctl-treeportprio', 'mstpctl-treeportcost']
|
||||
ifaceattrs = self.dict_key_subset(ifaceobj.config,
|
||||
self._port_attrs_map.keys())
|
||||
if not ifaceattrs:
|
||||
@@ -630,11 +628,9 @@ class mstpctl(moduleBase):
|
||||
# for all mstpctl options
|
||||
# get the corresponding ifaceobj attr
|
||||
v = ifaceobj.get_attr_value_first(k)
|
||||
if not v:
|
||||
if not v or k in blacklistedattrs:
|
||||
ifaceobjcurr.update_config_with_status(k, v, -1)
|
||||
continue
|
||||
if k in blacklistedattrs:
|
||||
continue
|
||||
currv = self.mstpctlcmd.get_bridgeport_attr(bridgename,
|
||||
ifaceobj.name, self._port_attrs_map.get(k))
|
||||
if currv:
|
||||
|
@@ -156,7 +156,6 @@ class vlan(moduleBase):
|
||||
|
||||
def _query_check(self, ifaceobj, ifaceobjcurr):
|
||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
if not '.' in ifaceobj.name:
|
||||
# if vlan name is not in the dot format, check its running state
|
||||
@@ -176,8 +175,6 @@ class vlan(moduleBase):
|
||||
|
||||
def _query_running(self, ifaceobjrunning):
|
||||
if not self.ipcmd.link_exists(ifaceobjrunning.name):
|
||||
if self._is_vlan_by_name(ifaceobjrunning.name):
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
if not self.ipcmd.get_vlandev_attrs(ifaceobjrunning.name):
|
||||
return
|
||||
|
@@ -76,7 +76,6 @@ class vxlan(moduleBase):
|
||||
|
||||
def _query_check(self, ifaceobj, ifaceobjcurr):
|
||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
||||
ifaceobjcurr.status = ifaceStatus.NOTFOUND
|
||||
return
|
||||
# Update vxlan object
|
||||
vxlanattrs = self.ipcmd.get_vxlandev_attrs(ifaceobj.name)
|
||||
|
@@ -1221,7 +1221,6 @@ class ifupdownMain(ifupdownBase):
|
||||
ifaceobjs = []
|
||||
ret = self._get_ifaceobjscurr_pretty(ifacenames, ifaceobjs)
|
||||
if not ifaceobjs: return
|
||||
self.logger.debug(ifaceobjs)
|
||||
if format == 'json':
|
||||
print json.dumps(ifaceobjs, cls=ifaceJsonEncoder, indent=2,
|
||||
separators=(',', ': '))
|
||||
|
@@ -53,6 +53,13 @@ class ifaceScheduler():
|
||||
if not ifupdownobj.ADDONS_ENABLE: return
|
||||
if op == 'query-checkcurr':
|
||||
query_ifaceobj=ifupdownobj.create_n_save_ifaceobjcurr(ifaceobj)
|
||||
# If not type bridge vlan and the object does not exist,
|
||||
# mark not found and return
|
||||
if (not ifupdownobj.link_exists(ifaceobj.name) and
|
||||
ifaceobj.type != ifaceType.BRIDGE_VLAN):
|
||||
query_ifaceobj.set_state_n_status(ifaceState.from_str(op),
|
||||
ifaceStatus.NOTFOUND)
|
||||
return
|
||||
for mname in ifupdownobj.module_ops.get(op):
|
||||
m = ifupdownobj.modules.get(mname)
|
||||
err = 0
|
||||
@@ -104,7 +111,8 @@ class ifaceScheduler():
|
||||
# if interface exists in the system
|
||||
ifacename = ifaceobjs[0].name
|
||||
ifupdownobj.logger.info('%s: running ops ...' %ifacename)
|
||||
if ('down' in ops[0] and ifaceobjs[0].type != ifaceType.BRIDGE_VLAN and
|
||||
if ('down' in ops[0] and
|
||||
ifaceobjs[0].type != ifaceType.BRIDGE_VLAN and
|
||||
not ifupdownobj.link_exists(ifacename)):
|
||||
ifupdownobj.logger.debug('%s: does not exist' %ifacename)
|
||||
# run posthook before you get out of here, so that
|
||||
|
Reference in New Issue
Block a user