diff options
author | Christian Breunig <christian@breunig.cc> | 2023-09-03 14:34:08 +0200 |
---|---|---|
committer | Christian Breunig <christian@breunig.cc> | 2023-09-03 14:34:08 +0200 |
commit | 114f8a9a66e49449e09ac3a1721db42626e54212 (patch) | |
tree | 3bdd8941cdf68b973d628bb6e62cf4e5271dbb91 /python/vyos | |
parent | 725b6e0454427b8c2b3a507c61d6192ca7522a7e (diff) | |
download | vyos-1x-114f8a9a66e49449e09ac3a1721db42626e54212.tar.gz vyos-1x-114f8a9a66e49449e09ac3a1721db42626e54212.zip |
netns: T5241: use common interface_exists() helper
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/utils/network.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py index fa86795eb..8b4385cfb 100644 --- a/python/vyos/utils/network.py +++ b/python/vyos/utils/network.py @@ -78,8 +78,7 @@ def get_interface_config(interface): """ Returns the used encapsulation protocol for given interface. If interface does not exist, None is returned. """ - import os - if not os.path.exists(f'/sys/class/net/{interface}'): + if not interface_exists(interface): return None from json import loads from vyos.utils.process import cmd @@ -90,8 +89,7 @@ def get_interface_address(interface): """ Returns the used encapsulation protocol for given interface. If interface does not exist, None is returned. """ - import os - if not os.path.exists(f'/sys/class/net/{interface}'): + if not interface_exists(interface): return None from json import loads from vyos.utils.process import cmd @@ -141,8 +139,7 @@ def is_wwan_connected(interface): def get_bridge_fdb(interface): """ Returns the forwarding database entries for a given interface """ - import os - if not os.path.exists(f'/sys/class/net/{interface}'): + if not interface_exists(interface): return None from json import loads from vyos.utils.process import cmd |