Forum Discussion
kman_52500
Nimbostratus
May 16, 2012replacing defined iRules for a vip
I'm trying to update the list of iRules on a virtual but I don't want to delete then add because that leaves the virtual without any rules temporarily.
I've opened an enhancement request to add a set call that would allow you to set what rules you want and have it replace all rules with the new list, but as usually I get the response of "it's logged as a request, we have no ETA on when it will be put in" which seems to always translate into never.
Sorry for the rant, just a little frustrated.
6 Replies
Sort By
- George_Watkins_Historic F5 Accountkman,
test-ltm-01(Active)(/Common)(tmos) list /ltm virtual test-http-virtual-02.element.local ltm virtual test-http-virtual-02.element.local { destination 10.84.3.227:http ip-protocol tcp mask 255.255.255.255 pool test-ubuntu-lucid_http profiles { http { } tcp { } } rules { xml-to-http-header } snat automap vlans-disabled }
results in:test-ltm-01(Active)(/Common)(tmos) modify /ltm virtual test-http-virtual-02.element.local rules { exp_backoff vip-target-vip sqrt math }
I agree that historically it would have been nice to have a method to do this, but it isn't necessary in version 11. This behavior can be implemented with iControl transactions, which were introduced in version 11. The idea is that you start a transaction, execute iControl calls as you normally would, then submit the transaction. Action will only be taken if all the commands will execute correctly. The transaction will cause the iControl commands to be executed in parallel and should not impact your users (unless of course they were dependent on the iRules that you remove). Here is an article I wrote on transactions when we launched version 11: v11 iControl: Transactions. In the next post is a code sample written in Java provide the functionality you are requesting.test-ltm-01(Active)(/Common)(tmos) list /ltm virtual test-http-virtual-02.element.local ltm virtual test-http-virtual-02.element.local { destination 10.84.3.227:http ip-protocol tcp mask 255.255.255.255 pool test-ubuntu-lucid_http profiles { http { } tcp { } } rules { exp_backoff vip-target-vip sqrt math } snat automap vlans-disabled }
Best regards,
George
- George_Watkins_Historic F5 Account
package com.f5se.examples; import iControl.services.LocalLBVirtualServerVirtualServerRule; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import javax.xml.rpc.ServiceException; public class ReplaceRulesWith { /** * @param args */ public static void main(String[] args) { // iControl connection parameters HashMap bigipConn = new HashMap(); bigipConn.put("address", "test-ltm-ve-03.element.local"); bigipConn.put("username", "admin"); bigipConn.put("password", "admin"); // virtual server name String virtualServerName = "test-http-virtual-01.element.local"; // list of iRules on virtual server List newRuleList = new ArrayList(); newRuleList.add("exp_backoff"); newRuleList.add("math"); newRuleList.add("sqrt"); int ruleCount = newRuleList.size(); // Collect new list of rules and priorities and place in LocalLBVirtualServerVirtualServerRule type LocalLBVirtualServerVirtualServerRule[][] newRuleStruct = new LocalLBVirtualServerVirtualServerRule[1][ruleCount]; // Reverse list so that rules are added in the correct order Collections.reverse(newRuleList); int i = 0; for(String ruleName : newRuleList) { newRuleStruct[0][i] = new LocalLBVirtualServerVirtualServerRule(); newRuleStruct[0][i].setRule_name(ruleName); newRuleStruct[0][i].setPriority(i); i++; } // Configure iControl interface iControl.BigIP bigip = new iControl.BigIP(bigipConn.get("address"), bigipConn.get("username"), bigipConn.get("password")); bigip.setIgnoreInvalidCert(true); try { bigip.SystemSession().start_transaction(); bigip.LocalLBVirtualServer().remove_all_rules(new String[] { virtualServerName}); bigip.LocalLBVirtualServer().add_rule(new String[] { virtualServerName }, newRuleStruct); bigip.SystemSession().submit_transaction(); } catch (RemoteException e) { e.printStackTrace(); } catch (ServiceException e) { e.printStackTrace(); } } }
- kman_52500
Nimbostratus
web gui an tmsh don't really get me mutch here, sure it works as a one-off, but not for automated remote administration. - smp_86112
Cirrostratus
set what rules you want and have it replace all rules with the new list - kman_52500
Nimbostratus
No, like it's name indicates, it adds/appends the rules to the existing list and you can indicate a priotiry wich specifies it's position in the list. - kman_52500
Nimbostratus
moving to 11.5 and REST is the way to do this
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects