summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-18 16:27:04 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-12-18 16:27:04 -0800
commit893cca45601d35972a727fa5c71eb481f9df9b3b (patch)
tree7b4ba0fc88684cf5fb657dbb3666568529f636e6 /templates
parent5792e5ffc5683493f04dc5f5f13c583b855cffcf (diff)
parent3862673db6fa8b7b6c0eff2e15bda167b84c7af1 (diff)
downloadvyatta-op-893cca45601d35972a727fa5c71eb481f9df9b3b.tar.gz
vyatta-op-893cca45601d35972a727fa5c71eb481f9df9b3b.zip
Merge branch 'kenwood' of suva.vyatta.com:/git/vyatta-op into kenwood
Diffstat (limited to 'templates')
-rw-r--r--templates/clear/interfaces/connection/node.def1
-rw-r--r--templates/clear/interfaces/connection/node.tag/node.def53
-rw-r--r--templates/clear/interfaces/node.def1
-rw-r--r--templates/connect/interface/node.def2
-rw-r--r--templates/connect/interface/node.tag/node.def28
-rw-r--r--templates/connect/node.def1
-rw-r--r--templates/disconnect/interface/node.def2
-rw-r--r--templates/disconnect/interface/node.tag/node.def34
-rw-r--r--templates/disconnect/node.def2
-rw-r--r--templates/install-image/node.def2
-rw-r--r--templates/install-image/node.tag/node.def3
-rw-r--r--templates/remove/installed-image/node.def2
-rw-r--r--templates/set/system/boot-image/node.def2
-rw-r--r--templates/set/system/node.def1
-rw-r--r--templates/show/system/installed-images/node.def2
15 files changed, 136 insertions, 0 deletions
diff --git a/templates/clear/interfaces/connection/node.def b/templates/clear/interfaces/connection/node.def
new file mode 100644
index 0000000..cf1d414
--- /dev/null
+++ b/templates/clear/interfaces/connection/node.def
@@ -0,0 +1 @@
+help: Reset datalink layer connection to peer
diff --git a/templates/clear/interfaces/connection/node.tag/node.def b/templates/clear/interfaces/connection/node.tag/node.def
new file mode 100644
index 0000000..e936cde
--- /dev/null
+++ b/templates/clear/interfaces/connection/node.tag/node.def
@@ -0,0 +1,53 @@
+help: Bring datalink layer connection down and back up
+
+allowed: local -a array ;
+ array=( /etc/ppp/peers/pppoe* /etc/ppp/peers/pppoa* /etc/ppp/peers/wan* /etc/ppp/peers/wlm* ) ;
+ echo -n ${array[@]##*/}
+
+run: (
+ IFNAME=${4}
+ LOGFILE=/var/log/vyatta/ppp_${IFNAME}.log
+ if [ ! -e /etc/ppp/peers/$IFNAME ]; then
+ echo "Invalid interface: $IFNAME"
+ builtin exit 1
+ fi
+
+ # Serial PPP interfaces are started with "pon", which
+ # lingers around as a watchdog process. Sometimes
+ # multiple "pon" scripts are running. So we need to kill
+ # all pon scripts relating to this interface before
+ # before killing the pppd process.
+ if [ "${IFNAME::3}" = "wan" ]; then
+ PON_PIDS=` ps -C pon -f | grep $IFNAME | awk '{print $2}'`
+ if [ -n "$PON_PIDS" ]; then
+ echo "Killing pon pids: $PON_PIDS"
+ for PID in $PON_PIDS ; do
+ kill -HUP $PID
+ done
+ fi
+ fi
+
+ if [ -d /sys/class/net/${IFNAME} ]; then
+ # interface is up, lets bring it down...
+ echo "Bringing interface $IFNAME down..."
+ echo "`date`: User $USER stopping PPP daemon for $IFNAME by clear command" >> $LOGFILE
+ sudo /sbin/poff $IFNAME
+ elif [ ! -z "`ps -C pppd -f | grep $IFNAME `" ]; then
+ # Connection is in the process of being established
+ echo "Stopping connection establishment for interface ${IFNAME}..."
+ echo "`date`: User $USER stopping PPP daemon for $IFNAME by clear command" >> $LOGFILE
+ sudo /sbin/poff $IFNAME
+ fi
+
+ # now PPP layer should be down
+ echo "Bringing interface $IFNAME back up..."
+ echo "`date`: User $USER starting PPP daemon for $IFNAME by clear command" >> $LOGFILE
+ if [ "${IFNAME::3}" = "wan" ]; then
+ # Serial interfaces are started with "pon"
+ (umask 0; sudo /usr/sbin/pon $IFNAME > \
+ /dev/null 2>&1 & )
+ else
+ ( umask 0; sudo /usr/sbin/pppd call $IFNAME > \
+ /tmp/${IFNAME}.log 2>&1 & )
+ fi
+)
diff --git a/templates/clear/interfaces/node.def b/templates/clear/interfaces/node.def
new file mode 100644
index 0000000..74924aa
--- /dev/null
+++ b/templates/clear/interfaces/node.def
@@ -0,0 +1 @@
+help: Clear interface information
diff --git a/templates/connect/interface/node.def b/templates/connect/interface/node.def
new file mode 100644
index 0000000..a94a721
--- /dev/null
+++ b/templates/connect/interface/node.def
@@ -0,0 +1,2 @@
+help: Bring up a connection-oriented network interface
+
diff --git a/templates/connect/interface/node.tag/node.def b/templates/connect/interface/node.tag/node.def
new file mode 100644
index 0000000..dd806e3
--- /dev/null
+++ b/templates/connect/interface/node.tag/node.def
@@ -0,0 +1,28 @@
+help: Bring up connection-oriented interface
+
+allowed: local -a array ;
+ array=( /etc/ppp/peers/pppoe* /etc/ppp/peers/pppoa* /etc/ppp/peers/wan* /etc/ppp/peers/wlm* ) ;
+ echo -n ${array[@]##*/}
+
+run:
+ IFNAME=${3}
+ LOGFILE=/var/log/vyatta/ppp_${IFNAME}.log
+ if [ ! -e /etc/ppp/peers/$IFNAME ]; then
+ echo "Invalid interface: $3"
+ elif [ -d /sys/class/net/$IFNAME ]; then
+ echo "Interface $IFNAME is already connected."
+ elif [ ! -z "`ps -C pppd -f | grep $IFNAME `" ]; then
+ echo "Interface ${IFNAME}: Connection is being established."
+ else
+ echo "Bringing interface $IFNAME up..."
+ echo "`date`: User $USER starting PPP daemon for $IFNAME by connect command" >> $LOGFILE
+ if [ "${IFNAME::3}" = "wan" ]; then
+ # Serial interfaces are started with "pon"
+ (umask 0; sudo /usr/sbin/pon $IFNAME > \
+ /dev/null 2>&1 & )
+ else
+ # PPPOE, PPPOA, WLM interfaces are started directly
+ ( umask 0; sudo /usr/sbin/pppd call $IFNAME > \
+ /tmp/${IFNAME}.log 2>&1 & )
+ fi
+ fi
diff --git a/templates/connect/node.def b/templates/connect/node.def
new file mode 100644
index 0000000..471f21f
--- /dev/null
+++ b/templates/connect/node.def
@@ -0,0 +1 @@
+help: Establish a connection
diff --git a/templates/disconnect/interface/node.def b/templates/disconnect/interface/node.def
new file mode 100644
index 0000000..c7d88e8
--- /dev/null
+++ b/templates/disconnect/interface/node.def
@@ -0,0 +1,2 @@
+help: Take down a connection-oriented network interface
+
diff --git a/templates/disconnect/interface/node.tag/node.def b/templates/disconnect/interface/node.tag/node.def
new file mode 100644
index 0000000..85233ec
--- /dev/null
+++ b/templates/disconnect/interface/node.tag/node.def
@@ -0,0 +1,34 @@
+help: Bring connection-oriented interface down
+
+allowed: local -a array ;
+ array=( /etc/ppp/peers/pppoe* /etc/ppp/peers/pppoa* /etc/ppp/peers/wan* /etc/ppp/peers/wlm* ) ;
+ echo -n ${array[@]##*/}
+
+run:
+ IFNAME=${3}
+ LOGFILE=/var/log/vyatta/ppp_${IFNAME}.log
+ if [ ! -e /etc/ppp/peers/${IFNAME} ]; then
+ echo "Invalid interface: $IFNAME"
+ elif [ -z "`ps -C pppd -f | grep $IFNAME`" ]; then
+ echo "Interface $IFNAME: Connection is already down"
+ else
+ # Serial PPP interfaces are started with "pon", which
+ # lingers around as a watchdog process. Sometimes
+ # multiple "pon" scripts are running. So we need to kill
+ # all pon scripts relating to this interface before
+ # before killing the pppd process
+ if [ "${IFNAME::3}" = "wan" ]; then
+ PON_PIDS=` ps -C pon -f | grep $IFNAME | awk '{print $2}'`
+ if [ -n "$PON_PIDS" ]; then
+ echo "killing pon pids: $PON_PIDS"
+ for PID in $PON_PIDS ; do
+ kill -HUP $PID
+ done
+ fi
+ fi
+
+ echo "Bringing interface $IFNAME down..."
+ echo "`date`: User $USER stopping PPP daemon for $IFNAME by disconnect command" >> $LOGFILE
+ sudo /sbin/poff $IFNAME
+ fi
+
diff --git a/templates/disconnect/node.def b/templates/disconnect/node.def
new file mode 100644
index 0000000..fce9a97
--- /dev/null
+++ b/templates/disconnect/node.def
@@ -0,0 +1,2 @@
+help: Take down a connection
+
diff --git a/templates/install-image/node.def b/templates/install-image/node.def
new file mode 100644
index 0000000..e229319
--- /dev/null
+++ b/templates/install-image/node.def
@@ -0,0 +1,2 @@
+help: Install new system image to hard drive
+run: sudo /opt/vyatta/sbin/install-image
diff --git a/templates/install-image/node.tag/node.def b/templates/install-image/node.tag/node.def
new file mode 100644
index 0000000..af0ecad
--- /dev/null
+++ b/templates/install-image/node.tag/node.def
@@ -0,0 +1,3 @@
+help: The new system image file to be installed
+allowed: echo -n '<ISO_image_file>'
+run: sudo /opt/vyatta/sbin/install-image "$2"
diff --git a/templates/remove/installed-image/node.def b/templates/remove/installed-image/node.def
new file mode 100644
index 0000000..1d116e2
--- /dev/null
+++ b/templates/remove/installed-image/node.def
@@ -0,0 +1,2 @@
+help: Remove an installed image from the system
+run: sudo /opt/vyatta/bin/vyatta-boot-image.pl --delete
diff --git a/templates/set/system/boot-image/node.def b/templates/set/system/boot-image/node.def
new file mode 100644
index 0000000..c5848a4
--- /dev/null
+++ b/templates/set/system/boot-image/node.def
@@ -0,0 +1,2 @@
+help: Set the system default boot image
+run: sudo /opt/vyatta/bin/vyatta-boot-image.pl --select
diff --git a/templates/set/system/node.def b/templates/set/system/node.def
new file mode 100644
index 0000000..eef577c
--- /dev/null
+++ b/templates/set/system/node.def
@@ -0,0 +1 @@
+help: Set system operational parameters
diff --git a/templates/show/system/installed-images/node.def b/templates/show/system/installed-images/node.def
new file mode 100644
index 0000000..08caab7
--- /dev/null
+++ b/templates/show/system/installed-images/node.def
@@ -0,0 +1,2 @@
+help: Show installed Vyatta images
+run: /opt/vyatta/bin/vyatta-boot-image.pl --show