Forum Discussion

Avesh_Malik_178's avatar
Avesh_Malik_178
Icon for Nimbostratus rankNimbostratus
Jul 06, 2015

Testing of an irule before implementation.

Hi,

 

I am looking for your help on below issue:-

 

Is there any way to check and test the functioning of irule before applying the same in Virtual server or data group in production. For example:- if we have an iRule which needs to be applied and is logical and if some logic does not work.

 

7 Replies

  • Perhaps the fastest way of doing that is to use an extra IF condition

    if {[IP::client_addr] == "yo.ur.test.ip"}{ your-irule-logic }

    For a more complicated implementation where there are many testers accessing from various IP addresses, I use a secret HTTP path which inserts a special testing cookie. This will relieve from the burden of managing the "Allowed Testers IP addresses".

    • Avesh_Malik_178's avatar
      Avesh_Malik_178
      Icon for Nimbostratus rankNimbostratus
      thanks alot this will help.. but i have not used secret HTTP path.. It would be good if you can help on this..
  • Perhaps the fastest way of doing that is to use an extra IF condition

    if {[IP::client_addr] == "yo.ur.test.ip"}{ your-irule-logic }

    For a more complicated implementation where there are many testers accessing from various IP addresses, I use a secret HTTP path which inserts a special testing cookie. This will relieve from the burden of managing the "Allowed Testers IP addresses".

    • Avesh_Malik_178's avatar
      Avesh_Malik_178
      Icon for Nimbostratus rankNimbostratus
      thanks alot this will help.. but i have not used secret HTTP path.. It would be good if you can help on this..
  • If you want to test new features on a VS with a specific IP address, you can duplicate production VS and add source address condition on VS.

    You can create multiple VS with the same destination port and address is source VLAN or source IP condition is different.

    On the new VS, enable your iRule.

    to duplicate virtual server configuration, execute in tmsh:

    list ltm virtual 
    

    Edit the following line and replace source address: (don't forget to change VS name)

    source 0.0.0.0/0
    

    To load the configuration, execute in tmsh (and paste the VS configuration):

    load sys config from-terminal merge
    

    Confirm load configuration with CTRL-D

  • If I may add, you actually have a few really good options:

     

    1. You can create a duplicate VIP (perhaps on an internal address) and test your iRules there.

       

    2. You can test your iRules on another BIG-IP. This is a popular use case for the $98 VE lab version.

       

    3. You can wrap all of your iRules in a catch clause to make sure they don't break your active application.

       

    4. If you just need to test TCL logic (ie. without iRules events or protocol commands), you can use tclsh on the command line.