Forum Discussion
rnorberg
Feb 11, 2012Nimbostratus
class match confusion...
im having an issue getting my hands around this irule:
set pooluri ""
set pooluri [class match -name $originaluri starts_with pool-list]
if {$pooluri eq ""} {
set pooluri "default"
}
set pooluri2 [class match -value pooluri equals pool-list]
set dest_pool [getfield variable_uri_2 "," 1]
im not understanding what the -name and -value differences are. is this rule saying if the $originaluri variable starts with an entry in the pool-list class, set the $pooluri variable to 'default' .. and if its not in the class list do nothing?
then im really confused on the class match -value statement. what is the difference between -name and -value? ive never used class match in this way, and help decoding this would be much appreciated!
- nitassEmployeee.g.
[root@ve1023:Active] config b class pool-list list class pool-list { { "string1" { "value1" } "string2" { "value2" } "string3" { "value3" } } } [root@ve1023:Active] config b rule myrule list rule myrule { when RULE_INIT { log local0. "\[class get pool-list\]: [class get pool-list]" log local0. "\[class match -- string2 equals pool-list\]: [class match -- string1 equals pool-list]" log local0. "\[class match -- string2 equals pool-list\]: [class match -name string2 equals pool-list]" log local0. "\[class match -- string2 equals pool-list\]: [class match -value string2 equals pool-list]" } } [root@ve1023:Active] config tail -f /var/log/ltm Feb 11 21:56:09 local/ve1023 err mcpd[3746]: 01020066:3: The requested rule (myrule) already exists in partition Common. Feb 11 21:56:10 local/tmm info tmm[4822]: Rule myrule : [class get pool-list]: {string1 value1} {string2 value2} {string3 value3} Feb 11 21:56:10 local/tmm info tmm[4822]: Rule myrule : [class match -- string2 equals pool-list]: 1 Feb 11 21:56:10 local/tmm info tmm[4822]: Rule myrule : [class match -- string2 equals pool-list]: string2 Feb 11 21:56:10 local/tmm info tmm[4822]: Rule myrule : [class match -- string2 equals pool-list]: value2
- rnorbergNimbostratusthanks! im almost there.
- nitassEmployee
...
- nitassEmployeewhat would be the result if string2 did NOT exist in the class pool-list ?0 will be returned.
- nitassEmployeee.g.
[root@ve1023:Active] config tail -f /var/log/ltm Feb 12 18:06:23 local/ve1023 err mcpd[3746]: 01020066:3: The requested rule (myrule) already exists in partition Common. Feb 12 18:06:23 local/tmm info tmm[4822]: Rule myrule : [class get pool-list]: {string1 value1} {string2 value2} {string3 value3} Feb 12 18:06:23 local/tmm info tmm[4822]: Rule myrule : [class match -- string9 equals pool-list]: 0 Feb 12 18:06:23 local/tmm info tmm[4822]: Rule myrule : [class match -name string9 equals pool-list]: Feb 12 18:06:23 local/tmm info tmm[4822]: Rule myrule : [class match -value string9 equals pool-list]:
- rnorbergNimbostratusperfect...thanks!
- hooleylistCirrostratusAs always, nice work in explaining this Nitass!
- nitassEmployeethanks Aaron!
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