From b184a5700f22bac01aa937fa3d8321f003d6ca14 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 8 Apr 2020 20:35:28 +0200 Subject: op-mode: lldp: T2246: check if service is configured --- src/op_mode/lldp_op.py | 6 ++++++ 1 file changed, 6 insertions(+) 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'): -- cgit v1.2.3