summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorSaurabh Mohan <saurabh@vyatta.com>2012-05-16 16:07:30 -0700
committerSaurabh Mohan <saurabh@vyatta.com>2012-05-16 16:07:30 -0700
commita20a72ad436b8ed490b9267d27e4934a128b11f7 (patch)
treef152914fda151f31e274e7f2d50f828dce8da6e6 /templates
parent92b8cfc91358df4159f58b9808def59653d65d1b (diff)
downloadvyatta-cfg-system-a20a72ad436b8ed490b9267d27e4934a128b11f7.tar.gz
vyatta-cfg-system-a20a72ad436b8ed490b9267d27e4934a128b11f7.zip
Vti tunnel config support.
Diffstat (limited to 'templates')
-rw-r--r--templates/interfaces/vti/node.def19
-rw-r--r--templates/interfaces/vti/node.tag/address/node.def16
-rw-r--r--templates/interfaces/vti/node.tag/description/node.def15
-rw-r--r--templates/interfaces/vti/node.tag/disable/node.def10
-rw-r--r--templates/interfaces/vti/node.tag/mtu/node.def14
5 files changed, 74 insertions, 0 deletions
diff --git a/templates/interfaces/vti/node.def b/templates/interfaces/vti/node.def
new file mode 100644
index 00000000..0d9c422d
--- /dev/null
+++ b/templates/interfaces/vti/node.def
@@ -0,0 +1,19 @@
+tag:
+priority: 381
+type: txt
+help: Virtual Tunnel interface
+val_help: <vtiN>; Virtual Tunnel interface name
+syntax:expression: pattern $VAR(@) "^vti[0-9]+$" \
+ ; "vti must be (vti-vti999)"
+
+delete:
+ if [ -d /sys/class/net/$VAR(@) ] ; then
+ ip link set $VAR(@) down
+ ip tunnel del $VAR(@) mode esp
+ fi
+
+end:
+if [ "${COMMIT_ACTION}" == DELETE ]; then
+ /opt/vyatta/sbin/vyatta-tunnel-cleanup $VAR(@)
+fi
+
diff --git a/templates/interfaces/vti/node.tag/address/node.def b/templates/interfaces/vti/node.tag/address/node.def
new file mode 100644
index 00000000..66874711
--- /dev/null
+++ b/templates/interfaces/vti/node.tag/address/node.def
@@ -0,0 +1,16 @@
+multi:
+type: ipv4net
+val_help: ipv4net; IPv4 address and prefix length
+help: IP address
+
+syntax:expression: exec "/opt/vyatta/sbin/valid_address $VAR(@)"
+
+create:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ sudo /opt/vyatta/sbin/vyatta-address add $VAR(../@) $VAR(@)
+ fi
+
+delete:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ sudo /opt/vyatta/sbin/vyatta-address delete $VAR(../@) $VAR(@)
+ fi
diff --git a/templates/interfaces/vti/node.tag/description/node.def b/templates/interfaces/vti/node.tag/description/node.def
new file mode 100644
index 00000000..66ca37af
--- /dev/null
+++ b/templates/interfaces/vti/node.tag/description/node.def
@@ -0,0 +1,15 @@
+type: txt
+help: Description
+
+syntax:expression: pattern $VAR(@) "^.{1,256}$" \
+ ; "interface description is too long (limit 256 characters)"
+
+update:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ sudo sh -c "echo \"$VAR(@)\" >/sys/class/net/$VAR(../@)/ifalias"
+ fi
+
+delete:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ sudo sh -c "echo '' >/sys/class/net/$VAR(../@)/ifalias"
+ fi
diff --git a/templates/interfaces/vti/node.tag/disable/node.def b/templates/interfaces/vti/node.tag/disable/node.def
new file mode 100644
index 00000000..47600765
--- /dev/null
+++ b/templates/interfaces/vti/node.tag/disable/node.def
@@ -0,0 +1,10 @@
+help: Disable interface
+update:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ ip link set $VAR(../@) down
+ fi
+
+delete:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ ip link set $VAR(../@) up
+ fi
diff --git a/templates/interfaces/vti/node.tag/mtu/node.def b/templates/interfaces/vti/node.tag/mtu/node.def
new file mode 100644
index 00000000..3a3ef8f1
--- /dev/null
+++ b/templates/interfaces/vti/node.tag/mtu/node.def
@@ -0,0 +1,14 @@
+type: u32
+priority: 382
+help: Maximum Transmission Unit (MTU)
+syntax:expression: $VAR(@) >= 64 && $VAR(@) <= 8024; "Must be between 64-8024"
+val_help: u32:64-8024; Maximum Transmission Unit (MTU)
+
+update:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ ip link set $VAR(../@) mtu $VAR(@)
+ fi
+delete:
+ if [ -d /sys/class/net/$VAR(../@) ] ; then
+ ip link set $VAR(../@) mtu 1500
+ fi