Forum Discussion

Robby_Garrison_'s avatar
Robby_Garrison_
Icon for Nimbostratus rankNimbostratus
May 02, 2017

Delete VS from within iApp

Hello,

 

I am trying to create an iApp to build arbitrary UDP services in a particular way. One of the requirements is to be able to select Virtual Server type. "Standard" and "PerformanceL4" aren't causing me any issues, but "Stateless" is giving me fits. A way to remove the 'stateless' command from a Virtual Server is not included in the CLI. So I'm testing removing the Virtual, then rebuilding it back, with or without the 'stateless' command.

 

My problem is that deleting the Virtual Server from within the iApp doesn't appear to have an effect when 'iapp::conf create' is called after it. By itself (when I comment out the create section) the 'iapp::conf delete' works just fine. Blows away the Virtual Server completely. But when I have the 'iapp::conf create' section in there, if the 'stateless' command was on the Virtual Server, it comes right back, like the delete never happens.

 

I've messed around with 'tmsh::stateless', built the 'if' logic you see below to see if that would force the commands to execute differently. But no matter what, the stateless command will not go away. It almost seems that the iApp is ignoring any config that changes during iApp execution. Like perhaps it loads the relevant configuration into memory, messes with that, then commits it after everything has run.

 

There appear to be no problems with the presentation section. The $::vs_pool__vs_type is updated appropriately by the presentation section, according to the logs.

 

Below is the relevant bit of code from the implementation section. Any advice would be much appreciated.

 

 array keys $::vs_pool__vs_type        
array set vs_type_action {
    standard        {}
    stateless       { translate-port disabled stateless }
    performancel4   {}
    *               {}
}    

iapp::debug vstype $::vs_pool__vs_type

 UDP VIRTUAL

if {[iapp::conf delete ltm virtual ${app}_vs] == "${app}_vs"} {

    iapp::conf create \
        ltm virtual ${app}_vs \
        destination $destination \
        $mask_action \
        ip-protocol udp \
        [iapp::substa pool($new_pool,udp)] \
        [iapp::substa profiles($fastl4,udp)] \
        [iapp::substa vs_type_action($::vs_pool__vs_type)] \
        [iapp::substa snat($do_snat,$do_automap,$new_snatpool)] \
        [iapp::substa vlans($advanced)] \
        [iapp::substa irules($advanced,$have_rules)] \
        translate-address enabled
}
No RepliesBe the first to reply