Forum Discussion
irule development - fixed variables within iRule context
Hi Boneyard - we have 2 production sites and a single test site. Within the test site (on a single test F5) we run 4 test streams called fn1-fn4. Having a consistent naming standard for LTM units and for virtual servers has been very useful. I use CLIENT_ACCEPTED to set variables. I use switch statements to determine environments, which means that, technically, it's not the most efficient method, however like you, I want a single piece of code to move between environments, and I see the sacrifice of a few CPU cycles as worth it. Obviously an alternative would be to have a separate CLIENT_ACCEPTED iRule per environment....;-
when CLIENT_ACCEPTED {
Switch on the device name - this tells us whether we are in test or prod
switch -glob [info hostname] {
"xxx*" -
"yyy*" {
This is a prod site
set debug 0
set dg_name "dg_ip_classification"
}
default {
We're in test - determine testing stream
switch -glob [virtual] {
"*fn1" {
set debug 0
set dg_name "dg_ip_classification_fn1"
}
"*fn2" {
set debug 0
set dg_name "dg_ip_classification_fn2"
}
"*fn3" {
set debug 0
set dg_name "dg_ip_classification_fn3"
}
"*fn4" {
set debug 0
set dg_name "dg_ip_classification_fn4"
}
}
}
}
}
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