diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-08 20:35:28 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-08 20:36:30 +0200 |
commit | b184a5700f22bac01aa937fa3d8321f003d6ca14 (patch) | |
tree | de41f95b5735874de4d1bf0a2848a2cdd893bdb1 /src/op_mode/lldp_op.py | |
parent | c497007369bf53aa99399a9ede4b52fc2d50b563 (diff) | |
download | vyos-1x-b184a5700f22bac01aa937fa3d8321f003d6ca14.tar.gz vyos-1x-b184a5700f22bac01aa937fa3d8321f003d6ca14.zip |
op-mode: lldp: T2246: check if service is configured
Diffstat (limited to 'src/op_mode/lldp_op.py')
-rwxr-xr-x | src/op_mode/lldp_op.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/op_mode/lldp_op.py b/src/op_mode/lldp_op.py index c8a5543b6..5d48e3210 100755 --- a/src/op_mode/lldp_op.py +++ b/src/op_mode/lldp_op.py @@ -23,6 +23,7 @@ from sys import exit from tabulate import tabulate from vyos.util import popen +from vyos.config import Config parser = argparse.ArgumentParser() parser.add_argument("-a", "--all", action="store_true", help="Show LLDP neighbors on all interfaces") @@ -141,6 +142,11 @@ if __name__ == '__main__': args = parser.parse_args() tmp = { 'neighbors' : [] } + c = Config() + if not c.exists_effective(['service', 'lldp']): + print('Service LLDP is not configured') + exit(0) + if args.all: neighbors = minidom.parseString(_get_neighbors()) for neighbor in neighbors.getElementsByTagName('interface'): |