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

addons: bridge: fix 'ifquery -c' 'bridge vid error' on vlan aware bridge port

Ticket: CM-11811
Reviewed By: roopa, julien
Testing Done: used same configuration from ticket

For a VLAN aware bridge, if 'bridge-pvid' is not configured,
auto bridge
iface bridge
    bridge-ports swp7 swp8
    bridge-vids 1-200
    bridge-vlan-aware yes

'1' is would be running pvid and [2-200] would be running vids.
While doing _query_check() we compare configred versus running
vids excluding running 'pvid'. Configured vids here is [1-200]
and running is [2-200], but instead of excluding running 'pvid'
we used to exclued configured 'pvid' which is None in this case.
Comparison used to fail because of this.

This patch excludes running 'pvid' instead of configured 'pvid'
during _query_check()

This patch also fixes 'ifquery -c' error for bridge-pvid if
configured under a port of vlan aware bridge

sample configuration:
auto swp4
iface swp4

auto swp7
iface swp7
    bridge-pvid 2

auto swp8
iface swp8
    bridge-pvid 2

auto bridge
iface bridge
    bridge-ports swp4 swp7 swp8
    bridge-vids 1-200
    bridge-pvid 20
    bridge-vlan-aware yes

sample output:
root@dell-s3000-02:~# ifquery -c -a
auto swp4
iface swp4                                                      [pass]
    bridge-pvid 20                                              [pass]

auto swp7
iface swp7                                                      [pass]
    bridge-pvid 2                                               [pass]

auto swp8
iface swp8                                                      [pass]
    bridge-pvid 2                                               [pass]

auto bridge
iface bridge                                                    [pass]
    bridge-vlan-aware yes                                       [pass]
    bridge-ports swp8 swp7 swp4                                 [pass]
    bridge-pvid 20
    bridge-vids 1-200                                               []

Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
This commit is contained in:
Nikhil
2016-07-13 14:18:48 -07:00
parent 8c20f6c69e
commit cb8b16acbf

View File

@@ -1610,7 +1610,9 @@ class bridge(moduleBase):
running_pvid = running_vidinfo.get(ifaceobj.name,
{}).get('pvid')
attr_name = 'bridge-pvid'
pvid = self._get_bridge_pvid(bridgename, ifaceobj_getfunc)
pvid = ifaceobj.get_attr_value_first('bridge-pvid')
if not pvid:
pvid = self._get_bridge_pvid(bridgename, ifaceobj_getfunc)
if pvid:
if running_pvid and running_pvid == pvid:
ifaceobjcurr.update_config_with_status(attr_name,
@@ -1640,7 +1642,7 @@ class bridge(moduleBase):
running_vids = running_vidinfo.get(ifaceobj.name,
{}).get('vlan')
if (bridge_vids and (not running_vids or
not self._compare_vids(bridge_vids, running_vids, pvid))):
not self._compare_vids(bridge_vids, running_vids, running_pvid))):
ifaceobjcurr.status = ifaceStatus.ERROR
ifaceobjcurr.status_str = 'bridge vid error'