Forum Discussion
NickN01_135377
Nimbostratus
Mar 13, 2015iRule Switch Help please?
Hello,
As an iRule newbie im tring to get my switch statements right instead of using "if" statements.
This is for my own learning curve, can someone point me in the right direction please and explai...
nitass
Employee
Mar 13, 2015e.g.
configuration
[root@ve11c:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when CLIENT_ACCEPTED {
switch [active_members foo] {
0 {
reject
log local0. "iRule: Reject-No active members in pool foo."
}
default {
switch [expr {([TCP::local_port] >= 636) && ([TCP::local_port] <= 7777)}] {
1 {
pool foo
log local0. "iRule: ACCEPT-Port [TCP::local_port] within range."
}
default {
reject
log local0. "iRule: ACCEPT-Port [TCP::local_port] not in range."
}
}
}
}
}
}
/var/log/ltm
[root@ve11c:Active:In Sync] config tail -f /var/log/ltm
Mar 13 18:24:08 ve11c info tmm1[15262]: Rule /Common/qux : iRule: ACCEPT-Port 123 not in range.
Mar 13 18:24:13 ve11c info tmm1[15262]: Rule /Common/qux : iRule: ACCEPT-Port 636 within range.
Mar 13 18:24:19 ve11c info tmm1[15262]: Rule /Common/qux : iRule: ACCEPT-Port 1000 within range.
Mar 13 18:24:25 ve11c info tmm1[15262]: Rule /Common/qux : iRule: ACCEPT-Port 8000 not in range.
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