diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-07-14 20:13:53 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-07-18 08:14:33 +0200 |
commit | 752ddaff0a806527ab6cc787b4ab2a60fec01886 (patch) | |
tree | f46357a84c0cf39c43e70bd1cab9ee36627c2ec8 /python | |
parent | 3a1c690e22e397bbdecf47364c3f885df7a8e8ef (diff) | |
download | vyos-1x-752ddaff0a806527ab6cc787b4ab2a60fec01886.tar.gz vyos-1x-752ddaff0a806527ab6cc787b4ab2a60fec01886.zip |
bond: bridge: T4534: error out if member interface is assigned to a VRF instance
It makes no sense to enslave an interface to a bond or a bridge device if it is
bound to a given VRF. If VRFs should be used - the encapuslating/master
interface should be part of the VRF.
Error out if the member interface is part of a VRF.
(cherry picked from commit 87d2dff241d9ab4de9f3a2c7fbf9852934557aef)
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/validate.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py index 23e88b5ac..9aa23d3dc 100644 --- a/python/vyos/validate.py +++ b/python/vyos/validate.py @@ -260,3 +260,22 @@ def has_address_configured(conf, intf): conf.set_level(old_level) return ret + +def has_vrf_configured(conf, intf): + """ + Checks if interface has a VRF configured. + + Returns True if interface has VRF configured, False if it doesn't. + """ + from vyos.ifconfig import Section + ret = False + + old_level = conf.get_level() + conf.set_level([]) + + tmp = ['interfaces', Section.get_config_path(intf), 'vrf'] + if conf.exists(tmp): + ret = True + + conf.set_level(old_level) + return ret |