diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-11-18 12:37:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-18 12:37:50 +0200 |
commit | b2c9187b95d7d94468997b66c185465b8bef354c (patch) | |
tree | c0f8e3c84d7fa350dd3f72b26517be92351ceca2 /src/op_mode | |
parent | a017d2337d8ea6957ca23f63e418ac14b7921fd3 (diff) | |
parent | 2f39874166278960af0a677c8e56d5c76d8fa138 (diff) | |
download | vyos-1x-b2c9187b95d7d94468997b66c185465b8bef354c.tar.gz vyos-1x-b2c9187b95d7d94468997b66c185465b8bef354c.zip |
Merge pull request #2502 from vyos/mergify/bp/sagitta/pr-2500
T5749: Swap show interfaces and show interfaces summary (backport #2500)
Diffstat (limited to 'src/op_mode')
-rwxr-xr-x | src/op_mode/interfaces.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/op_mode/interfaces.py b/src/op_mode/interfaces.py index c626535b5..14ffdca9f 100755 --- a/src/op_mode/interfaces.py +++ b/src/op_mode/interfaces.py @@ -235,6 +235,11 @@ def _get_summary_data(ifname: typing.Optional[str], if iftype is None: iftype = '' ret = [] + + def is_interface_has_mac(interface_name): + interface_no_mac = ('tun', 'wg') + return not any(interface_name.startswith(prefix) for prefix in interface_no_mac) + for interface in filtered_interfaces(ifname, iftype, vif, vrrp): res_intf = {} @@ -244,7 +249,7 @@ def _get_summary_data(ifname: typing.Optional[str], res_intf['addr'] = [_ for _ in interface.get_addr() if not _.startswith('fe80::')] res_intf['description'] = interface.get_alias() res_intf['mtu'] = interface.get_mtu() - res_intf['mac'] = interface.get_mac() + res_intf['mac'] = interface.get_mac() if is_interface_has_mac(interface.ifname) else 'n/a' res_intf['vrf'] = interface.get_vrf() ret.append(res_intf) |