summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-bridge.py
diff options
context:
space:
mode:
authorjack9603301 <jack9603301@163.com>2021-01-13 13:33:29 +0800
committerjack9603301 <jack9603301@163.com>2021-01-15 16:26:33 +0800
commitfddf7daf9f5177c11f3bac911f477e3063f69786 (patch)
treee1f696db4e3e080ca6f6e289120e01fa7b8da1d5 /src/conf_mode/interfaces-bridge.py
parent38566b8fbdec60b1601ed127fd759c85802909e9 (diff)
downloadvyos-1x-fddf7daf9f5177c11f3bac911f477e3063f69786.tar.gz
vyos-1x-fddf7daf9f5177c11f3bac911f477e3063f69786.zip
bridge: T3137: Better implementation of VLAN aware Bridge
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-xsrc/conf_mode/interfaces-bridge.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py
index d5bcfec4f..4817947eb 100755
--- a/src/conf_mode/interfaces-bridge.py
+++ b/src/conf_mode/interfaces-bridge.py
@@ -73,7 +73,6 @@ def get_config(config=None):
# the default dictionary is not properly paged into the dict (see T2665)
# thus we will ammend it ourself
default_member_values = defaults(base + ['member', 'interface'])
- vlan_aware = True if 'enable_vlan' in bridge else False
for interface,interface_config in bridge['member']['interface'].items():
bridge['member']['interface'][interface] = dict_merge(
default_member_values, bridge['member']['interface'][interface])
@@ -97,7 +96,7 @@ def get_config(config=None):
# VLAN-aware bridge members must not have VLAN interface configuration
tmp = has_vlan_subinterface_configured(conf,interface)
- if vlan_aware and tmp:
+ if 'enable_vlan' in bridge and tmp:
bridge['member']['interface'][interface].update({'has_vlan' : ''})
return bridge
@@ -108,8 +107,6 @@ def verify(bridge):
verify_dhcpv6(bridge)
verify_vrf(bridge)
-
- vlan_aware = True if 'enable_vlan' in bridge else False
ifname = bridge['ifname']
@@ -135,7 +132,7 @@ def verify(bridge):
if 'has_address' in interface_config:
raise ConfigError(error_msg + 'it has an address assigned!')
- if vlan_aware:
+ if 'enable_vlan' in bridge:
if 'has_vlan' in interface_config:
raise ConfigError(error_msg + 'it has an VLAN subinterface assigned!')
@@ -159,7 +156,7 @@ def verify(bridge):
if 'native_vlan' in interface_config:
raise ConfigError(f'You must first activate "enable-vlan" of {ifname} bridge to use "native-vlan"')
- if vlan_aware:
+ if 'enable_vlan' in bridge:
if dict_search('vif.1', bridge):
raise ConfigError(f'VLAN 1 sub interface cannot be set for VLAN aware bridge {ifname}, and VLAN 1 is always the parent interface')
else: