diff options
author | Christian Breunig <christian@breunig.cc> | 2023-07-12 21:05:12 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-07-12 21:16:56 +0200 |
commit | 6e621e42f463d8643b504916a1cc7c967f5bd6f1 (patch) | |
tree | d6b17a1fceab9e9aaf8d836576c881640235ac22 /python/vyos/utils/network.py | |
parent | 6a44472d0b94ff225499f61ce057ad7709c9fafc (diff) | |
download | vyos-1x-6e621e42f463d8643b504916a1cc7c967f5bd6f1.tar.gz vyos-1x-6e621e42f463d8643b504916a1cc7c967f5bd6f1.zip |
bgp: T5338: simplify XML and code handling
Diffstat (limited to 'python/vyos/utils/network.py')
-rw-r--r-- | python/vyos/utils/network.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py index 7386d44f0..209bc9ecc 100644 --- a/python/vyos/utils/network.py +++ b/python/vyos/utils/network.py @@ -13,8 +13,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library. If not, see <http://www.gnu.org/licenses/>. -import os - def get_protocol_by_name(protocol_name): """Get protocol number by protocol name @@ -34,3 +32,12 @@ def interface_exists_in_netns(interface_name, netns): if rc == 0: return True return False + +def get_interface_vrf(interface): + """ Returns VRF of given interface """ + from vyos.util import dict_search + from vyos.util import get_interface_config + tmp = get_interface_config(interface) + if dict_search('linkinfo.info_slave_kind', tmp) == 'vrf': + return tmp['master'] + return 'default' |