mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: bridge: Fix for ifquery -c bridge pvid error to a valid config
Ticket: CM-8623 Reviewed By: Roopa Prabhu, Julien Fortin Testing Done: yes, using the below mentioned config. This patch fixes 'ifquery -c' error, bridge pvid error, which is an unrelated error for the following valid config. This patch also removes 'bridge-pvid', if configured, from 'bridge-vids' set. In the below example, 510 is removed from the set bridge-vids 510-550. The new bridge-vids set is 511-550. auto swp1 iface swp1 inet6 dhcp address 14.0.0.5/30 down ip addr flush dev swp1 auto Bridge1 iface Bridge1 address 0.0.0.0/0 down ip addr flush dev Bridge1 bridge-vlan-aware yes bridge-ports swp1 bridge-pvid 510 bridge-vids 510-550 bridge-stp on mstpctl-portnetwork swp1=yes Signed-off-by: Nikhil <nikhil@cumulusnetworks.com>
This commit is contained in:
@@ -472,12 +472,15 @@ class bridge(moduleBase):
|
||||
for start, end in self._ints_to_ranges(vids2_diff)]
|
||||
return (vids_to_del, vids_to_add)
|
||||
|
||||
def _compare_vids(self, vids1, vids2):
|
||||
def _compare_vids(self, vids1, vids2, pvid=None):
|
||||
""" Returns true if the vids are same else return false """
|
||||
|
||||
vids1_ints = self._ranges_to_ints(vids1)
|
||||
vids2_ints = self._ranges_to_ints(vids2)
|
||||
if Set(vids1_ints).symmetric_difference(vids2_ints):
|
||||
set_diff = Set(vids1_ints).symmetric_difference(vids2_ints)
|
||||
if pvid:
|
||||
set_diff = set_diff.remove(pvid)
|
||||
if set_diff:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -1557,6 +1560,21 @@ class bridge(moduleBase):
|
||||
ifaceobjcurr.update_config_with_status(attr_name, vids, 0)
|
||||
return
|
||||
|
||||
running_pvid = running_vidinfo.get(ifaceobj.name,
|
||||
{}).get('pvid')
|
||||
attr_name = 'bridge-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,
|
||||
running_pvid, 0)
|
||||
else:
|
||||
ifaceobjcurr.update_config_with_status(attr_name,
|
||||
running_pvid, 1)
|
||||
elif not running_pvid or running_pvid != '1':
|
||||
ifaceobjcurr.status = ifaceStatus.ERROR
|
||||
ifaceobjcurr.status_str = 'bridge pvid error'
|
||||
|
||||
attr_name = 'bridge-vids'
|
||||
vids = ifaceobj.get_attr_value_first(attr_name)
|
||||
if vids:
|
||||
@@ -1575,25 +1593,10 @@ 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))):
|
||||
not self._compare_vids(bridge_vids, running_vids, pvid))):
|
||||
ifaceobjcurr.status = ifaceStatus.ERROR
|
||||
ifaceobjcurr.status_str = 'bridge vid error'
|
||||
|
||||
running_pvid = running_vidinfo.get(ifaceobj.name,
|
||||
{}).get('pvid')
|
||||
attr_name = 'bridge-pvid'
|
||||
pvid = ifaceobj.get_attr_value_first(attr_name)
|
||||
if pvid:
|
||||
if running_pvid and running_pvid == pvid:
|
||||
ifaceobjcurr.update_config_with_status(attr_name,
|
||||
running_pvid, 0)
|
||||
else:
|
||||
ifaceobjcurr.update_config_with_status(attr_name,
|
||||
running_pvid, 1)
|
||||
elif not running_pvid or running_pvid != '1':
|
||||
ifaceobjcurr.status = ifaceStatus.ERROR
|
||||
ifaceobjcurr.status_str = 'bridge pvid error'
|
||||
|
||||
def _query_check_bridge_port(self, ifaceobj, ifaceobjcurr,
|
||||
ifaceobj_getfunc):
|
||||
if not self._is_bridge_port(ifaceobj):
|
||||
|
Reference in New Issue
Block a user