diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-05 18:02:18 +0100 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-06 20:22:35 +0100 |
commit | 5d7f48ad03bff62e6350c1a30cf9929c39d9d2e6 (patch) | |
tree | 8954ade07f7841b83c61466cdc59ed9537acb179 /src/op_mode/lldp_op.py | |
parent | deed5740137032f5512f21d167af9f362922c71d (diff) | |
download | vyos-1x-5d7f48ad03bff62e6350c1a30cf9929c39d9d2e6.tar.gz vyos-1x-5d7f48ad03bff62e6350c1a30cf9929c39d9d2e6.zip |
util: T2226: rewrite op lldp to use popen
Diffstat (limited to 'src/op_mode/lldp_op.py')
-rwxr-xr-x | src/op_mode/lldp_op.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/op_mode/lldp_op.py b/src/op_mode/lldp_op.py index 4d8fdbc99..c8a5543b6 100755 --- a/src/op_mode/lldp_op.py +++ b/src/op_mode/lldp_op.py @@ -20,9 +20,10 @@ import jinja2 from xml.dom import minidom from sys import exit -from subprocess import Popen, PIPE, STDOUT from tabulate import tabulate +from vyos.util import popen + parser = argparse.ArgumentParser() parser.add_argument("-a", "--all", action="store_true", help="Show LLDP neighbors on all interfaces") parser.add_argument("-i", "--interface", action="store", help="Show LLDP neighbors on specific interface") @@ -40,9 +41,8 @@ Device ID Local Proto Cap Platform Port ID def _get_neighbors(): command = '/usr/sbin/lldpcli -f xml show neighbors' - p = Popen(command, stdout=PIPE, stderr=STDOUT, shell=True) - tmp = p.communicate()[0].strip() - return tmp.decode() + out,_ = popen(command) + return out def extract_neighbor(neighbor): """ |