CodeShare
Have some code. Share some code.
cancel
Showing results for 
Search instead for 
Did you mean: 
G-Rob
F5 Employee
F5 Employee

Problem this snippet solves:

You can call these via iControl REST to take advantage of adding/deleting a single VLAN from a VCMP guest without needing to send in the entire list of VLANs.


How to use this snippet:

Sample REST call:

 

curl -sk -u admin:admin -H "Content-Type: application/json" -X POST https://your-ip-address/mgmt/tm/cli/script -d '{"command":"run","utilCmdArgs":"addVlan vlan394 myvcmpguest.local"}'  


Code :

cli script /Common/addVlan {  
proc script::init {} {  
}  
  
 proc script::run {} {  
 if { $tmsh::argc != 3 } {  
 exit 123  
}  
 set zero [lindex $tmsh::argv 0]  
 set vcmpGuest [lindex $tmsh::argv 1]  
 set vlanName [lindex $tmsh::argv 2]  
 tmsh::modify vcmp guest $vcmpGuest vlans add "{ $vlanName }"  
 exit 0  
}  
  
 proc script::help {} {  
}  
 proc script::tabc {} {  
}  
}  

cli script /Common/delVlan {  
proc script::init {} {  
}  
  
 proc script::run {} {  
 if { $tmsh::argc != 3 } {  
 exit 123  
}  
 set zero  [lindex $tmsh::argv 0]  
 set vcmpGuest [lindex $tmsh::argv 1]  
 set vlanName [lindex $tmsh::argv 2]  
 tmsh::modify vcmp guest $vcmpGuest vlans delete "{ $vlanName }"  
 exit 0  
}  
 proc script::help {} {  
}  
}

Tested this on version:

12.1
Version history
Last update:
‎13-Aug-2019 06:02
Updated by:
Contributors