Forum Discussion
Passing variables directly from iApps to TMSH.
- May 26, 2016
This is useful for when scripting tmsh: Documentation for tmsh scripting Commands.
Looks like tmsh create is the syntax you are looking to use here.
app::config procedure is nice as it returns the object name of the object created and handles the appropriate tmsh scripting command based on input (create/modify/delete). Although, you will need to escape brackets and a few other characters such as backslashes.
This is useful for when scripting tmsh: Documentation for tmsh scripting Commands.
Looks like tmsh create is the syntax you are looking to use here.
app::config procedure is nice as it returns the object name of the object created and handles the appropriate tmsh scripting command based on input (create/modify/delete). Although, you will need to escape brackets and a few other characters such as backslashes.
- Fred_Slater_856May 26, 2016Historic F5 Account
iapp::conf is a wrapper for tmsh::create/modify/delete that automatically logs the command in /var/tmp/scriptd.out to cut down on the need for debugging "puts" statements like the one you used. iapp::conf also prevents command duplication, which you may or may not be interested in. In order for iapp::conf to return the object name, however, it depends on the convention that the object name contains an underscore character ("_"). Since zscaler-wcf-gre-source-nonfloat-lb01-dbb-12345 contains no underscores, the proc runs but returns a null string. I do not see anything in your example that would require escaping. The use of [format] is harmless but probably unnecessary. Either of the following should work in implementation:
tmsh::create $::NONFLOAT$::GRESourceLoopback__lb-$::GRESourceLoopback__diocese-$::GRESourceLoopback__orgid$::IPADDRESS$::GRESourceLoopback__loopback/32$::TRAFFICGROUP$::VLANLOOPBACK or iapp::conf create $::NONFLOAT$::GRESourceLoopback__lb-$::GRESourceLoopback__diocese-$::GRESourceLoopback__orgid$::IPADDRESS$::GRESourceLoopback__loopback/32$::TRAFFICGROUP$::VLANLOOPBACK
- Fred_Slater_856May 26, 2016Historic F5 Account
BTW, if you want to be more explicit with the boundaries of your variable names, use curlies, like this:
tmsh::create ${::NONFLOAT}${::GRESourceLoopback__lb}-${::GRESourceLoopback__diocese}- \ ${::GRESourceLoopback__orgid}${::IPADDRESS}${::GRESourceLoopback__loopback}/32 \ ${::TRAFFICGROUP}${::VLANLOOPBACK}
- Archie_128388May 27, 2016NimbostratusExcellent. Thank you Gentlemen. I will try these suggestion and report back.
- Archie_128388May 27, 2016NimbostratusThat did the trick.... With another check of my code, I found the issue: I had used the tmsh::create before however it kept giving me errors, so moved to iapps::conf and still the same issue.... Upon review of my code, I noticed my variable $::NONFLOAT had the "create" command already set. I simply needed to remove the "create" in my variable, as the create is passed by the tmsh::create command. Obvious now I look at it! Thank you so much. I was going mad!
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