diff options
Diffstat (limited to 'src/op_mode/neighbor.py')
-rwxr-xr-x | src/op_mode/neighbor.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/op_mode/neighbor.py b/src/op_mode/neighbor.py index b0b52c082..d86a372ac 100755 --- a/src/op_mode/neighbor.py +++ b/src/op_mode/neighbor.py @@ -32,12 +32,17 @@ import typing import vyos.opmode +def interface_exists(interface): + import os + return os.path.exists(f'/sys/class/net/{interface}') def get_raw_data(family, interface=None, state=None): from json import loads from vyos.util import cmd if interface: + if not interface_exists(interface): + raise ValueError(f"Interface '{interface}' does not exist in the system") interface = f"dev {interface}" else: interface = "" |