summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-08 12:39:58 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-08 12:52:39 +0100
commit4a44abe0a9405bedc73a309cd53b99d20e37a3ad (patch)
tree7e244f0c2cddf8acae71e122f88f9377dbb782dc /src/conf_mode
parent2a77089eabea62c7051434d874884a81de8f3f02 (diff)
downloadvyos-1x-4a44abe0a9405bedc73a309cd53b99d20e37a3ad.tar.gz
vyos-1x-4a44abe0a9405bedc73a309cd53b99d20e37a3ad.zip
vrf: T31: enable vrf support for pseudo-ethernet/macvlan interface
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-pseudo-ethernet.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/conf_mode/interfaces-pseudo-ethernet.py b/src/conf_mode/interfaces-pseudo-ethernet.py
index e775b0fcd..989b1432b 100755
--- a/src/conf_mode/interfaces-pseudo-ethernet.py
+++ b/src/conf_mode/interfaces-pseudo-ethernet.py
@@ -53,7 +53,8 @@ default_config_data = {
'vif_s': [],
'vif_s_remove': [],
'vif': [],
- 'vif_remove': []
+ 'vif_remove': [],
+ 'vrf': ''
}
def get_config():
@@ -159,6 +160,10 @@ def get_config():
if conf.exists(['mode']):
peth['mode'] = conf.return_value(['mode'])
+ # retrieve VRF instance
+ if conf.exists('vrf'):
+ peth['vrf'] = conf.return_value('vrf')
+
# re-set configuration level to parse new nodes
conf.set_level(cfg_base)
# get vif-s interfaces (currently effective) - to determine which vif-s
@@ -200,9 +205,12 @@ def verify(peth):
if not peth['link'] in interfaces():
raise ConfigError('Pseudo-ethernet source interface does not exist')
+ vrf_name = peth['vrf']
+ if vrf_name and vrf_name not in interfaces():
+ raise ConfigError(f'VRF "{vrf_name}" does not exist')
+
# use common function to verify VLAN configuration
verify_vlan_config(peth)
-
return None
def generate(peth):
@@ -289,6 +297,12 @@ def apply(peth):
# Enable private VLAN proxy ARP on this interface
p.set_proxy_arp_pvlan(peth['ip_proxy_arp_pvlan'])
+ # assign to VRF
+ if peth['vrf']:
+ p.add_vrf(peth['vrf'])
+ else:
+ p.del_vrf(peth['vrf'])
+
# Change interface MAC address
if peth['mac']:
p.set_mac(peth['mac'])