diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-11-06 19:49:53 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-11-06 19:49:53 +0100 |
commit | 5945a1d08bd1ad10cee99ce4be242a7b6e09c132 (patch) | |
tree | 6f6478df069697b885db04ef8391ee6ff2a84f2e /src/op_mode | |
parent | 8b535ac2b5cd040e0864f668f39c568cb78bafb7 (diff) | |
download | vyos-1x-5945a1d08bd1ad10cee99ce4be242a7b6e09c132.tar.gz vyos-1x-5945a1d08bd1ad10cee99ce4be242a7b6e09c132.zip |
op-mode: T2731: fix "show interfaces" returns invalid state when link is down
There has been a miss-match of admin-down and oper-down status for the Python
implementation of "show interfaces".
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/show_interfaces.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py index d4dae3cd1..de41274a7 100755 --- a/src/op_mode/show_interfaces.py +++ b/src/op_mode/show_interfaces.py @@ -217,8 +217,9 @@ def run_show_intf_brief(ifnames, iftypes, vif, vrrp): admin_state = interface.get_admin_state() intf = [interface.ifname,] - oper = ['u', ] if oper_state in ('up', 'unknown') else ['A', ] - admin = ['u', ] if oper_state in ('up', 'unknown') else ['D', ] + + oper = ['u', ] if oper_state in ('up', 'unknown') else ['D', ] + admin = ['u', ] if admin_state in ('up', 'unknown') else ['A', ] addrs = [_ for _ in interface.get_addr() if not _.startswith('fe80::')] or ['-', ] descs = list(split_text(interface.get_alias(),0)) @@ -226,8 +227,8 @@ def run_show_intf_brief(ifnames, iftypes, vif, vrrp): i = intf.pop(0) if intf else '' a = addrs.pop(0) if addrs else '' d = descs.pop(0) if descs else '' - s = [oper.pop(0)] if oper else [] - l = [admin.pop(0)] if admin else [] + s = [admin.pop(0)] if admin else [] + l = [oper.pop(0)] if oper else [] if len(a) < 33: print(format1 % (i, a, '/'.join(s+l), d)) else: |