Forum Discussion
Multiple Switch statements in a single iRule
- Aug 11, 2016
Yes, but what you really want to do is use a Data Group. Let's say you have a Data Group that looks like this:
create ltm data-group internal dg-address-matchers type ip \ records add { 10.11.0.0/16 { data "action1" } \ 10.12.0.0/16 { data "action2" } \ 10.13.13.0/22 { data "action3" } ... }
You would then use it thusly:
when CLIENT_ACCEPTED { set indicator [class lookup [IP::client_addr] dg-address-matchers] switch [class lookup [IP::client_addr] dg-address-matchers] { action1 { ... do something ... } action2 { ... do something else ... } ... etc ... "" { this means the IP matches no netblocks in the data-group } } }
The data group format is somewhat different in v10:
but as long as the entries are declared as network, it should work.
If a Data Group is declared to be type ip then the
equals
operator will perform network-wise comparisons against IP addresses.- squeezebox_2829Aug 11, 2016Nimbostratus
I see, yes it seems to be working. When working with an external file to be used for a datagroup is there a way to program-atically trigger the BIGIP to re-read the file after a change has been made? It seems that changes to the file are not picked up until I go in via the GUI and update the data-group linked to the external file. Is there an API call I can issue to cause an updated file to be used? Thanks,
Recent Discussions
Related Content
* 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