summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-11-17 07:46:58 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2023-11-17 07:46:58 +0000
commit056885c02b8671279808c226a759de6c5356f578 (patch)
tree9d1707faa50b13d0a251c0f8a3088e51490b679c
parent96ed4f8f130aab266646ac399fdd7465b4751e44 (diff)
downloadvyos-1x-056885c02b8671279808c226a759de6c5356f578.tar.gz
vyos-1x-056885c02b8671279808c226a759de6c5356f578.zip
T5749: Swap show interfaces and show interfaces summary
By default show VRF, MAC, MTU for `show interfaces` The original `show interfaces` moved to `show interfacces summary`
-rw-r--r--op-mode-definitions/show-interfaces.xml.in4
-rwxr-xr-xsrc/op_mode/interfaces.py7
2 files changed, 8 insertions, 3 deletions
diff --git a/op-mode-definitions/show-interfaces.xml.in b/op-mode-definitions/show-interfaces.xml.in
index b58e0efea..09466647d 100644
--- a/op-mode-definitions/show-interfaces.xml.in
+++ b/op-mode-definitions/show-interfaces.xml.in
@@ -6,7 +6,7 @@
<properties>
<help>Show network interface information</help>
</properties>
- <command>${vyos_op_scripts_dir}/interfaces.py show_summary</command>
+ <command>${vyos_op_scripts_dir}/interfaces.py show_summary_extended</command>
<children>
<leafNode name="counters">
<properties>
@@ -24,7 +24,7 @@
<properties>
<help>Show summary information of all interfaces</help>
</properties>
- <command>${vyos_op_scripts_dir}/interfaces.py show_summary_extended</command>
+ <command>${vyos_op_scripts_dir}/interfaces.py show_summary</command>
</leafNode>
</children>
</node>
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)