cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.
Gregory_Robinso
F5 Employee
F5 Employee

Problem this snippet solves:

If you want to add or delete a single VLAN from a route domain without sending in the entire list of VLANs, you can use this CLI script.


How to use this snippet:

Sample REST calls:

 


curl -sk -u admin:admin -H "Content-Type: application/json" -X POST https://your-ip-address/mgmt/tm/cli/script -d '{"command":"run","name":"modifyRouteDomainVlans","utilCmdArgs":"myroutedomainname vlan3942 add"}'  

 


curl -sk -u admin:admin -H "Content-Type: application/json" -X POST https://your-ip-address/mgmt/tm/cli/script -d '{"command":"run","name":"modifyRouteDomainVlans","utilCmdArgs":"myroutedomainname vlan3942 delete"}'  


Code :

cli script /Common/modifyRouteDomainVlans {  
proc script::run {} {  
 if { $tmsh::argc !=4 } {  
 exit 123  
 }  
 set zero [lindex $tmsh::argv 0]  
 set routeDomain [lindex $tmsh::argv 1]  
 set vlanName [lindex $tmsh::argv 2]  
 set command [lindex $tmsh::argv 3]  
 tmsh::modify /net route-domain [lindex $tmsh::argv 1] vlans [lindex $tmsh::argv 3] "{[lindex $tmsh::argv 2]}"  
 exit 0  
 }  
}

Tested this on version:

13.0
Comments
John_Alam
F5 Employee
F5 Employee

Gregory, this is a great post. It would be helpful if you include the response from the REST POST. The response should indicate the result.

 

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