We use virtual calls to deal with special needs for back end connections like NTLM or Server Side SSL on our main front vips. There are quite a few different combinations that we use to deal with these back end connections, and the switch statement that we’ve been using is starting to get a bit cumbersome. I was wondering if there was a way to do a lookup and see if a virtual exists rather than having to spell them out.
when HTTP_REQUEST {
set mapping [class match -value [string toupper [HTTP::uri]] starts_with SFNETSYSPERF01]
switch $mapping {
"subvip1" -
"subvip2" -
"subvip3" -
"subvip4" {
virtual $mapping
}
"" {
virtual subvip-default
}
default {
pool $mapping
}
}
}
What I’m looking for is a way to replace the switch with a lookup. I know this isn’t correct code, but just looking to get the idea across.
if virtual $mapping exists { virtual &mapping }
Is something like that possible within an iRule?