diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-20 09:50:31 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-07-20 09:50:31 -0700 |
commit | 983c23fdcb8204238220a26a279d718cd6dff821 (patch) | |
tree | a0d5cb3f37a5535fbadf96dd18ae6ce65b414301 | |
parent | b5ebff1894236ae188f047db78cdcdeedf47dfe1 (diff) | |
download | vyatta-cfg-quagga-983c23fdcb8204238220a26a279d718cd6dff821.tar.gz vyatta-cfg-quagga-983c23fdcb8204238220a26a279d718cd6dff821.zip |
Use val_help: for interface name help
Use common method for formatting CLI style help when
entering interface name.
Move loopback name syntax check into CLI expression to
avoid overhead of perl here.
-rw-r--r-- | templates/interfaces/bonding/node.def | 3 | ||||
-rw-r--r-- | templates/interfaces/bridge/node.def | 3 | ||||
-rw-r--r-- | templates/interfaces/ethernet/node.def | 4 | ||||
-rw-r--r-- | templates/interfaces/input/node.def | 2 | ||||
-rw-r--r-- | templates/interfaces/loopback/node.def | 4 | ||||
-rw-r--r-- | templates/interfaces/pseudo-ethernet/node.def | 3 | ||||
-rw-r--r-- | templates/interfaces/tunnel/node.def | 2 |
7 files changed, 12 insertions, 9 deletions
diff --git a/templates/interfaces/bonding/node.def b/templates/interfaces/bonding/node.def index d541b422..211140da 100644 --- a/templates/interfaces/bonding/node.def +++ b/templates/interfaces/bonding/node.def @@ -2,9 +2,10 @@ tag: priority: 315 type: txt help: Bonding interface name -comp_help: Enter bonding interface name (bond0 - bond99) +val_help: <bondN>; Bonding interface name syntax:expression: pattern $VAR(@) "^bond[0-9]+$" \ ; "bonding must be (bond0-bond99)" + begin: if [ ! -f /sys/class/net/bonding_masters ]; then sudo modprobe bonding max_bonds=0 miimon=250 fi diff --git a/templates/interfaces/bridge/node.def b/templates/interfaces/bridge/node.def index e4638c44..9deaa0a4 100644 --- a/templates/interfaces/bridge/node.def +++ b/templates/interfaces/bridge/node.def @@ -2,8 +2,7 @@ tag: priority: 310 type: txt help: Bridge interface name -comp_help: "Enter bridge interface name (br0 - br999)" - +val_help: <brN>; Bridge interface name syntax:expression: pattern $VAR(@) "^br[0-9]+$" ; "Must be (br0 - br999)" create: /usr/sbin/brctl addbr $VAR(@) diff --git a/templates/interfaces/ethernet/node.def b/templates/interfaces/ethernet/node.def index 1b0a083f..5f196f59 100644 --- a/templates/interfaces/ethernet/node.def +++ b/templates/interfaces/ethernet/node.def @@ -2,11 +2,11 @@ tag: priority: 318 type: txt help: Ethernet interface name -comp_help: Enter Ethernet interface name (eth0 - eth999) - allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=ethernet +val_help: <ethN>; Ethernet interface name syntax:expression: pattern $VAR(@) "^eth[0-9]+$" \ ; "interface ethernet $VAR(@): not a valid name" + syntax:expression: exec \ "if [ ! -d /sys/class/net/$VAR(@) ]; then \ echo \"interface ethernet $VAR(@): does not exist\"; diff --git a/templates/interfaces/input/node.def b/templates/interfaces/input/node.def index 8aadec8a..06b00c97 100644 --- a/templates/interfaces/input/node.def +++ b/templates/interfaces/input/node.def @@ -2,7 +2,7 @@ tag: priority: 310 # before real devices that redirect type: txt help: Input functional block (IFB) interface name -comp_help: Enter input functional block interface name (ifb0 - ifb999) +val_help: <ifbN>; Input functional block interface name syntax:expression: pattern $VAR(@) "^ifb[0-9]+$" ; "name must be (ifb0-ifb999)" diff --git a/templates/interfaces/loopback/node.def b/templates/interfaces/loopback/node.def index 828f70ec..6e4e2002 100644 --- a/templates/interfaces/loopback/node.def +++ b/templates/interfaces/loopback/node.def @@ -2,7 +2,9 @@ tag: priority: 300 type: txt help: Loopback interface name -comp_help: Enter looback interface name (lo) +syntax:expression: pattern $VAR(@) "^lo$" ; "name must be lo" +val_help: lo: Loopback interface name + syntax:expression: exec \ "/opt/vyatta/sbin/vyatta-interfaces.pl --dev=$VAR(@) --check=loopback" allowed: /opt/vyatta/sbin/vyatta-interfaces.pl --show=loopback diff --git a/templates/interfaces/pseudo-ethernet/node.def b/templates/interfaces/pseudo-ethernet/node.def index b0c00a27..2d2da19f 100644 --- a/templates/interfaces/pseudo-ethernet/node.def +++ b/templates/interfaces/pseudo-ethernet/node.def @@ -2,7 +2,8 @@ tag: priority: 390 type: txt help: Pseudo Ethernet device name -comp_help: Enter Pseudo Ethernet interface name (peth0 - peth999) +val_help: <pethN>; Pseudo Ethernet interface name + syntax:expression: pattern $VAR(@) "^peth[0-9]+$" \ ; "name must be (peth0-peth999)" commit:expression: $VAR(link) != "" diff --git a/templates/interfaces/tunnel/node.def b/templates/interfaces/tunnel/node.def index c0e871a1..77f827ac 100644 --- a/templates/interfaces/tunnel/node.def +++ b/templates/interfaces/tunnel/node.def @@ -2,7 +2,7 @@ tag: priority: 380 type: txt help: Tunnel interface -comp_help: Enter tunnel interface name (tun0 - tun999) +val_help: <tunN>; Tunnel interface name syntax:expression: pattern $VAR(@) "^tun[0-9]+$" \ ; "tunnel must be (tun0-tun999)" |