diff options
| -rw-r--r-- | op-mode-definitions/clear-interfaces.xml.in | 825 | ||||
| -rw-r--r-- | op-mode-definitions/generate_tech-support_archive.xml.in | 20 | ||||
| -rw-r--r-- | op-mode-definitions/policy-route.xml.in | 20 | ||||
| -rw-r--r-- | op-mode-definitions/show-babel.xml.in | 10 | ||||
| -rw-r--r-- | op-mode-definitions/show-bfd.xml.in | 5 | ||||
| -rw-r--r-- | op-mode-definitions/show-bgp.xml.in | 10 | ||||
| -rw-r--r-- | op-mode-definitions/show-bridge.xml.in | 10 | ||||
| -rw-r--r-- | op-mode-definitions/show-ip-access-paths-prefix-community-lists.xml.in | 72 | ||||
| -rw-r--r-- | op-mode-definitions/show-ipv6-ospfv3.xml.in | 34 | ||||
| -rw-r--r-- | op-mode-definitions/show-ipv6-prefix-list.xml.in | 20 | ||||
| -rw-r--r-- | op-mode-definitions/show-ipv6.xml.in | 10 | ||||
| -rw-r--r-- | op-mode-definitions/show-route-map.xml.in | 10 | ||||
| -rw-r--r-- | op-mode-definitions/show-users.xml.in | 10 | ||||
| -rw-r--r-- | op-mode-definitions/system-image.xml.in | 22 | ||||
| -rw-r--r-- | schema/op-mode-definition.rnc | 24 | ||||
| -rw-r--r-- | schema/op-mode-definition.rng | 35 | ||||
| -rwxr-xr-x | scripts/build-command-op-templates | 27 |
17 files changed, 424 insertions, 740 deletions
diff --git a/op-mode-definitions/clear-interfaces.xml.in b/op-mode-definitions/clear-interfaces.xml.in index 31348808a..4b4362add 100644 --- a/op-mode-definitions/clear-interfaces.xml.in +++ b/op-mode-definitions/clear-interfaces.xml.in @@ -12,590 +12,267 @@ <children> <node name="counters"> <properties> - <help>Clear interface counters for all interfaces</help> + <help>Clear interface counters</help> </properties> <command>${vyos_op_scripts_dir}/interfaces.py clear_counters</command> - </node> - <node name="bonding"> - <properties> - <help>Clear Bonding interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all bonding interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="bonding"> - <properties> - <help>Clear interface information for a given bonding interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type bonding</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given bonding interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="bridge"> - <properties> - <help>Clear Bridge interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all bridge interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="bridge"> - <properties> - <help>Clear interface information for a given bridge interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type bridge</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given bridge interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="dummy"> - <properties> - <help>Clear Dummy interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all dummy interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="dummy"> - <properties> - <help>Clear interface information for a given dummy interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type dummy</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given dummy interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="ethernet"> - <properties> - <help>Clear Ethernet interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all ethernet interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="ethernet"> - <properties> - <help>Clear interface information for a given ethernet interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type ethernet</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given ethernet interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="geneve"> - <properties> - <help>Clear GENEVE interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all GENEVE interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="geneve"> - <properties> - <help>Clear interface information for a given GENEVE interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type geneve</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given GENEVE interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="input"> - <properties> - <help>Clear Input (ifb) interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all Input interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="input"> - <properties> - <help>Clear interface information for a given Input interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type input</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given Input interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="l2tpv3"> - <properties> - <help>Clear L2TPv3 interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all L2TPv3 interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="l2tpv3"> - <properties> - <help>Clear interface information for a given L2TPv3 interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type l2tpeth</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given L2TPv3 interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="loopback"> - <properties> - <help>Clear Loopback interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all loopback interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="loopback"> - <properties> - <help>Clear interface information for a given loopback interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type loopback</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given loopback interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="macsec"> - <properties> - <help>Clear MACsec interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all MACsec interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="macsec"> - <properties> - <help>Clear interface information for a given MACsec interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type macsec</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given MACsec interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="openvpn"> - <properties> - <help>Clear OpenVPN interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all OpenVPN interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="openvpn"> - <properties> - <help>Clear interface information for a given OpenVPN interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type openvpn</script> - </completionHelp> - </properties> <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given OpenVPN interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="pppoe"> - <properties> - <help>Clear PPPoE interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all PPPoE interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> + <tagNode name="bonding"> + <properties> + <help>Clear counters for a given bonding interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type bonding</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear bonding interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type bonding</command> + </standalone> + </tagNode> + <tagNode name="bridge"> + <properties> + <help>Clear counters for a given bridge interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type bridge</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear bridge interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type bridge</command> + </standalone> + </tagNode> + <tagNode name="dummy"> + <properties> + <help>Clear counters for a given dummy interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type dummy</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear dummy interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type dummy</command> + </standalone> + </tagNode> + <tagNode name="ethernet"> + <properties> + <help>Clear counters for a given ethernet interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type ethernet</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear ethernet interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type ethernet</command> + </standalone> + </tagNode> + <tagNode name="geneve"> + <properties> + <help>Clear counters for a given GENEVE interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type geneve</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear GENEVE interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type geneve</command> + </standalone> + </tagNode> + <tagNode name="input"> + <properties> + <help>Clear counters for a given Input interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type input</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear input interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type input</command> + </standalone> + </tagNode> + <tagNode name="l2tpv3"> + <properties> + <help>Clear counters for a given L2TPv3 interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type l2tpeth</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear L2TPv3 interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type l2tpeth</command> + </standalone> + </tagNode> + <!-- There's only one loopback in Linux and it's unlikely to change, + so we don't need a tag node here. --> + <node name="loopback"> + <properties> + <help>Clear loopback interface counters</help> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name lo</command> </node> - </children> - </node> - <tagNode name="pppoe"> - <properties> - <help>Clear interface information for a given PPPoE interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type pppoe</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given PPPoE interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="pseudo-ethernet"> - <properties> - <help>Clear Pseudo-Ethernet/MACvlan interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all Pseudo-Ethernet interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="pseudo-ethernet"> - <properties> - <help>Clear interface information for a given Pseudo-Ethernet interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type pseudo-ethernet</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given Pseudo-Ethernet interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="sstp"> - <properties> - <help>Clear SSTP interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all SSTP interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="sstp"> - <properties> - <help>Clear interface information for a given SSTP interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type sstp</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given SSTP interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="tunnel"> - <properties> - <help>Clear Tunnel interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all tunnel interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="tunnel"> - <properties> - <help>Clear interface information for a given tunnel interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type tunnel</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given tunnel interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="virtual-ethernet"> - <properties> - <help>Clear virtual-ethernet interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all virtual-ethernet interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="virtual-ethernet"> - <properties> - <help>Clear interface information for a given virtual-ethernet interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type virtual-ethernet</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given virtual-ethernet interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="vti"> - <properties> - <help>Clear VTI interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all VTI interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="vti"> - <properties> - <help>Clear interface information for a given VTI interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type vti</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given VTI interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="vxlan"> - <properties> - <help>Clear VXLAN interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all VXLAN interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="vxlan"> - <properties> - <help>Clear interface information for a given VXLAN interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type vxlan</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given VXLAN interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="wireguard"> - <properties> - <help>Clear Wireguard interface information</help> - </properties> - <children> - <node name="counters"> - <properties> - <help>Clear all Wireguard interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </node> - </children> - </node> - <tagNode name="wireguard"> - <properties> - <help>Clear interface information for a given Wireguard interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type wireguard</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear interface counters for a given Wireguard interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="wireless"> - <properties> - <help>Clear Wireless (WLAN) interface information</help> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear all wireless interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </leafNode> - </children> - </node> - <tagNode name="wireless"> - <properties> - <help>Clear interface information for a given wireless interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type wireless</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> + <tagNode name="macsec"> + <properties> + <help>Clear counters for a given MACsec interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type macsec</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear MACsec interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type macsec</command> + </standalone> + </tagNode> + <tagNode name="openvpn"> + <properties> + <help>Clear counters for a given OpenVPN interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type openvpn</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear OpenVPN interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type openvpn</command> + </standalone> + </tagNode> + <tagNode name="pppoe"> + <properties> + <help>Clear counters for a given PPPoE interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type pppoe</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear PPPoE interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type pppoe</command> + </standalone> + </tagNode> + <tagNode name="pseudo-ethernet"> + <properties> + <help>Clear counters for a given pseudo-ethernet interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type pseudo-ethernet</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear pseudo-ethernet interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type pseudo-ethernet</command> + </standalone> + </tagNode> + <tagNode name="sstp"> + <properties> + <help>Clear counters for a given SSTP interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type sstp</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear SSTP interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type sstp</command> + </standalone> + </tagNode> + <tagNode name="tunnel"> + <properties> + <help>Clear counters for a given tunnel interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type tunnel</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear tunnel interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type tunnel</command> + </standalone> + </tagNode> + <tagNode name="virtual-ethernet"> + <properties> + <help>Clear counters for a given virtual-ethernet interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type virtual-ethernet</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear virtual-ethernet interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type virtual-ethernet</command> + </standalone> + </tagNode> + <tagNode name="vti"> + <properties> + <help>Clear counters for a given VTI interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type vti</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear VTI interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type vti</command> + </standalone> + </tagNode> + <tagNode name="vxlan"> + <properties> + <help>Clear counters for a given VXLAN interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type vxlan</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear VXLAN interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type vxlan</command> + </standalone> + </tagNode> + <tagNode name="wireguard"> + <properties> + <help>Clear counters for a given WireGuard interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type wireguard</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear WireGuard interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type wireguard</command> + </standalone> + </tagNode> + <tagNode name="wireless"> <properties> <help>Clear counters for a given wireless interface</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> - </children> - </tagNode> - <node name="wwan"> - <properties> - <help>Clear Wireless Modem (WWAN) interface information</help> - </properties> - <children> - <leafNode name="counters"> - <properties> - <help>Clear all WWAN interface counters</help> - </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type "$3"</command> - </leafNode> - </children> - </node> - <tagNode name="wwan"> - <properties> - <help>Clear interface information for a given WWAN interface</help> - <completionHelp> - <script>${vyos_completion_dir}/list_interfaces --type wwan</script> - </completionHelp> - </properties> - <children> - <leafNode name="counters"> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type wireless</script> + </completionHelp> + </properties> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear wireless interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type wireless</command> + </standalone> + </tagNode> + <tagNode name="wwan"> <properties> <help>Clear counters for a given WWAN interface</help> + <completionHelp> + <script>${vyos_completion_dir}/list_interfaces --type wwan</script> + </completionHelp> </properties> - <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$4"</command> - </leafNode> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-name "$5"</command> + <standalone> + <help>Clear wireless wide area network interface counters</help> + <command>${vyos_op_scripts_dir}/interfaces.py clear_counters --intf-type wwan</command> + </standalone> + </tagNode> </children> - </tagNode> + </node> </children> </node> </children> diff --git a/op-mode-definitions/generate_tech-support_archive.xml.in b/op-mode-definitions/generate_tech-support_archive.xml.in index b7e025a38..939b3dec4 100644 --- a/op-mode-definitions/generate_tech-support_archive.xml.in +++ b/op-mode-definitions/generate_tech-support_archive.xml.in @@ -7,12 +7,6 @@ <help>Generate tech support info</help> </properties> <children> - <node name="archive"> - <properties> - <help>Generate tech support archive</help> - </properties> - <command>${vyos_op_scripts_dir}/generate_tech-support_archive.py</command> - </node> <tagNode name="archive"> <properties> <help>Generate tech support archive to defined location</help> @@ -21,13 +15,11 @@ </completionHelp> </properties> <command>${vyos_op_scripts_dir}/generate_tech-support_archive.py $4</command> - </tagNode> - <node name="machine-readable-archive"> - <properties> + <standalone> <help>Generate tech support archive</help> - </properties> - <command>${vyos_op_scripts_dir}/tech_support.py show --raw | gzip> $4.json.gz</command> - </node> + <command>${vyos_op_scripts_dir}/generate_tech-support_archive.py</command> + </standalone> + </tagNode> <tagNode name="machine-readable-archive"> <properties> <help>Generate tech support archive to defined location</help> @@ -36,6 +28,10 @@ </completionHelp> </properties> <command>${vyos_op_scripts_dir}/tech_support.py show --raw | gzip > $4.json.gz</command> + <standalone> + <help>Generate a machine-readable tech support archive</help> + <command>${vyos_op_scripts_dir}/tech_support.py show --raw | gzip> $4.json.gz</command> + </standalone> </tagNode> </children> </node> diff --git a/op-mode-definitions/policy-route.xml.in b/op-mode-definitions/policy-route.xml.in index 6ddbb51a5..e733d976c 100644 --- a/op-mode-definitions/policy-route.xml.in +++ b/op-mode-definitions/policy-route.xml.in @@ -84,12 +84,6 @@ <help>Show policy information</help> </properties> <children> - <node name="route6"> - <properties> - <help>Show IPv6 policy chain</help> - </properties> - <command>${vyos_op_scripts_dir}/policy_route.py --action show_all --ipv6</command> - </node> <tagNode name="route6"> <properties> <help>Show IPv6 policy chains</help> @@ -97,6 +91,10 @@ <path>policy route6</path> </completionHelp> </properties> + <standalone> + <help>Show IPv6 policy chain</help> + <command>${vyos_op_scripts_dir}/policy_route.py --action show_all --ipv6</command> + </standalone> <children> <tagNode name="rule"> <properties> @@ -110,12 +108,6 @@ </children> <command>${vyos_op_scripts_dir}/policy_route.py --action show --name $4 --ipv6</command> </tagNode> - <node name="route"> - <properties> - <help>Show IPv4 policy chain</help> - </properties> - <command>${vyos_op_scripts_dir}/policy_route.py --action show_all</command> - </node> <tagNode name="route"> <properties> <help>Show IPv4 policy chains</help> @@ -123,6 +115,10 @@ <path>policy route</path> </completionHelp> </properties> + <standalone> + <help>Show IPv4 policy chains</help> + <command>${vyos_op_scripts_dir}/policy_route.py --action show_all</command> + </standalone> <children> <tagNode name="rule"> <properties> diff --git a/op-mode-definitions/show-babel.xml.in b/op-mode-definitions/show-babel.xml.in index 0a1f1b262..8b841eeac 100644 --- a/op-mode-definitions/show-babel.xml.in +++ b/op-mode-definitions/show-babel.xml.in @@ -13,12 +13,6 @@ </properties> <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> </leafNode> - <leafNode name="neighbor"> - <properties> - <help>Show Babel neighbor information</help> - </properties> - <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> - </leafNode> <tagNode name="neighbor"> <properties> <help>Show Babel neighbor information for specified interface</help> @@ -27,6 +21,10 @@ </completionHelp> </properties> <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> + <standalone> + <help>Show Babel neighbor information</help> + <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> + </standalone> </tagNode> <leafNode name="route"> <properties> diff --git a/op-mode-definitions/show-bfd.xml.in b/op-mode-definitions/show-bfd.xml.in index 87d672e04..02863975b 100644 --- a/op-mode-definitions/show-bfd.xml.in +++ b/op-mode-definitions/show-bfd.xml.in @@ -7,11 +7,6 @@ <help>Show Bidirectional Forwarding Detection (BFD)</help> </properties> <children> - <node name="peer"> - <properties> - <help>Show all Bidirectional Forwarding Detection (BFD) peer status</help> - </properties> - </node> <tagNode name="peer"> <properties> <help>Show Bidirectional Forwarding Detection (BFD) peer status</help> diff --git a/op-mode-definitions/show-bgp.xml.in b/op-mode-definitions/show-bgp.xml.in index 8b1992432..ee232fa04 100644 --- a/op-mode-definitions/show-bgp.xml.in +++ b/op-mode-definitions/show-bgp.xml.in @@ -78,12 +78,6 @@ </node> </children> </tagNode> - <leafNode name="vrf"> - <properties> - <help>Show BGP VRF information</help> - </properties> - <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> - </leafNode> <tagNode name="vrf"> <properties> <help>Show BGP VRF related information</help> @@ -93,6 +87,10 @@ </completionHelp> </properties> <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> + <standalone> + <help>Show BGP VRF information</help> + <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> + </standalone> <children> #include <include/bgp/show-bgp-common.xml.i> #include <include/bgp/martian-next-hop.xml.i> diff --git a/op-mode-definitions/show-bridge.xml.in b/op-mode-definitions/show-bridge.xml.in index 40fadac8b..47c3d2e6e 100644 --- a/op-mode-definitions/show-bridge.xml.in +++ b/op-mode-definitions/show-bridge.xml.in @@ -43,12 +43,6 @@ </leafNode> </children> </node> - <leafNode name="bridge"> - <properties> - <help>Show bridging information</help> - </properties> - <command>${vyos_op_scripts_dir}/bridge.py show</command> - </leafNode> <tagNode name="bridge"> <properties> <help>Show bridge information for a given bridge interface</help> @@ -57,6 +51,10 @@ </completionHelp> </properties> <command>bridge -c link show | grep "master $3"</command> + <standalone> + <help>Show bridge interface information</help> + <command>${vyos_op_scripts_dir}/bridge.py show</command> + </standalone> <children> <node name="spanning-tree"> <properties> diff --git a/op-mode-definitions/show-ip-access-paths-prefix-community-lists.xml.in b/op-mode-definitions/show-ip-access-paths-prefix-community-lists.xml.in index d7222516a..7a466d8c1 100644 --- a/op-mode-definitions/show-ip-access-paths-prefix-community-lists.xml.in +++ b/op-mode-definitions/show-ip-access-paths-prefix-community-lists.xml.in @@ -7,65 +7,57 @@ <help>Show IPv4 routing information</help> </properties> <children> - <leafNode name="access-list"> - <properties> - <help>Show all IP access-lists</help> - </properties> - <command>vtysh -c "show ip access-list"</command> - </leafNode> <tagNode name="access-list"> <properties> - <help>Show all IP access-lists</help> + <help>Show IP access-list</help> <completionHelp> <path>policy access-list</path> </completionHelp> </properties> <command>vtysh -c "show ip access-list $4"</command> + <standalone> + <help>Show all IP access lists</help> + <command>vtysh -c "show ip access-list"</command> + </standalone> </tagNode> - <leafNode name="as-path-access-list"> - <properties> - <help>Show all as-path-access-lists</help> - </properties> - <command>vtysh -c "show ip as-path-access-list"</command> - </leafNode> <tagNode name="as-path-access-list"> <properties> - <help>Show all as-path-access-lists</help> + <help>Show as-path-access-list</help> <completionHelp> <path>policy as-path-list</path> </completionHelp> </properties> <command>vtysh -c "show ip as-path-access-list $4"</command> + <standalone> + <help>Show all AS path access lists</help> + <command>vtysh -c "show ip as-path-access-list"</command> + </standalone> </tagNode> - <leafNode name="community-list"> - <properties> - <help>Show IP community-lists</help> - </properties> - <command>vtysh -c "show bgp community-list"</command> - </leafNode> <tagNode name="community-list"> <properties> - <help>Show IP community-lists</help> + <help>Show BGP community-list</help> <completionHelp> <path>policy community-list</path> </completionHelp> </properties> <command>vtysh -c "show bgp community-list $4 detail"</command> + <standalone> + <help>Show all BGP community lists</help> + <command>vtysh -c "show bgp community-list"</command> + </standalone> </tagNode> - <leafNode name="extcommunity-list"> - <properties> - <help>Show extended IP community-lists</help> - </properties> - <command>vtysh -c "show bgp extcommunity-list"</command> - </leafNode> <tagNode name="extcommunity-list"> <properties> - <help>Show extended IP community-lists</help> + <help>Show extended BGP community list</help> <completionHelp> <path>policy extcommunity-list</path> </completionHelp> </properties> <command>vtysh -c "show bgp extcommunity-list $4 detail"</command> + <standalone> + <help>Show all extended BGP community lists</help> + <command>vtysh -c "show bgp extcommunity-list"</command> + </standalone> </tagNode> <leafNode name="forwarding"> <properties> @@ -73,35 +65,31 @@ </properties> <command>vtysh -c "show ip forwarding"</command> </leafNode> - <leafNode name="large-community-list"> - <properties> - <help>Show IP large-community-lists</help> - </properties> - <command>vtysh -c "show bgp large-community-list"</command> - </leafNode> <tagNode name="large-community-list"> <properties> - <help>Show IP large-community-lists</help> + <help>Show BGP large-community-list</help> <completionHelp> <path>policy large-community-list</path> </completionHelp> </properties> <command>vtysh -c "show bgp large-community-list $4 detail"</command> + <standalone> + <help>Show all BGP large community lists</help> + <command>vtysh -c "show bgp large-community-list"</command> + </standalone> </tagNode> - <leafNode name="prefix-list"> - <properties> - <help>Show all IP prefix-lists</help> - </properties> - <command>vtysh -c "show ip prefix-list"</command> - </leafNode> <tagNode name="prefix-list"> <properties> - <help>Show all IP prefix-lists</help> + <help>Show IP prefix-list</help> <completionHelp> <path>policy prefix-list</path> </completionHelp> </properties> <command>vtysh -c "show ip prefix-list $4"</command> + <standalone> + <help>Show all IP prefix lists</help> + <command>vtysh -c "show ip prefix-list"</command> + </standalone> </tagNode> <leafNode name="protocol"> <properties> diff --git a/op-mode-definitions/show-ipv6-ospfv3.xml.in b/op-mode-definitions/show-ipv6-ospfv3.xml.in index e1fcf470f..b4a1c6c8a 100644 --- a/op-mode-definitions/show-ipv6-ospfv3.xml.in +++ b/op-mode-definitions/show-ipv6-ospfv3.xml.in @@ -13,12 +13,6 @@ </properties> <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> <children> - <node name="area"> - <properties> - <help>Show Shortest Path First tree information</help> - </properties> - <command>vtysh -c "show ipv6 ospf6 spf tree"</command> - </node> <tagNode name="area"> <properties> <help>Area ID (as an IPv4 notation)</help> @@ -27,6 +21,10 @@ </completionHelp> </properties> <command>vtysh -c "show ipv6 ospf6 area $5 spf tree"</command> + <standalone> + <help>Show Shortest Path First tree information</help> + <command>vtysh -c "show ipv6 ospf6 spf tree"</command> + </standalone> <children> <tagNode name="router"> <properties> @@ -47,16 +45,6 @@ #include <include/ospfv3/neighbor.xml.i> #include <include/ospfv3/redistribute.xml.i> #include <include/ospfv3/route.xml.i> - <node name="vrf"> - <properties> - <help>Specify the VRF</help> - <completionHelp> - <list>all</list> - <path>vrf name</path> - </completionHelp> - </properties> - <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> - </node> <tagNode name="vrf"> <properties> <help>VRF name</help> @@ -66,13 +54,11 @@ </completionHelp> </properties> <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> + <standalone> + <help>Show OSPFv3 information in given VRF</help> + <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command> + </standalone> <children> - <node name="area"> - <properties> - <help>Show Shortest Path First tree information</help> - </properties> - <command>vtysh -c "show ipv6 ospf6 vrf $5 spf tree"</command> - </node> <tagNode name="area"> <properties> <help>Area ID (as an IPv4 notation)</help> @@ -81,6 +67,10 @@ </completionHelp> </properties> <command>vtysh -c "show ipv6 ospf6 vrf $5 area $7 spf tree"</command> + <standalone> + <help>Show Shortest Path First tree information</help> + <command>vtysh -c "show ipv6 ospf6 vrf $5 spf tree"</command> + </standalone> <children> <tagNode name="router"> <properties> diff --git a/op-mode-definitions/show-ipv6-prefix-list.xml.in b/op-mode-definitions/show-ipv6-prefix-list.xml.in index e003ad110..9e9df5b29 100644 --- a/op-mode-definitions/show-ipv6-prefix-list.xml.in +++ b/op-mode-definitions/show-ipv6-prefix-list.xml.in @@ -13,29 +13,25 @@ </properties> <command>vtysh -c "show ipv6 prefix-list"</command> <children> - <node name="detail"> - <properties> - <help>Show detail of IPv6 prefix-lists</help> - </properties> - <command>vtysh -c "show ipv6 prefix-list detail"</command> - </node> <tagNode name="detail"> <properties> <help>Show detail of specified IPv6 prefix-list</help> </properties> <command>vtysh -c "show ipv6 prefix-list detail $5"</command> + <standalone> + <help>Show details of IPv6 prefix lists</help> + <command>vtysh -c "show ipv6 prefix-list detail"</command> + </standalone> </tagNode> - <node name="summary"> - <properties> - <help>Show summary of IPv6 prefix-lists</help> - </properties> - <command>vtysh -c "show ipv6 prefix-list summary"</command> - </node> <tagNode name="summary"> <properties> <help>Show summary of specified IPv6 prefix-list</help> </properties> <command>vtysh -c "show ipv6 prefix-list summary $5"</command> + <standalone> + <help>Show summary of IPv6 prefix lists</help> + <command>vtysh -c "show ipv6 prefix-list summary"</command> + </standalone> </tagNode> </children> </node> diff --git a/op-mode-definitions/show-ipv6.xml.in b/op-mode-definitions/show-ipv6.xml.in index e10379ac2..314a686fe 100644 --- a/op-mode-definitions/show-ipv6.xml.in +++ b/op-mode-definitions/show-ipv6.xml.in @@ -7,12 +7,6 @@ <help>Show IPv6 networking information</help> </properties> <children> - <node name="access-list"> - <properties> - <help>Show all IPv6 access-lists</help> - </properties> - <command>vtysh -c "show ipv6 access-list"</command> - </node> <tagNode name="access-list"> <properties> <help>Show specified IPv6 access-list</help> @@ -21,6 +15,10 @@ </completionHelp> </properties> <command>vtysh -c "show ipv6 access-list $4"</command> + <standalone> + <help>Show all IPv6 access-lists</help> + <command>vtysh -c "show ipv6 access-list"</command> + </standalone> </tagNode> <node name="forwarding"> <properties> diff --git a/op-mode-definitions/show-route-map.xml.in b/op-mode-definitions/show-route-map.xml.in index 633b2a4cb..a34ae0200 100644 --- a/op-mode-definitions/show-route-map.xml.in +++ b/op-mode-definitions/show-route-map.xml.in @@ -2,12 +2,6 @@ <interfaceDefinition> <node name="show"> <children> - <node name="route-map"> - <properties> - <help>Show route-map information</help> - </properties> - <command>vtysh -c "show route-map"</command> - </node> <tagNode name="route-map"> <properties> <help>Show specified route-map information</help> @@ -16,6 +10,10 @@ </completionHelp> </properties> <command>vtysh -c "show route-map $3"</command> + <standalone> + <help>Show route map information</help> + <command>vtysh -c "show route-map"</command> + </standalone> </tagNode> </children> </node> diff --git a/op-mode-definitions/show-users.xml.in b/op-mode-definitions/show-users.xml.in index a026e47e7..a9cde3138 100644 --- a/op-mode-definitions/show-users.xml.in +++ b/op-mode-definitions/show-users.xml.in @@ -8,12 +8,6 @@ </properties> <command>who -H</command> <children> - <node name="recent"> - <properties> - <help>Show 10 recently logged in users</help> - </properties> - <command>last -aF -n 10 | sed -e 's/^wtmp begins/Displaying logins since/'</command> - </node> <tagNode name="recent"> <properties> <help>Show specified number of recently logged in users</help> @@ -22,6 +16,10 @@ </completionHelp> </properties> <command>last -aF -n $4 | sed -e 's/^wtmp begins/Displaying logins since/'</command> + <standalone> + <help>Show 10 recently logged in users</help> + <command>last -aF -n 10 | sed -e 's/^wtmp begins/Displaying logins since/'</command> + </standalone> </tagNode> </children> </node> diff --git a/op-mode-definitions/system-image.xml.in b/op-mode-definitions/system-image.xml.in index acd634286..a6634fc65 100644 --- a/op-mode-definitions/system-image.xml.in +++ b/op-mode-definitions/system-image.xml.in @@ -86,20 +86,18 @@ <help>Set system image parameters</help> </properties> <children> - <node name="default-boot"> - <properties> - <help>Set default image to boot.</help> - </properties> - <command>${vyos_op_scripts_dir}/image_manager.py --action set</command> - </node> <tagNode name="default-boot"> <properties> - <help>Set default image to boot.</help> + <help>Set default image to boot</help> <completionHelp> <script>${vyos_op_scripts_dir}/image_manager.py --action list</script> </completionHelp> </properties> <command>${vyos_op_scripts_dir}/image_manager.py --action set --image-name "${5}"</command> + <standalone> + <help>Set default image to boot</help> + <command>${vyos_op_scripts_dir}/image_manager.py --action set</command> + </standalone> </tagNode> </children> </node> @@ -130,12 +128,6 @@ <help>Delete system objects</help> </properties> <children> - <node name="image"> - <properties> - <help>Remove an installed image from the system</help> - </properties> - <command>${vyos_op_scripts_dir}/image_manager.py --action delete</command> - </node> <tagNode name="image"> <properties> <help>Remove an installed image from the system</help> @@ -144,6 +136,10 @@ </completionHelp> </properties> <command>${vyos_op_scripts_dir}/image_manager.py --action delete --image-name "${4}"</command> + <standalone> + <help>Remove an installed image from the system</help> + <command>${vyos_op_scripts_dir}/image_manager.py --action delete</command> + </standalone> </tagNode> </children> </node> diff --git a/schema/op-mode-definition.rnc b/schema/op-mode-definition.rnc index ad41700b9..46430daa4 100644 --- a/schema/op-mode-definition.rnc +++ b/schema/op-mode-definition.rnc @@ -1,6 +1,6 @@ # interface_definition.rnc: VyConf reference tree XML grammar # -# Copyright (C) 2014. 2017 VyOS maintainers and contributors <maintainers@vyos.net> +# Copyright (C) 2014-2025 VyOS maintainers and contributors <maintainers@vyos.net> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -37,13 +37,27 @@ node = element node } # Tag nodes are containers for nodes without predefined names, like network interfaces -# or user names (e.g. "interfaces ethernet eth0" or "user jrandomhacker") -# Tag nodes may contain node and leafNode elements, and also nameConstraint tags -# They must not contain other tag nodes +# or user names (e.g. "show interfaces ethernet ethX"). +# Operational mode tag nodes can be parents to other tag nodes, +# like in "ping <host> count <packets>". +# +# Some commands can be called either with or without arguments, +# like "show interfaces ethernet eth0" (show info for eth0 only) +# or "show interfaces ethernet" (show info about all ethernet interfaces). +# That case is handled using the <standalone> element tagNode = element tagNode { nodeNameAttr, - (properties? & children? & command?) + (properties? & standalone? & children? & command?) +} + +# The <standalone> element is only used inside tag nodes +# to define their behavior when they are called without arguments +# It can provide a help string and a command. +# Everything else is handled in the <tagNode> itself. +standalone = element standalone +{ + help & command } # Leaf nodes are terminal configuration nodes that can't have children, diff --git a/schema/op-mode-definition.rng b/schema/op-mode-definition.rng index a255aeb73..bfd5cb50a 100644 --- a/schema/op-mode-definition.rng +++ b/schema/op-mode-definition.rng @@ -3,7 +3,7 @@ <!-- interface_definition.rnc: VyConf reference tree XML grammar - Copyright (C) 2014. 2017 VyOS maintainers and contributors <maintainers@vyos.net> + Copyright (C) 2014-2025 VyOS maintainers and contributors <maintainers@vyos.net> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -59,9 +59,14 @@ </define> <!-- Tag nodes are containers for nodes without predefined names, like network interfaces - or user names (e.g. "interfaces ethernet eth0" or "user jrandomhacker") - Tag nodes may contain node and leafNode elements, and also nameConstraint tags - They must not contain other tag nodes + or user names (e.g. "show interfaces ethernet ethX"). + Operational mode tag nodes can be parents to other tag nodes, + like in "ping <host> count <packets>". + + Some commands can be called either with or without arguments, + like "show interfaces ethernet eth0" (show info for eth0 only) + or "show interfaces ethernet" (show info about all ethernet interfaces). + That case is handled using the <standalone> element --> <define name="tagNode"> <element name="tagNode"> @@ -71,6 +76,9 @@ <ref name="properties"/> </optional> <optional> + <ref name="standalone"/> + </optional> + <optional> <ref name="children"/> </optional> <optional> @@ -80,6 +88,20 @@ </element> </define> <!-- + The <standalone> element is only used inside tag nodes + to define their behavior when they are called without arguments + It can provide a help string and a command. + Everything else is handled in the <tagNode> itself. + --> + <define name="standalone"> + <element name="standalone"> + <interleave> + <ref name="help"/> + <ref name="command"/> + </interleave> + </element> + </define> + <!-- Leaf nodes are terminal configuration nodes that can't have children, but can have values. --> @@ -139,10 +161,11 @@ <!-- completionHelp tags contain information about allowed values of a node that is used for generating tab completion in the CLI frontend and drop-down lists in GUI frontends - It is only meaninful for leaf nodes + It is only meaningful for leaf nodes Allowed values can be given as a fixed list of values (e.g. <list>foo bar baz</list>), as a configuration path (e.g. <path>interfaces ethernet</path>), - or as a path to a script file that generates the list (e.g. <script>/usr/lib/foo/list-things</script> + as a path to a script file that generates the list (e.g. <script>/usr/lib/foo/list-things</script>, + or to enable built-in image path completion (<imagePath/>). --> <define name="completionHelp"> <element name="completionHelp"> diff --git a/scripts/build-command-op-templates b/scripts/build-command-op-templates index 0bb62113e..9eef25a2f 100755 --- a/scripts/build-command-op-templates +++ b/scripts/build-command-op-templates @@ -124,6 +124,26 @@ def get_properties(p): return props +def get_standalone(s): + standalone = {} + + if s is None: + return {} + + # Get the help string + try: + standalone["help"] = s.find("help").text + except: + standalone["help"] = "No help available" + + # Get the command -- it's required by the schema + try: + standalone["command"] = s.find("command") + except: + raise AssertionError("Found a <standalone> node without <command>") + + return standalone + def make_node_def(props, command): # XXX: replace with a template processor if it grows @@ -150,6 +170,7 @@ def process_node(n, tmpl_dir): my_tmpl_dir = copy.copy(tmpl_dir) props_elem = n.find("properties") + standalone_elem = n.find("standalone") children = n.find("children") command = n.find("command") name = n.get("name") @@ -163,6 +184,7 @@ def process_node(n, tmpl_dir): os.makedirs(make_path(my_tmpl_dir), exist_ok=True) props = get_properties(props_elem) + standalone = get_standalone(standalone_elem) nodedef_path = os.path.join(make_path(my_tmpl_dir), "node.def") if node_type == "node": @@ -189,7 +211,10 @@ def process_node(n, tmpl_dir): # does not exist at all. if not os.path.exists(nodedef_path) or os.path.getsize(nodedef_path) == 0: with open(nodedef_path, "w") as f: - f.write('help: {0}\n'.format(props['help'])) + if standalone: + f.write(make_node_def(standalone, standalone["command"])) + else: + f.write('help: {0}\n'.format(props['help'])) # Create the inner node.tag part my_tmpl_dir.append("node.tag") |
