Forum Discussion
Ignat_Vassilev1
Nimbostratus
Sep 01, 2010Need a help migrating iRule from v9.4.8 to v 10.2.0
Hi All
I need a help to migrate iRule from v9.4.8 to 10.2.0. Current iRule is:
when RULE_INIT {
array set ::ARRAY_100 { }
each time Data Group List is updated with new ...
Ignat_Vassilev1
Nimbostratus
Sep 08, 2010Hi Guys,
I decide to rewrite the iRule using class functionality with Array and it look like a better way to do it. Th eiRule and the data group class are bellow:
class hurl_list {
{
"1000" { "chris-pool2" }
"2000" { "chris-pool2" }
"4000" { "chris-pool1" }
"5000" { "chris-pool2" }
}
}
rule hurl-test {
when RULE_INIT {
each time Data Group List is updated with new products
this irule must be updated to load the new array
so change this timestamp below to update array in memory...
TIMESTAMP: 09/09/2010 09:00
if {[array exists ARRAY_100]}{
array unset ARRAY_100
}
for {set list 0} {$list < [class size hurl_list]} {incr list} {
log local0. "[class element -name $list hurl_list] -> [class element -value $list hurl_list]"
set index [class element -name $list hurl_list]
log local0.debug "Index = $index"
set data [class element -value $list hurl_list]
log local0.debug "Data = $data"
set ARRAY_100($index) $data
log local0.debug "\[array get ARRAY_100\]: [array get ARRAY_100]"
}
}
when HTTP_REQUEST {
log "request "
set pool $::ARRAY_100([TCP::local_port])
log "Pool selected from array: $pool"
pool $pool
}
}
The output of the login:
Sep 9 09:56:58 local/tmm info tmm[5257]: Rule hurl-test2 : 2000 -> chris-pool2
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Index = 2000
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Data = chris-pool2
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : [array get ARRAY_100]: 2000 chris-pool2
Sep 9 09:56:58 local/tmm info tmm[5257]: Rule hurl-test2 : 1000 -> chris-pool2
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Index = 1000
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Data = chris-pool2
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : [array get ARRAY_100]: 1000 chris-pool2 2000 chris-pool2
Sep 9 09:56:58 local/tmm info tmm[5257]: Rule hurl-test2 : 4000 -> chris-pool1
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Index = 4000
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Data = chris-pool1
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : [array get ARRAY_100]: 4000 chris-pool1 1000 chris-pool2 2000 chris-pool2
Sep 9 09:56:58 local/tmm info tmm[5257]: Rule hurl-test2 : 5000 -> chris-pool2
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Index = 5000
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : Data = chris-pool2
Sep 9 09:56:58 local/tmm debug tmm[5257]: Rule hurl-test2 : [array get ARRAY_100]: 4000 chris-pool1 5000 chris-pool2 1000 chris-pool2 2000 chris-pool2
Sep 9 10:01:55 local/tmm info tmm[5257]: 01220002:6: Rule hurl-test2 : request
Sep 9 10:01:55 local/tmm info tmm[5257]: 01220002:6: Rule hurl-test2 : Pool selected from array: chris-pool2
Sep 9 10:02:18 local/tmm info tmm[5257]: 01220002:6: Rule hurl-test2 : request
Sep 9 10:02:18 local/tmm info tmm[5257]: 01220002:6: Rule hurl-test2 : Pool selected from array: chris-pool1
Thanks for your reply
Ignat
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