mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
misc fixes
Ticket: CM-3346 Reviewed By: Testing Done: ifupdown2 sanity with new bridge driver
This commit is contained in:
@@ -172,6 +172,11 @@ class bridge(moduleBase):
|
||||
'example' : ['bridge-igmp-querier-src 172.16.101.1']},
|
||||
}}
|
||||
|
||||
# declare some ifaceobj priv_flags.
|
||||
# XXX: This assumes that the priv_flags is owned by this module
|
||||
# which it is not.
|
||||
_BRIDGE_PORT_PROCESSED = 0x1
|
||||
|
||||
def __init__(self, *args, **kargs):
|
||||
moduleBase.__init__(self, *args, **kargs)
|
||||
self.ipcmd = None
|
||||
@@ -684,28 +689,29 @@ class bridge(moduleBase):
|
||||
if not bportifaceobjlist:
|
||||
continue
|
||||
for bportifaceobj in bportifaceobjlist:
|
||||
# Dont process bridge port if it already has been processed
|
||||
if bportifaceobj.priv_flags & self._BRIDGE_PORT_PROCESSED:
|
||||
continue
|
||||
|
||||
# Add attributes specific to the vlan aware bridge
|
||||
if bridge_vlan_aware:
|
||||
self._apply_bridge_vlan_aware_port_settings_all(
|
||||
bportifaceobj, bridge_vids)
|
||||
self._apply_bridge_port_settings(
|
||||
bportifaceobj, bridgeifaceobj=ifaceobj)
|
||||
self._apply_bridge_port_settings(bportifaceobj,
|
||||
bridgeifaceobj=ifaceobj)
|
||||
|
||||
def _up(self, ifaceobj, ifaceobj_getfunc=None):
|
||||
# Check if bridge port
|
||||
if self._is_bridge_port(ifaceobj):
|
||||
bridgename = self._get_bridge_name(ifaceobj)
|
||||
if not bridgename:
|
||||
self.logger.warn('%s: unable to determine bridge name'
|
||||
%ifaceobj.name)
|
||||
return
|
||||
if self.ipcmd.bridge_is_vlan_aware(bridgename):
|
||||
bridge_vids = self._get_bridge_vids(bridgename,
|
||||
ifaceobj_getfunc)
|
||||
self._apply_bridge_vlan_aware_port_settings_all(ifaceobj,
|
||||
bridge_vids)
|
||||
self._apply_bridge_port_settings(ifaceobj, bridgename=bridgename)
|
||||
return
|
||||
bridgename = self.ipcmd.bridge_port_get_bridge_name(ifaceobj.name)
|
||||
if bridgename:
|
||||
if self.ipcmd.bridge_is_vlan_aware(bridgename):
|
||||
bridge_vids = self._get_bridge_vids(bridgename,
|
||||
ifaceobj_getfunc)
|
||||
self._apply_bridge_vlan_aware_port_settings_all(ifaceobj,
|
||||
bridge_vids)
|
||||
self._apply_bridge_port_settings(ifaceobj, bridgename=bridgename)
|
||||
ifaceobj.priv_flags |= self._BRIDGE_PORT_PROCESSED
|
||||
return
|
||||
if not self._is_bridge(ifaceobj):
|
||||
return
|
||||
try:
|
||||
|
@@ -144,6 +144,11 @@ class mstpctl(moduleBase):
|
||||
'mstpctl-portnetwork' : 'portnetwork',
|
||||
'mstpctl-portbpdufilter' : 'portbpdufilter'}
|
||||
|
||||
# declare some ifaceobj priv_flags.
|
||||
# XXX: This assumes that the priv_flags is owned by this module
|
||||
# which it is not.
|
||||
_BRIDGE_PORT_PROCESSED = 0x1
|
||||
|
||||
def __init__(self, *args, **kargs):
|
||||
moduleBase.__init__(self, *args, **kargs)
|
||||
self.ipcmd = None
|
||||
@@ -316,17 +321,20 @@ class mstpctl(moduleBase):
|
||||
|
||||
def _apply_bridge_port_settings_all(self, ifaceobj,
|
||||
ifaceobj_getfunc=None):
|
||||
self.logger.info('%s: applying bridge configuration '
|
||||
self.logger.info('%s: applying mstp configuration '
|
||||
%ifaceobj.name + 'specific to ports')
|
||||
|
||||
bridgeports = self._get_bridge_port_list(ifaceobj)
|
||||
for bport in bridgeports:
|
||||
self.logger.info('%s: processing bridge config for port %s'
|
||||
self.logger.info('%s: processing mstp config for port %s'
|
||||
%(ifaceobj.name, bport))
|
||||
bportifaceobjlist = ifaceobj_getfunc(bport)
|
||||
if not bportifaceobjlist:
|
||||
continue
|
||||
for bportifaceobj in bportifaceobjlist:
|
||||
# Dont process bridge port if it already has been processed
|
||||
if bportifaceobj.priv_flags & self._BRIDGE_PORT_PROCESSED:
|
||||
continue
|
||||
try:
|
||||
self._apply_bridge_port_settings(bportifaceobj,
|
||||
ifaceobj.name, ifaceobj)
|
||||
@@ -335,14 +343,12 @@ class mstpctl(moduleBase):
|
||||
|
||||
def _up(self, ifaceobj, ifaceobj_getfunc=None):
|
||||
# Check if bridge port
|
||||
if self._is_bridge_port(ifaceobj):
|
||||
bridgename = self.ipcmd.bridge_port_get_bridge_name(ifaceobj.name)
|
||||
if bridgename:
|
||||
if self.mstpctlcmd.is_mstpd_running():
|
||||
bridgename = ifaceobj.upperifaces[0]
|
||||
if not bridgename:
|
||||
self.logger.warn('%s: unable to determine bridge name'
|
||||
%ifaceobj.name)
|
||||
return
|
||||
self._apply_bridge_port_settings(ifaceobj, bridgename)
|
||||
self.logger.info("Roopa: %s: setting processed flag\n" %ifaceobj.name)
|
||||
ifaceobj.priv_flags |= self._BRIDGE_PORT_PROCESSED
|
||||
return
|
||||
if not self._is_bridge(ifaceobj):
|
||||
return
|
||||
@@ -587,7 +593,7 @@ class mstpctl(moduleBase):
|
||||
ifaceobj.check_n_update_config_with_status_many(
|
||||
self._port_attrs_map.keys(), 0)
|
||||
return
|
||||
bridgename = self._get_bridge_name(ifaceobj)
|
||||
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']
|
||||
|
@@ -53,10 +53,10 @@ class vlan(moduleBase):
|
||||
except:
|
||||
return -1
|
||||
|
||||
if ifaceobj.name.startswith('vlan'):
|
||||
vid_str = ifaceobj.name[4:]
|
||||
elif '.' in ifaceobj.name:
|
||||
if '.' in ifaceobj.name:
|
||||
vid_str = ifaceobj.name.split('.', 1)[1]
|
||||
elif ifaceobj.name.startswith('vlan'):
|
||||
vid_str = ifaceobj.name[4:]
|
||||
else:
|
||||
return -1
|
||||
try:
|
||||
|
Reference in New Issue
Block a user