summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-08 20:35:28 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-08 20:36:30 +0200
commitb184a5700f22bac01aa937fa3d8321f003d6ca14 (patch)
treede41f95b5735874de4d1bf0a2848a2cdd893bdb1 /src/op_mode
parentc497007369bf53aa99399a9ede4b52fc2d50b563 (diff)
downloadvyos-1x-b184a5700f22bac01aa937fa3d8321f003d6ca14.tar.gz
vyos-1x-b184a5700f22bac01aa937fa3d8321f003d6ca14.zip
op-mode: lldp: T2246: check if service is configured
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/lldp_op.py6
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'):