summaryrefslogtreecommitdiff
path: root/op-mode-definitions
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-06-13 18:12:14 +0700
committerGitHub <noreply@github.com>2018-06-13 18:12:14 +0700
commitd1d8f4b30c4aa94177a15e95d9737e0c3892c8a6 (patch)
treea4b2326648fd9c9394f3d52ec959290b4fbff4bc /op-mode-definitions
parent832e64756cec1cfa61a818d5d09a11e198fbc43f (diff)
parentcf6be68abc1d43aa56665b2b7af91615b68ae011 (diff)
downloadvyos-1x-d1d8f4b30c4aa94177a15e95d9737e0c3892c8a6.tar.gz
vyos-1x-d1d8f4b30c4aa94177a15e95d9737e0c3892c8a6.zip
Merge pull request #14 from runborg/current
T689: Converting simple op-mode commands from vyatta-op to new syntax
Diffstat (limited to 'op-mode-definitions')
-rw-r--r--op-mode-definitions/poweroff.xml40
-rw-r--r--op-mode-definitions/reboot.xml40
-rw-r--r--op-mode-definitions/show-arp.xml25
-rw-r--r--op-mode-definitions/show-bridge.xml37
-rw-r--r--op-mode-definitions/show-configuration.xml39
-rw-r--r--op-mode-definitions/show-date.xml30
-rw-r--r--op-mode-definitions/show-disk.xml24
-rw-r--r--op-mode-definitions/show-hardware.xml95
-rw-r--r--op-mode-definitions/show-raid.xml18
-rw-r--r--op-mode-definitions/show-users.xml30
10 files changed, 378 insertions, 0 deletions
diff --git a/op-mode-definitions/poweroff.xml b/op-mode-definitions/poweroff.xml
new file mode 100644
index 000000000..07cea7927
--- /dev/null
+++ b/op-mode-definitions/poweroff.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="poweroff">
+ <properties>
+ <help>Poweroff the system</help>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff</command>
+ <children>
+ <leafNode name="now">
+ <properties>
+ <help>Poweroff the system without confirmation</help>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff --now</command>
+ </leafNode>
+
+ <leafNode name="cancel">
+ <properties>
+ <help>Cancel a pending poweroff</help>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff_cancel</command>
+ </leafNode>
+
+
+ <tagNode name="at">
+ <properties>
+ <help>Poweroff at a specific time</help>
+ <completionHelp>
+ <list>HH:MM</list>
+ <list>MMDDYY</list>
+ <list>midnight</list>
+ <list>noon</list>
+ </completionHelp>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-poweroff.pl --action poweroff_at --at_time '$3'</command>
+
+ </tagNode>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/reboot.xml b/op-mode-definitions/reboot.xml
new file mode 100644
index 000000000..2c5a85d95
--- /dev/null
+++ b/op-mode-definitions/reboot.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="reboot">
+ <properties>
+ <help>Reboot the system</help>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot</command>
+ <children>
+ <leafNode name="now">
+ <properties>
+ <help>Reboot the system without confirmation</help>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot --now</command>
+ </leafNode>
+
+ <leafNode name="cancel">
+ <properties>
+ <help>Cancel a pending reboot</help>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot_cancel</command>
+ </leafNode>
+
+
+ <tagNode name="at">
+ <properties>
+ <help>Reboot at a specific time</help>
+ <completionHelp>
+ <list>HH:MM</list>
+ <list>MMDDYY</list>
+ <list>midnight</list>
+ <list>noon</list>
+ </completionHelp>
+ </properties>
+ <command>/opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action reboot_at --at_time '$3'</command>
+
+ </tagNode>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-arp.xml b/op-mode-definitions/show-arp.xml
new file mode 100644
index 000000000..92c231c6f
--- /dev/null
+++ b/op-mode-definitions/show-arp.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="arp">
+ <properties>
+ <help>Show Address Resolution Protocol (ARP) information</help>
+ </properties>
+ <command>/usr/sbin/arp -e -n</command>
+ <children>
+ <tagNode name="interface">
+ <properties>
+ <help>Show Address Resolution Protocol (ARP) cache for specified interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py -b</script>
+ </completionHelp>
+ </properties>
+ <command>/usr/sbin/arp -e -n -i '$4'</command>
+ </tagNode>
+ </children>
+ </node>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-bridge.xml b/op-mode-definitions/show-bridge.xml
new file mode 100644
index 000000000..a3241951a
--- /dev/null
+++ b/op-mode-definitions/show-bridge.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <leafNode name="bridge">
+ <properties>
+ <help>Show bridging information</help>
+ </properties>
+ <command>/sbin/brctl show</command>
+ </leafNode>
+ <tagNode name="bridge">
+ <properties>
+ <help>Show bridge information for a given bridge interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py --type bridge</script>
+ </completionHelp>
+ </properties>
+ <command>/sbin/brctl show '$3'</command>
+ <children>
+ <leafNode name="macs">
+ <properties>
+ <help>Show bridge Media Access Control (MAC) address table</help>
+ </properties>
+ <command>/sbin/brctl showmacs '$3'</command>
+ </leafNode>
+ <leafNode name="spanning-tree">
+ <properties>
+ <help>Show bridge spanning tree information</help>
+ </properties>
+ <command>/sbin/brctl showstp '$3'</command>
+ </leafNode>
+ </children>
+ </tagNode>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-configuration.xml b/op-mode-definitions/show-configuration.xml
new file mode 100644
index 000000000..0b1507ba4
--- /dev/null
+++ b/op-mode-definitions/show-configuration.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="configuration">
+ <properties>
+ <help>Show available saved configurations</help>
+ </properties>
+ <!-- no admin check -->
+ <command>cli-shell-api showCfg --show-active-only --show-hide-secrets</command>
+
+ <children>
+ <node name="all">
+ <properties>
+ <help>Show running configuration (including default values)</help>
+ </properties>
+ <!-- no admin check -->
+ <command>cli-shell-api showCfg --show-show-defaults --show-active-only --show-hide-secrets</command>
+ </node>
+ <node name="commands">
+ <properties>
+ <help> Show running configuration as set commands </help>
+ </properties>
+ <!-- no admin check -->
+ <command>cli-shell-api showCfg --show-active-only | vyos-config-to-commands</command>
+ </node>
+ <node name="files">
+ <properties>
+ <help> Show available saved configurations </help>
+ </properties>
+ <!-- no admin check -->
+ <command>${vyos_op_scripts_dir}/show-configuration-files.sh</command>
+ </node>
+ </children>
+ </node>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-date.xml b/op-mode-definitions/show-date.xml
new file mode 100644
index 000000000..dddecd2fb
--- /dev/null
+++ b/op-mode-definitions/show-date.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="date">
+ <properties>
+ <help>Show system time and date</help>
+ </properties>
+ <command>/bin/date</command>
+ <children>
+ <node name="utc">
+ <properties>
+ <help>Show system date and time as Coordinated Universal Time</help>
+ </properties>
+ <command>/bin/date -u</command>
+ <children>
+ <leafNode name="maya">
+ <properties>
+ <help>Show UTC date in Maya calendar format</help>
+ </properties>
+ <command>${vyatta_bindir}/maya-date.py $(date +%s)</command>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-disk.xml b/op-mode-definitions/show-disk.xml
new file mode 100644
index 000000000..db473959a
--- /dev/null
+++ b/op-mode-definitions/show-disk.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <tagNode name="disk">
+ <properties>
+ <help>Show status of disk device</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_disks.sh</script>
+ </completionHelp>
+ </properties>
+ <children>
+ <leafNode name="format">
+ <properties>
+ <help>Show disk drive formatting</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show-disk-format.sh $3</command>
+ </leafNode>
+ </children>
+ </tagNode>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-hardware.xml b/op-mode-definitions/show-hardware.xml
new file mode 100644
index 000000000..6cd912aea
--- /dev/null
+++ b/op-mode-definitions/show-hardware.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="hardware">
+ <properties>
+ <help>Show system hardware details</help>
+ </properties>
+ <children>
+ <node name="cpu">
+ <properties>
+ <help>Show CPU info</help>
+ </properties>
+ <command>lscpu</command>
+ <children>
+ <node name="detail">
+ <properties>
+ <help> Show system CPU details</help>
+ </properties>
+ <command>cat /proc/cpuinfo</command>
+ </node>
+ <node name="summary">
+ <properties>
+ <help>Show CPU's on system</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/cpu_summary.py</command>
+ </node>
+ </children>
+ </node>
+
+ <node name="dmi">
+ <properties>
+ <help>Show system DMI details</help>
+ </properties>
+ <command>${vyatta_bindir}/vyatta-show-dmi</command>
+ </node>
+
+ <node name="mem">
+ <properties>
+ <help>Show system RAM details</help>
+ </properties>
+ <command>cat /proc/meminfo</command>
+ </node>
+
+ <node name="pci">
+ <properties>
+ <help>Show system PCI bus details</help>
+ </properties>
+ <command>lspci</command>
+ <children>
+ <node name="detail">
+ <properties>
+ <help>Show verbose system PCI bus details</help>
+ </properties>
+ <command>lspci -vvv</command>
+ </node>
+ </children>
+ </node>
+
+
+ <node name="scsi">
+ <properties>
+ <help>Show SCSI device information</help>
+ </properties>
+ <command>lsscsi</command>
+ <children>
+ <node name="detail">
+ <properties>
+ <help>Show detailed SCSI device information</help>
+ </properties>
+ <command>lsscsi -vvv</command>
+ </node>
+ </children>
+ </node>
+
+ <node name="usb">
+ <properties>
+ <help>Show peripherals connected to the USB bus</help>
+ </properties>
+ <command>lsusb</command>
+ <children>
+ <node name="detail">
+ <properties>
+ <help>Show detailed USB bus information</help>
+ </properties>
+ <command>lsusb -v</command>
+ </node>
+ </children>
+ </node>
+
+ </children>
+ </node>
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-raid.xml b/op-mode-definitions/show-raid.xml
new file mode 100644
index 000000000..b0930742a
--- /dev/null
+++ b/op-mode-definitions/show-raid.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <tagNode name="raid">
+ <properties>
+ <help>Show statis of RAID set</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_raidset.sh</script>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_raid.sh $3</command>
+
+ </tagNode>
+
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-users.xml b/op-mode-definitions/show-users.xml
new file mode 100644
index 000000000..a026e47e7
--- /dev/null
+++ b/op-mode-definitions/show-users.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="users">
+ <properties>
+ <help>Show user information</help>
+ </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>
+ <completionHelp>
+ <list>NUMBER</list>
+ </completionHelp>
+ </properties>
+ <command>last -aF -n $4 | sed -e 's/^wtmp begins/Displaying logins since/'</command>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+ </node>
+</interfaceDefinition>