Forum Discussion
Can't use variable for vlan selection during route domain creation?
I have to create several route demain and associate 2 vlans per route domain with tmsh script.
- I try it making a for loop for my total number of route domain to create.
- I select the right partition (successfully created previously)
- I create my route-domain and want to select a vlan previously created. My vlans are incremented and their name contain a number. I want to be able to use this incrementation to select my vlans for route-domain creation. BUT, it seems to be impossible to use variable in vlan name, I have the following message error :
pipo.tcl: script failed to complete:
can't eval proc: "script::run"
"vsys$x-vlan" unexpected argument
while executing
"tmsh::create net route-domain $numrd vlans add { vsys$x-vlan }"
(procedure "script::run" line 42)
invoked from within
"script::run" line:1
script did not successfully complete, status:1
- Here is an extract of my script :
set usercount 10
set numrd 12
for {set x 1} {$x<=$usercount} {incr x} {
tmsh::modify cli admin-partitions query-partitions all update-partition fce-vsys$x
tmsh::create net route-domain $numrd vlans add { vsys$x-vlan }
incr numrd
}
}
tmsh::modify cli admin-partitions query-partitions all update-partition Common
- I tried without {}, no success. Somebody have an Idea?
Thanks!
3 Replies
- hoolio
Cirrostratus
Hi NQ,
Can you try replacing escaping the hyphen in x-vlan like this:
${x-vlan}
Aaron - Mark_Crosland_2Historic F5 AccountAnother issue is that {}'s are special characters in both tmsh and Tcl, so they must be escaped in Tcl so that Tcl doesn't swallow them.
tmsh::stateless enabled
set ip-value "10.1.1.2:80"
tmsh::create ltm pool foo members add "{ ${ip-value} }"
or
tmsh::create ltm pool foo members add \{ ${ip-value} \} - Alscion_68122
Nimbostratus
Hi Mark & hoolio,
Thanks for your help, here is the solution i use : vlans add "{ vsys${x}-vlan }"
I put all the expression between double quote and i use bracket for the variable, example for several vlan to add :
vlans add "{ vsys${x}-vlan vsys${y}-vlan }"
Have fun.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
