I am looking to create a relation based class, not sure if this is a function of a table in v10.
the relation is that I want a way to evaluate more than 1 criteria for a class in relation. I know I can create 2 classes and have the irule match both, but the problem I run into is that the group of users may not all match the group of commands to be matched on.
In the example below I want to match testsuser1 on commands 1 and 2, but testuser2 should only match on command2. It is not scalable to create multiple matching classes for every user as the list is dynamic and will be frequently updated via api. At times there could be 2 users or there could be 15 users. Same with commands.
class penatly_box {
“testuser1” “command1”
“testuser1” “command2”
“testuser1” “command2”
}’
Is there a function that exists to handle these relations?
I can’t get the syntax correct to work. Also I want to expand it so that URI contains both “1” and “2” or “testuser1” and “command1”, but not if it only has one of the two.
Can getfield be applied to a class, or can it only be applied to a URI?
That looks right to me and saves on a test box. When you say it’s not working, what error or issue do you see and when (saving the rule, during runtime or just not matching)?
The Irule is valid in terms of syntax but if the user is Testuser1 instead of testuser1, or the command is Command1 instead of command1 the log reports match and the pool is not hit.
datagroup entries use only lower case. It logs “no match” and does not go to the penatly box pool. I also added in additional logging.
I also added addtional logging and “Value 2” logs correctly when the URI values are lowercase. Value 2 logs nothing when the URI values use any uppercase.
Thanks again Hoolio for pointing me in the right direction. After quite a bit of logging and failures I adjusted the query slightly and seem to be getting great results.
I will update this after a bit of Q/A testing if there need to be any additional changes.
Start of changes
set testquery1 [ URI::query [string tolower [HTTP::uri]] command ]
log local0. “----------------------”
log local0. “testquery1:”
log local0. “----------------------”
log local0. “$testquery1”
log local0. “----------------------”
set testquery2 [ URI::query [string tolower [HTTP::uri]] uid ]