summaryrefslogtreecommitdiff
path: root/templates/interfaces/virtual-ethernet
diff options
context:
space:
mode:
Diffstat (limited to 'templates/interfaces/virtual-ethernet')
-rw-r--r--templates/interfaces/virtual-ethernet/link/node.def5
-rw-r--r--templates/interfaces/virtual-ethernet/node.def12
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/address/node.def13
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/description/node.def4
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/disable-link-detect/node.def3
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/disable/node.def16
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/link/node.def5
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/mac/node.def6
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/vif/node.def20
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/address/node.def12
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/description/node.def4
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable-link-detect/node.def3
-rw-r--r--templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable/node.def11
13 files changed, 114 insertions, 0 deletions
diff --git a/templates/interfaces/virtual-ethernet/link/node.def b/templates/interfaces/virtual-ethernet/link/node.def
new file mode 100644
index 00000000..844cb8d8
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/link/node.def
@@ -0,0 +1,5 @@
+type: txt
+syntax:expression: exec \
+ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=ethernet"
+allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet
+help: Specify the lower link device
diff --git a/templates/interfaces/virtual-ethernet/node.def b/templates/interfaces/virtual-ethernet/node.def
new file mode 100644
index 00000000..a6118c8a
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.def
@@ -0,0 +1,12 @@
+tag:
+type: txt
+help: Set Virtual Ethernet device
+syntax:expression: pattern $VAR(@) "^veth[0-9]+$" \
+ ; "name must be (veth0-veth999)"
+commit:expression: $VAR(link) != ""
+ ; "link device must be set for virtual ethernet $VAR(@)"
+create: sudo ip link add $VAR(@) link $VAR(link/@) type macvlan || exit 1
+ sudo ip link set $VAR(@) up
+ /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on
+delete: sudo ip link del link $VAR(@) link $VAR(link/@)
+comp_help: Enter virtual ethernet interface name (veth0 - veth999)
diff --git a/templates/interfaces/virtual-ethernet/node.tag/address/node.def b/templates/interfaces/virtual-ethernet/node.tag/address/node.def
new file mode 100644
index 00000000..15ac444d
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/address/node.def
@@ -0,0 +1,13 @@
+multi:
+type: txt
+help: Set an IP address for this interface
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $VAR(@) --dev $VAR(../@)" \
+ ; "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../@)"
+update:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../@)
+delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../@)
+allowed: echo "dhcp <>"
+comp_help:Possible completions:
+ <x.x.x.x/x> Set the IP address and prefix length
+ <h:h:h:h:h:h:h:h/x> Set the IPv6 address and prefix length
+ dhcp Set the IP address and prefix length via DHCP
+
diff --git a/templates/interfaces/virtual-ethernet/node.tag/description/node.def b/templates/interfaces/virtual-ethernet/node.tag/description/node.def
new file mode 100644
index 00000000..d7becd13
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/description/node.def
@@ -0,0 +1,4 @@
+type: txt
+help: Set description for this interface
+update: sudo sh -c "echo $VAR(@) >/sys/class/net/$VAR(../@)/ifalias"
+delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../@)/ifalias"
diff --git a/templates/interfaces/virtual-ethernet/node.tag/disable-link-detect/node.def b/templates/interfaces/virtual-ethernet/node.tag/disable-link-detect/node.def
new file mode 100644
index 00000000..83858ec1
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/disable-link-detect/node.def
@@ -0,0 +1,3 @@
+help: Set to ignore link state changes on this interface
+update:/opt/vyatta/sbin/vyatta-link-detect $VAR(../@) on
+delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../@) off
diff --git a/templates/interfaces/virtual-ethernet/node.tag/disable/node.def b/templates/interfaces/virtual-ethernet/node.tag/disable/node.def
new file mode 100644
index 00000000..3d3ffef9
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/disable/node.def
@@ -0,0 +1,16 @@
+help: Set interface disabled
+create: vif=`/opt/vyatta/sbin/vyatta-interfaces.pl --vif=$VAR(../@) --show=all`
+ if [ ! -z "$vif" ]; then
+ echo "Can not disable interface " $VAR(../@) " with vif:" $vif
+ exit 1
+ fi
+ /etc/netplug/linkdown.d/dhclient $VAR(../@)
+ if ! sudo ip link set $VAR(../@) down 2>/dev/null; then
+ echo "Error disabling dev $VAR(../@)"
+ /etc/netplug/linkup.d/dhclient $VAR(../@)
+ exit 1
+ fi
+delete: if ! sudo ip link set $VAR(../@) up; then
+ echo "Error enabling dev $VAR(../@)"
+ exit 1
+ fi
diff --git a/templates/interfaces/virtual-ethernet/node.tag/link/node.def b/templates/interfaces/virtual-ethernet/node.tag/link/node.def
new file mode 100644
index 00000000..f16b0ec4
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/link/node.def
@@ -0,0 +1,5 @@
+type: txt
+commit:expression: exec \
+ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=ethernet"
+allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet
+help: Specify the lower link device
diff --git a/templates/interfaces/virtual-ethernet/node.tag/mac/node.def b/templates/interfaces/virtual-ethernet/node.tag/mac/node.def
new file mode 100644
index 00000000..e1202aca
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/mac/node.def
@@ -0,0 +1,6 @@
+type: macaddr
+help: Set the Media Access Control (MAC) address of this interface
+syntax:expression: exec "\
+ /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --valid-mac $VAR(@)"
+update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(@)
+
diff --git a/templates/interfaces/virtual-ethernet/node.tag/vif/node.def b/templates/interfaces/virtual-ethernet/node.tag/vif/node.def
new file mode 100644
index 00000000..bca63071
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/vif/node.def
@@ -0,0 +1,20 @@
+tag:
+type: u32
+help: Set Virtual Local Area Network (VLAN) ID
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4094; "VLAN ID must be between 0 and 4094"
+create: read flags < /sys/class/net/$VAR(../@)/flags
+ if [ $(( flags & 1 )) -eq 0 ]
+ then
+ echo "Can not create VLAN on disabled interface: " $VAR(../@)
+ exit 1
+ fi
+ sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@) || exit 1
+ sudo ip link set "$VAR(../@).$VAR(@)" up
+ /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
+delete: sudo ip link delete dev "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
+comp_help: possible completions:
+ <0-4094> Set VLAN ID
+
+
+
+
diff --git a/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/address/node.def b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/address/node.def
new file mode 100644
index 00000000..4c93905f
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/address/node.def
@@ -0,0 +1,12 @@
+multi:
+type: txt
+help: Set an IP address for this interface
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr $VAR(@) --dev $VAR(../../@).$VAR(../@) "\
+ ; "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../../@).$VAR(../@)"
+create:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-update $VAR(@) --dev $VAR(../../@).$VAR(../@)
+delete:sudo /opt/vyatta/sbin/vyatta-interfaces.pl --eth-addr-delete $VAR(@) --dev $VAR(../../@).$VAR(../@)
+allowed: echo "dhcp <>"
+comp_help:Possible completions:
+ <x.x.x.x/x> Set the IP address and prefix length
+ <h:h:h:h:h:h:h:h/x> Set the IPv6 address and prefix length
+ dhcp Set the IP address and prefix length via DHCP
diff --git a/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/description/node.def b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/description/node.def
new file mode 100644
index 00000000..40f04bcc
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/description/node.def
@@ -0,0 +1,4 @@
+type: txt
+help: Set description for this interface
+update: sudo sh -c "echo $VAR(@) >/sys/class/net/$VAR(../../@).$VAR(../@)/ifalias"
+delete: sudo sh -c "echo '' >/sys/class/net/$VAR(../../@).$VAR(../@)/ifalias"
diff --git a/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable-link-detect/node.def
new file mode 100644
index 00000000..897113de
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable-link-detect/node.def
@@ -0,0 +1,3 @@
+help: Set to ignore link state changes on this interface
+update:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../@).$VAR(../@) on
+delete:/opt/vyatta/sbin/vyatta-link-detect $VAR(../../@).$VAR(../@) off
diff --git a/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable/node.def
new file mode 100644
index 00000000..78b24870
--- /dev/null
+++ b/templates/interfaces/virtual-ethernet/node.tag/vif/node.tag/disable/node.def
@@ -0,0 +1,11 @@
+help: Set interface disabled
+update: /etc/netplug/linkdown.d/dhclient $VAR(../../@).$VAR(../@)
+ if ! sudo ip link set $VAR(../../@).$VAR(../@) down 2>/dev/null; then
+ echo "Error disabling dev $VAR(../../@).$VAR(../@)"
+ /etc/netplug/linkup.d/dhclient $VAR(../../@).$VAR(../@)
+ exit 1
+ fi
+delete: if ! sudo ip link set $VAR(../../@).$VAR(../@) up; then
+ echo "Error enabling dev $VAR(../../@).$VAR(../@)"
+ exit 1
+ fi