Forum Discussion
Chris_Miller
Altostratus
Jun 11, 2010Most efficient way to do if, else?
Good morning all,
This snippet is part of an http_response event. The rule compares the IP of the server responding to datagroups to see which pool the server is in. Based on that, the rule sets a co...
hoolio
Cirrostratus
Jun 11, 2010The IP/subnet should be added to the datagroup and then set the value for that IP and/or subnet of 2A1 or whatever the strPodNumber is. Then you can use the class command to return the corresponding value:
The datagroup will look like this in the bigip.conf:
class private_net {
{
host 1.1.1.1 { "2A1" }
network 2.2.2.0/24 { "2A1" }
host 3.3.3.1 { "2A2" }
network 4.4.4.0/24 { "2A2" }
}
}
And an iRule snippet which references the class:
Look up the server address in the dg_all_pools class and save the corresponding value
set match [class search -value dg_all_pools equals [IP::server_addr]]
if {$match ne ""}{
do something with the match
}
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
