Forum Discussion

Thomas_89706's avatar
Thomas_89706
Icon for Nimbostratus rankNimbostratus
May 08, 2007

How do I test basic iRules?

I'm new to writing iRules, but I've written a basic iRule that takes part the the URI from a http request and directs it to a pool. I'm wondering if there is a tool out there that I could use to test my iRule to make sure its behaving as expected? Please don't tell me the only way to test it is put it live.

1 Reply

  • The least intrusive method for testing would probably be to create a test virtual server. If you don't have free IP addresses, you could use an existing virtual server IP address with a new port.

     

     

    Also, you can test some rules by putting the commands in the RULE_INIT event and not associate the rule with any VIP. This event is triggered the rule is initialized (like when the rule is created or updated. This trick wouldn't work if you're trying to evaluate actual request info or test commands that are specific to another event. But it does give you a way to test things like string manipulations.

     

     

    Lastly, you can test non-F5 specific TCL commands with a TCL shell. ActiveState has a free version:

     

     

    http://www.activestate.com/Products/ActiveTcl/

     

     

    Or you can use cygwin's tclsh.exe:

     

     

    http://www.cygwin.com/mirrors.html

     

     

    Per SOL6091, F5 based their iRules language on TCL version 8.4.6.

     

     

    Aaron