Forum Discussion
How use Datagroup in iRule ?
Hello Guys,
I need to write an iRule for extract the radius attribute 81 and check if this attribute is present on my datagroup.
For the moment i write this iRule :
when CLIENT_DATA {
log "Irule OK"
set attr81 [RADIUS::avp 81]
log "The vlan is $attr81"
if { [class match [RADIUS::avp 81] contains vlancheck] } {
log "Vlan OK"
} else {
log "Vlan not OK"
}
}
And I create a datagroup with the String vlan=IDVlan.
But my iRule don't match the string on the Datagroup.
Could you please help me ? 🙂
Thanks.
2 Replies
Hi
could you please post the output of
and the exact format of the string that should match?log "The vlan is $attr81"Cheers, Kai
Hi Anthony,
The first column of the data-group is the "search string" and the seconds column is the "return-value" of the data-group entry. The
,equals
,contains
orstarts_with
operators of theends_with
command is always comparing your[class match]
with the "search strings" of the given datagroup and then may or may not return the return-data or simply boolean 0|1 depending on the used$input
command syntax...[class]You can give it another try using the slightly polished iRule below...
when CLIENT_DATA { log "Irule OK - The vlan is [RADIUS::avp 81]" if { [class match [RADIUS::avp 81] equals vlancheck] } { log "Vlan OK" } else { log "Vlan not OK" } }... in combination with a modified data-group...
ltm data-group internal vlancheck { records { 202 { } 203 { } } type string }Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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