Forum Discussion

sriramgd_111845's avatar
sriramgd_111845
Icon for Nimbostratus rankNimbostratus
May 24, 2010

query irule priority numbers used in a virtual server

I am instrumenting our irules so that they can be tested, loading them onto a virtual server (which is created explicitly for unit testing) in order to run some traffic against them as part of the test suite.

 

 

The problem is that to create a test irule, I need to set an arbitrary priority number - otherwise I get an error .

 

01070621:3: Rule priorities for virtual server (xyz) must be unique."

 

 

i.e. if I create a test iRule, I need to make sure I am not re-using a priority number. Is there is way to query all the used priority numbers, so that I can just generate a new one?

 

 

If I do something like

 

(Get-F5.iControl).LocalLBRule.query_rule((Get-F5.iControl).LocalLBRule.get_list()[0])

 

 

I can get the name and definition of the iRule, but I cannot get the priority.

 

 

I could do other things like maintain the priority numbers used in the test run state or catch the error and generate a new number till it succeeds etc., but I was wondering if there is a cleaner way.

 

 

Thanks,

 

Sriram

 

 

1 Reply

  • Unfortunately at this point the priorities are not an attribute of the iRule itself. Priorities are configured at the event level and an iRule can have multiple events. By setting the priority at the top of the iRule, that essentially sets the priority for all events contained in that iRule. In addition, you can set the priorities for each even in their "when" declaration. Since iRules are a group of events and the single iRule is what is stored at the configuration level, it's not possible to query the priority of an individual event within that iRule.

     

     

    -Joe