summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-11-18 09:48:59 +0100
committerGitHub <noreply@github.com>2023-11-18 09:48:59 +0100
commitccc84c7bfc9ec9a8a044ed5f892d78854d5512f7 (patch)
tree4c895ec155d032972f3f289f0a18b0af174b1d8b /src/op_mode
parentd4f9d6ce726ea4d4fff6eecc16678d7a45a0b555 (diff)
parent056885c02b8671279808c226a759de6c5356f578 (diff)
downloadvyos-1x-ccc84c7bfc9ec9a8a044ed5f892d78854d5512f7.tar.gz
vyos-1x-ccc84c7bfc9ec9a8a044ed5f892d78854d5512f7.zip
Merge pull request #2500 from sever-sever/T5749
T5749: Swap show interfaces and show interfaces summary
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/interfaces.py7
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)