Matchclass matches on the whole class entry, not just the first field, so you can't use matchclass with the suggested consolidated class. For this approach to work, you will need to have 2 classes, one for matching, another for grabbing the related pool:
class UriMatch {
"nosso"
"xRV144991"
"5.2_rv950007"
"5._RV950048"
"dev_5.2"
}
class DestMap {
"nosso 66.33.14.10"
"xRV144991 66.33.14.10"
"5.2_rv950007 66.33.14.11"
"5._RV950048 66.33.14.11"
"dev_5.2 66.33.14.11"
}
Then you can use the matchclass command using the first class to condition a findclass lookup in the second.
Definitely you need to delete the the trailing * in the UriMatch class entries. That would be necessary in any case since matchclass performs a literal string match, no wildcards. The starts_with operator can be used to emulate a trailing wildcard. However, since we can just pull the first directory (looks like all but ops*) to make the match, and we need a discrete value anyway for the lookup in the 2nd class (findclass doesn't support operators, rather makes full match against the first field), I'm going to suggest using the directory name only for both so it's a bit more intutive. Class values have been modified to match, and this code extracts the dir name:
[getfield [string tolower [HTTP::uri]] "/" 2]
Resulting iRule looks like this:
when HTTP_REQUEST {
set FirstDir [getfield [string tolower [HTTP::uri]] "/" 2]
if {[matchclass $FirstDir equals $::UriMatch]}{
pool myPool member [findclass $FirstDir $::DestMap " "]
}
}
The ops* case would need to be specifically handled, along with any other exceptions to the first-directory-match algorithm.
If you vary the length of path you are matching on, you can get into a sticky wicket doing iterative matches, longest first, since you don't have the flexibility of specifying an operator & need to extract just that bit for the match. (I've done it, have the code somewhere, but it's far from optimal.) However, in this case since all of your conditions but one (/ops*) are matches of the first directory in the path, you can use getfield to extract just that first directory name.
Def agree that pool command is better than node. Along those lines, it might make sense to build a pool for each server, even though they would only have a single member, rather than specifying a specific member of one pool. That way you can add redundancy later by just adding pool members. You'd just change the class to include the poolnames instead of IP's, then change the pool command to:
pool [findclass $FirstDir $::DestMap " "]
hth
/deb
ps
Look for major improvements to the class management commands in an upcoming release. Will make all this a walk in the park, comparatively speaking...