summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-10-18 22:26:44 +0700
committerGitHub <noreply@github.com>2020-10-18 22:26:44 +0700
commitb3e486604c46c4aec858706ac90c833f3b4ebe5c (patch)
tree0b977c18b744a815e21648c4487169f77de58f8c /src
parent8ae0935d6b8a72ffe356a03f24387563ce8ae21f (diff)
parent5293a9d048b0187ad8c0819097edddc25c492519 (diff)
downloadvyos-1x-b3e486604c46c4aec858706ac90c833f3b4ebe5c.tar.gz
vyos-1x-b3e486604c46c4aec858706ac90c833f3b4ebe5c.zip
Merge pull request #578 from bmhughes/fix-show-lldp-neighbors
op-mode: lldp: T2993: Fixup 'show lldp neighbors'
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/lldp_op.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/op_mode/lldp_op.py b/src/op_mode/lldp_op.py
index 5f86ad7a5..172ce71b7 100755
--- a/src/op_mode/lldp_op.py
+++ b/src/op_mode/lldp_op.py
@@ -104,13 +104,14 @@ if __name__ == '__main__':
exit(0)
elif args.all or args.interface:
tmp = json.loads(get_neighbors())
-
- if args.all:
- neighbors = tmp['lldp']['interface']
- elif args.interface:
- neighbors = dict()
- if args.interface in tmp['lldp']['interface']:
- neighbors[args.interface] = tmp['lldp']['interface'][args.interface]
+ neighbors = dict()
+
+ if 'interface' in tmp.get('lldp'):
+ if args.all:
+ neighbors = tmp['lldp']['interface']
+ elif args.interface:
+ if args.interface in tmp['lldp']['interface']:
+ neighbors[args.interface] = tmp['lldp']['interface'][args.interface]
else:
parser.print_help()