summaryrefslogtreecommitdiff
path: root/templates/interfaces/ethernet
diff options
context:
space:
mode:
Diffstat (limited to 'templates/interfaces/ethernet')
-rw-r--r--templates/interfaces/ethernet/node.def11
-rw-r--r--templates/interfaces/ethernet/node.tag/address/node.def28
-rw-r--r--templates/interfaces/ethernet/node.tag/description/node.def4
-rw-r--r--templates/interfaces/ethernet/node.tag/disable-flow-control/node.def4
-rw-r--r--templates/interfaces/ethernet/node.tag/disable-link-detect/node.def3
-rw-r--r--templates/interfaces/ethernet/node.tag/disable/node.def12
-rw-r--r--templates/interfaces/ethernet/node.tag/duplex/node.def13
-rw-r--r--templates/interfaces/ethernet/node.tag/hw-id/node.def2
-rw-r--r--templates/interfaces/ethernet/node.tag/mac/node.def8
-rw-r--r--templates/interfaces/ethernet/node.tag/mtu/node.def8
-rw-r--r--templates/interfaces/ethernet/node.tag/smp_affinity/node.def45
-rw-r--r--templates/interfaces/ethernet/node.tag/speed/node.def16
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.def18
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def27
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.tag/description/node.def4
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def3
-rw-r--r--templates/interfaces/ethernet/node.tag/vif/node.tag/disable/node.def11
17 files changed, 217 insertions, 0 deletions
diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def
new file mode 100644
index 00000000..a46ae722
--- /dev/null
+++ b/templates/interfaces/ethernet/node.def
@@ -0,0 +1,11 @@
+tag:
+priority: 318
+type: txt
+help: Set ethernet interface
+syntax:expression: exec \
+ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=ethernet"
+allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet
+create: sudo ip link set "$VAR(@)" up
+ /opt/vyatta/sbin/vyatta-link-detect $VAR(@) on
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ sudo ip link set $VAR(@) down
diff --git a/templates/interfaces/ethernet/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/address/node.def
new file mode 100644
index 00000000..db87ff05
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/address/node.def
@@ -0,0 +1,28 @@
+multi:
+
+type: txt
+
+help: Set an IP address for this interface
+
+# Syntax check at "set" time. Give curent address value to script
+# so that it can perform syntax check.
+#
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-set $VAR(@) --dev $VAR(../@)"\
+ ; "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../@)"
+
+# Syntax check at "commit" time. Pass all address values to script so that
+# it can perform consistency check.
+#
+commit:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-commit $VAR(@@) --dev $VAR(../@)"
+
+create: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/ethernet/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/description/node.def
new file mode 100644
index 00000000..7f64c788
--- /dev/null
+++ b/templates/interfaces/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/ethernet/node.tag/disable-flow-control/node.def b/templates/interfaces/ethernet/node.tag/disable-flow-control/node.def
new file mode 100644
index 00000000..10c6c066
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/disable-flow-control/node.def
@@ -0,0 +1,4 @@
+help: Set to disable Ethernet flow control (pause frames)
+create: sudo ethtool --pause $VAR(../@) autoneg off tx off rx off
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ sudo ethtool --pause $VAR(../@) autoneg on tx on rx on
diff --git a/templates/interfaces/ethernet/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/disable-link-detect/node.def
new file mode 100644
index 00000000..83858ec1
--- /dev/null
+++ b/templates/interfaces/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/ethernet/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/disable/node.def
new file mode 100644
index 00000000..fbfb155a
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/disable/node.def
@@ -0,0 +1,12 @@
+help: Set interface disabled
+create: /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: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ if ! sudo ip link set $VAR(../@) up; then
+ echo "Error enabling dev $VAR(../@)"
+ exit 1
+ fi
diff --git a/templates/interfaces/ethernet/node.tag/duplex/node.def b/templates/interfaces/ethernet/node.tag/duplex/node.def
new file mode 100644
index 00000000..9277729d
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/duplex/node.def
@@ -0,0 +1,13 @@
+type: txt
+help: Set the duplex mode for this interface
+default: "auto"
+syntax:expression: $VAR(@) in "auto", "half", "full"; "duplex must be auto, half or full"
+commit:expression: ( $VAR(@) == "auto" && $VAR(../speed/@) == "auto" ) || \
+ ( $VAR(@) != "auto" && $VAR(../speed/@) != "auto" ) ; \
+ "if duplex is hardcoded, speed must also be hardcoded"
+update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \
+ --speed-duplex $VAR(../speed/@) $VAR(@)
+comp_help:Possible completions:
+ auto\t\tAuto negotiation (default)
+ half\t\tHalf duplex
+ full\t\tFull duplex
diff --git a/templates/interfaces/ethernet/node.tag/hw-id/node.def b/templates/interfaces/ethernet/node.tag/hw-id/node.def
new file mode 100644
index 00000000..6c559f89
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/hw-id/node.def
@@ -0,0 +1,2 @@
+type: macaddr
+help: Set the Media Access Control (MAC) address of this interface
diff --git a/templates/interfaces/ethernet/node.tag/mac/node.def b/templates/interfaces/ethernet/node.tag/mac/node.def
new file mode 100644
index 00000000..55264cf7
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/mac/node.def
@@ -0,0 +1,8 @@
+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(@)
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ /opt/vyatta/sbin/vyatta-interfaces.pl --dev $VAR(../@) --set-mac $VAR(../hw-id/@)
+
diff --git a/templates/interfaces/ethernet/node.tag/mtu/node.def b/templates/interfaces/ethernet/node.tag/mtu/node.def
new file mode 100644
index 00000000..dc03ae16
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/mtu/node.def
@@ -0,0 +1,8 @@
+type: u32
+help: Set the Maximum Transmission Unit (MTU) for this interface
+syntax:expression: $VAR(@) >= 68 && $VAR(@) <= 9000; "MTU must be between 68 and 9000"
+update: if ! sudo ip link set $VAR(../@) mtu $VAR(@)
+ then echo "Error setting MTU on dev $VAR(../@)"; exit 1
+ fi
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ sudo ip link set $VAR(../@) mtu 1500
diff --git a/templates/interfaces/ethernet/node.tag/smp_affinity/node.def b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def
new file mode 100644
index 00000000..a444ae92
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/smp_affinity/node.def
@@ -0,0 +1,45 @@
+#
+#
+# Configuration template for interface.ethernet.name.smp_affinity
+#
+# Configure the CPUs that the associated interface will interrupt.
+# SMP affinity is configured by a hexidecimal bitmask that specifies the
+# CPUs that the system can interrupt. The SMP affinity bitmask must contain
+# at least one bits, and may only contain as many bits as there are CPUs on
+# the system.
+#
+
+type: txt
+
+help: Set CPU interrupt affinity mask for this interface
+
+comp_help: Possible completions:
+ XX\tHexidecimal bitmask representing CPUs that this NIC will interrupt
+ auto\tSet affinity automatically
+
+default: "auto"
+
+syntax:expression: exec " \
+ if [ $VAR(@) = auto ]; then \
+ exit 0;
+ else \
+ /opt/vyatta/sbin/vyatta-irqaffin check $VAR(../@) $VAR(@); \
+ fi"
+
+update:
+ if [ "$VAR(@)" = "auto" ]; then
+ echo "Setting SMP affinity for $VAR(../@) automatically."
+ sudo /opt/vyatta/sbin/vyatta-auto-irqaffin.pl --setup $VAR(../@)
+ else
+ sudo /opt/vyatta/sbin/vyatta-irqaffin set $VAR(../@) $VAR(@)
+ if [ $? -ne 0 ]; then
+ echo "Error setting CPU affinity mask $VAR(@) on interface $VAR(../@)"
+ exit 1
+ fi
+ fi
+
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ if ! sudo /opt/vyatta/sbin/vyatta-irqaffin reset $VAR(../@); then
+ echo "Error deleting CPU affinity mask on interface $VAR(../@)"
+ exit 1
+ fi
diff --git a/templates/interfaces/ethernet/node.tag/speed/node.def b/templates/interfaces/ethernet/node.tag/speed/node.def
new file mode 100644
index 00000000..e822df9f
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/speed/node.def
@@ -0,0 +1,16 @@
+type: txt
+help: Set the speed for this interface
+default: "auto"
+syntax:expression: $VAR(@) in "auto", "10", "100", "1000", "2500", "10000"; "Speed must be auto, 10, 100, 1000, 2500, or 10000"
+commit:expression: ( $VAR(@) == "auto" && $VAR(../duplex/@) == "auto" ) || \
+ ( $VAR(@) != "auto" && $VAR(../duplex/@) != "auto" ) ; \
+ "if speed is hardcoded, duplex must also be hardcoded"
+update: /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) \
+ --speed-duplex $VAR(@) $VAR(../duplex/@)
+comp_help:Possible completions:
+ auto\t\tAuto negotiation (default)
+ 10 \t\t10 Mbit/sec
+ 100 \t\t100 Mbit/sec
+ 1000\t\t1 Gbit/sec
+ 2500\t\t2.5 Gbit/sec
+ 10000\t10 Gbit/sec
diff --git a/templates/interfaces/ethernet/node.tag/vif/node.def b/templates/interfaces/ethernet/node.tag/vif/node.def
new file mode 100644
index 00000000..610c0e5e
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/vif/node.def
@@ -0,0 +1,18 @@
+tag:
+priority: 319
+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: if ! sudo ip link add link $VAR(../@) name "$VAR(../@).$VAR(@)" type vlan id $VAR(@)
+ then echo "Error creating VLAN device $VAR(../@).$VAR(@)"
+ exit 1
+ fi
+ if /opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(../@) --isup
+ then
+ sudo ip link set "$VAR(../@).$VAR(@)" up
+ fi
+ /opt/vyatta/sbin/vyatta-link-detect "$VAR(../@).$VAR(@)" on
+delete: [ -d /sys/class/net/$VAR(../@) ] || exit 0
+ 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/ethernet/node.tag/vif/node.tag/address/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def
new file mode 100644
index 00000000..a5edef6d
--- /dev/null
+++ b/templates/interfaces/ethernet/node.tag/vif/node.tag/address/node.def
@@ -0,0 +1,27 @@
+multi:
+
+type: txt
+
+help: Set an IP address for this interface
+
+# Syntax check at "set" time. Give curent address value to script
+# so that it can perform syntax check.
+#
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-set $VAR(@) --dev $VAR(../../@).$VAR(../@) "\
+ ; "Invalid IP address/prefix [$VAR(@)] for interface $VAR(../../@).$VAR(../@)"
+
+# Syntax check at "commit" time. Pass all address values to script so that
+# it can perform consistency check.
+#
+commit:expression: exec "/opt/vyatta/sbin/vyatta-interfaces.pl --valid-addr-commit $VAR(@@) --dev $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/ethernet/node.tag/vif/node.tag/description/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/description/node.def
new file mode 100644
index 00000000..0ef54891
--- /dev/null
+++ b/templates/interfaces/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/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/disable-link-detect/node.def
new file mode 100644
index 00000000..897113de
--- /dev/null
+++ b/templates/interfaces/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/ethernet/node.tag/vif/node.tag/disable/node.def b/templates/interfaces/ethernet/node.tag/vif/node.tag/disable/node.def
new file mode 100644
index 00000000..78b24870
--- /dev/null
+++ b/templates/interfaces/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