Forum Discussion
Gy Diameter irule example
- Oct 12, 2022
try something like below.
replace parent with subscription-id
replace avp1 with subscription-id-type, avp1 value would be either 0 or 1 (set to match what you are looking for)
replace avp2 with subscription-id-data
vendor-id is optional, you can remove them or set to 0
# <parentAvpName>
set count [DIAMETER::avp count <parentAvpCode> vendor-id <parentAvpVendorId>]
set index 0
set myavp ""
while { $index < $count } {
set parent [DIAMETER::avp data get <parentAvpCode> grouped vendor-id <parentAvpVendorId> index $index]
# <avp1Name>
set child [DIAMETER::avp data get <avp1Code> <avp1Format> vendor-id <avp1VendorId> source $parent]
if { $child == "<avp1ValueId>" } {
# <avp0Name>
set myavp [DIAMETER::avp data get <avp0Code> <avp0Format> vendor-id <avp0VendorId> source $parent]
break
}
incr index
}note that you can generate this from diameter wizard (or diameter iAppsLX)
try something like below.
replace parent with subscription-id
replace avp1 with subscription-id-type, avp1 value would be either 0 or 1 (set to match what you are looking for)
replace avp2 with subscription-id-data
vendor-id is optional, you can remove them or set to 0
# <parentAvpName>
set count [DIAMETER::avp count <parentAvpCode> vendor-id <parentAvpVendorId>]
set index 0
set myavp ""
while { $index < $count } {
set parent [DIAMETER::avp data get <parentAvpCode> grouped vendor-id <parentAvpVendorId> index $index]
# <avp1Name>
set child [DIAMETER::avp data get <avp1Code> <avp1Format> vendor-id <avp1VendorId> source $parent]
if { $child == "<avp1ValueId>" } {
# <avp0Name>
set myavp [DIAMETER::avp data get <avp0Code> <avp0Format> vendor-id <avp0VendorId> source $parent]
break
}
incr index
}
note that you can generate this from diameter wizard (or diameter iAppsLX)
Thanks P'Nat, it works! The index is exactly the solution.
Here is my code from your suggestion.
###P'NAT HINT####
set count [DIAMETER::avp count 443 ]
set index 0
set myavp ""
while { $index < $count } {
set parent [DIAMETER::avp data get 443 grouped index $index]
# <avp1Name>
log local0. "Inx: $index"
log local0. "Codes Parent: [DIAMETER::avp codes source $parent ]"
set child [DIAMETER::avp data get 450 integer32 source $parent]
if { $child == "1" } {
# <avp0Name>
set myavp [DIAMETER::avp data get 444 string source $parent]
log local0. "imsi: $myavp"
break
}
incr index
}
Then i got what i want already, Thanks alot for your kindly help krab.
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Inx: 0
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Codes Parent: 1400 450
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Inx: 1
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: Codes Parent: 450 444
Nov 3 00:15:03 ip-10-1-1-4 info tmm1[11849]: Rule /Common/test_gy_1 <DIAMETER_INGRESS>: imsi: 4162796100
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