diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-06 20:06:55 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-06 20:06:55 +0100 |
commit | d5484f8250233f3d941ae72c65e797b65b721d6c (patch) | |
tree | c70477f61a5b64541385b03156e787cc2b2cb08f /src/conf_mode/interfaces-bridge.py | |
parent | 752d656424afc908f87b2b0daf9bf3bd7e7f092b (diff) | |
download | vyos-1x-d5484f8250233f3d941ae72c65e797b65b721d6c.tar.gz vyos-1x-d5484f8250233f3d941ae72c65e797b65b721d6c.zip |
vrf: T31: enable vrf support for bridge interface
Diffstat (limited to 'src/conf_mode/interfaces-bridge.py')
-rwxr-xr-x | src/conf_mode/interfaces-bridge.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/conf_mode/interfaces-bridge.py b/src/conf_mode/interfaces-bridge.py index 0810d63d6..f189ce36d 100755 --- a/src/conf_mode/interfaces-bridge.py +++ b/src/conf_mode/interfaces-bridge.py @@ -52,7 +52,8 @@ default_config_data = { 'member': [], 'member_remove': [], 'priority': 32768, - 'stp': 0 + 'stp': 0, + 'vrf': '' } def get_config(): @@ -191,12 +192,20 @@ def get_config(): if conf.exists('stp'): bridge['stp'] = 1 + # retrieve VRF instance + if conf.exists('vrf'): + bridge['vrf'] = conf.return_value('vrf') + return bridge def verify(bridge): if bridge['dhcpv6_prm_only'] and bridge['dhcpv6_temporary']: raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!') + vrf_name = bridge['vrf'] + if vrf_name and vrf_name not in interfaces(): + raise ConfigError(f'VRF "{vrf_name}" does not exist') + conf = Config() for br in conf.list_nodes('interfaces bridge'): # it makes no sense to verify ourself in this case @@ -286,6 +295,12 @@ def apply(bridge): # store DHCPv6 config dictionary - used later on when addresses are aquired br.set_dhcpv6_options(opt) + # assign to VRF + if bridge['vrf']: + br.add_vrf(bridge['vrf']) + else: + br.del_vrf(bridge['vrf']) + # Change interface MAC address if bridge['mac']: br.set_mac(bridge['mac']) |