[RADIATOR] Parsing nested Diameter grouped AVP-s

Arthur Konovalov kasjas at hot.ee
Fri Dec 19 06:18:26 CST 2014


Hi,

Just trying to implement Diameter PostDiaToRadiusConversionHook with 
Radiator 4.14 and stuck with one problem.
I have the following part of messages structure from server (taken from 
seagull traffic emulator configuration):

<avp name="Media-Statistics">
     <avp name="Media-Interface-Statistics">
         <avp name="User-Side" value="0"></avp>
         <avp name="Media-Interface-Flow-Statistics">
             <avp name="Media-Component-Number" value="2"></avp>
             <avp name="Packets-Discarded-Filtering" value="102"></avp>
             <avp name="Octets-Discarded-Filtering" value="102"></avp>
         </avp>
         <avp name="Media-Interface-Flow-Statistics">
             <avp name="Media-Component-Number" value="1"></avp>
             <avp name="Packets-Discarded-Filtering" value="101"></avp>
             <avp name="Octets-Discarded-Filtering" value="101"></avp>
         </avp>
     </avp>
     <avp name="Media-Interface-Statistics">
         <avp name="User-Side" value="1"></avp>
         <avp name="Media-Interface-Flow-Statistics">
             <avp name="Media-Component-Number" value="2"></avp>
             <avp name="Packets-Discarded-Filtering" value="112"></avp>
             <avp name="Octets-Discarded-Filtering" value="112"></avp>
         </avp>
         <avp name="Media-Interface-Flow-Statistics">
             <avp name="Media-Component-Number" value="1"></avp>
             <avp name="Packets-Discarded-Filtering" value="111"></avp>
             <avp name="Octets-Discarded-Filtering" value="111"></avp>
         </avp>
     </avp>
</avp>

Dictionary:
VENDORATTR    193  Media-Statistics                1084 Grouped
VENDORATTR    193  Media-Interface-Statistics      1085 Grouped
VENDORATTR    193  Media-Interface-Flow-Statistics 1086 Grouped
VENDORATTR    193  User-Side                       1100 Unsigned32
VENDORATTR    193  Packets-Discarded-Filtering     1087 Unsigned64
VENDORATTR    193  Octets-Discarded-Filtering      1088 Unsigned64
VENDORATTR    10415 Media-Component-Number         518 Unsigned32

And hook's code  like that:
# Media-Statistics (grouped)
if (my $medstat = $d->get_attr(1084, 193)) {
   # Media-Interface-Statistics:
   if (my @medintstat = $medstat->get_attrs(1085, 193)) {
     foreach my $medintstat (@medintstat) {
       my $us = $medintstat->get_attr(1100, 193); #User-Side: 0-called 
side, 1-calling side
       if (my @medintflowstat = $medintstat->get_attr(1086, 193)) {
         foreach my $medintflowstat (@medintflowstat) {     
#Media-Interface-Flow-Statistics
           my $mp = $medintflowstat->get_attr(518, 10415);     
#Media-Component-Number
$r->add_attr("Packets-Discarded-Filtering-U".$us."-M".$mp, 
$medintflowstat->get_attr(1087, 193));
$r->add_attr("Octets-Discarded-Filtering-U".$us."-M".$mp, 
$medintflowstat->get_attr(1088, 193));
         }
       }
     }
   }
}

My scope is to have set of AVP-s in output, separated by user-side and 
media-component numbers, like:
Octets-Discarded-Filtering-U0-M2 for user-side=0, 
media-component-number=2, and so on...

My problem is that hook doesn't parse second "Media-Flow-Statistics" AVP 
group and I have in output ony these:
Octets-Discarded-Filtering-U0-M2 = 102
Packets-Discarded-Policing-U0-M2 = 102
Packets-Discarded-Filtering-U1-M2 = 112
Octets-Discarded-Filtering-U1-M2 = 112

Is there any idea how to achieve me goal? Is it by bad coding or 
something else?
I can provide Wireshark capture file as well if needed (both - live and 
emulated, they looks similar).


br,
Arthur


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open.com.au/pipermail/radiator/attachments/20141219/fdc24f84/attachment.html 


More information about the radiator mailing list