net.java.slee.resource.diameter.base.events.avp.AvpUtilities.performPreAddOperations does not supports arrays

27 views
Skip to first unread message

yulian_o

unread,
May 1, 2011, 5:59:15 PM5/1/11
to mobicents-public
Hello
I have following avps in gq' :
<avpdefn name="Media-Component-Description" code="517" vendor-
id="TGPP" mandatory="must" protected="may" may-encrypt="yes" vendor-
bit="must" >
<grouped>
<avp name="Media-Component-Number"
multiplicity="1" />
<avp name="Media-Sub-Component"
multiplicity="0+" />
<avp name="AF-Application-Identifier"
multiplicity="0-1" />
<avp name="Media-Type" multiplicity="1" />
<avp name="Max-Requested-Bandwidth-UL"
multiplicity="0-1" />
<avp name="Max-Requested-Bandwidth-DL"
multiplicity="0-1" />
<avp name="Flow-Status" multiplicity="1" />
<avp name="RS-Bandwidth" multiplicity="0-1" />
<avp name="RR-Bandwidth" multiplicity="0-1" />
<avp name="Reservation-Class"
multiplicity="0-1" />
<avp name="Reservation-Priority"
multiplicity="0-1" />
<avp name="Transport-Class"
multiplicity="0-1" />
<avp name="Codec-Data" multiplicity="0-2" />
<avp name="Media-Authorization-Context-Id"
multiplicity="0+" />
</grouped>
</avpdefn>

<avpdefn name="Media-Sub-Component" code="519" vendor-
id="TGPP" mandatory="must" protected="may" may-encrypt="yes" vendor-
bit="must" >
<grouped>
<avp name="Flow-Number" multiplicity="1" />
<avp name="Flow-Description"
multiplicity="0-2" />
<avp name="Flow-Status" multiplicity="0-1" />
<avp name="Flow-Usage" multiplicity="0-1" />
<avp name="Max-Requested-Bandwidth-UL"
multiplicity="0-1" />
<avp name="Max-Requested-Bandwidth-DL"
multiplicity="0-1" />
</grouped>
</avpdefn>

Media-Sub-Component , Codec-Data , Media-Authorization-Context-Id and
Flow-Description are arrays ( allows more then one avp per parent
avp ).
Codec-Data and Media-Authorization-Context-Id are OctetString , Flow-
Description is IPFilterRule and Media-Sub-Component is Grouped AVP.

Media-Sub-Component and Media-Component-Description are implemented by
me.Both extends GroupedAvpImpl.

I have following functions to add Flow-Description to Media-Sub-
Component :

public void setFlowDescriptions(IPFilterRule[] flowDescriptions)
{
for(IPFilterRule flowDescription:flowDescriptions){
setFlowDescription(flowDescription);
}
}

public void setFlowDescription(IPFilterRule flowDescription)
{
addAvp(DiameterGqAvpCodes.TGPP_FLOW_DESCRIPTION,DiameterGqAvpCodes.TGPP_VENDOR_ID,
flowDescription.getRuleString());
}

GroupedAvpImpl have 4 functions to add avp.
One of them accepts DiameterAVP as parameters ,
others accepts different parameters but in the end of all gets to
AvpUtilities.addAvp(Message msg, int avpCode, long vendorId, AvpSet
set, Object avp)
this functions calls setAvpAs.... ( depending on avp type.
setAvpAs... functions calls performPreAddOperations
If this function receives DiameterMessage in params in validates the
data based on dictionary ( this is not my case ).
In case it does not receives DiameterMessage( this is our case ) it
checks if it can remove avp's with same avpCode and vendorID , if yes
it removes them otherwise it throws Exception.

So if i want to add 3 avps with same AVPID and VendorID for parent
GroupedAVP , first is added , then first is removed and second is
added , and then second is removed and third is added .Only last AVP
added stays.

Bottom line performPreAddOperations should validate the data based on
dictionary for AVP's also , since there is a chance that its
GroupedAVP that will allow multiplicity for its child AVP's.

Best regards
Yulian Oifa

yulian_o

unread,
May 2, 2011, 7:48:09 AM5/2/11
to mobicents-public
Hello to all
I have resolved the diameter Gq' problems with subAVP arrays.
To do so i modified the code in the following way :

1) For simple data types i used AVPUtilities.createAVP , and then
added AVP to parent group AVP
public void setFlowDescription(IPFilterRule flowDescription)
{

addAvp(AvpUtilities.createAvp(DiameterGqAvpCodes.TGPP_FLOW_DESCRIPTION,DiameterGqAvpCodes.TGPP_VENDOR_ID,
flowDescription.getRuleString()));
//
addAvp(DiameterGqAvpCodes.TGPP_FLOW_DESCRIPTION,DiameterGqAvpCodes.TGPP_VENDOR_ID,
flowDescription.getRuleString());
}

2) In case subAVP is groupedAVP i simply added it to parent group AVP
public void setMediaSubComponent(MediaSubComponent mediaSubComponent)
{
//addAvp(DiameterGqAvpCodes.TGPP_MEDIA_SUB_COMPONENT,
DiameterGqAvpCodes.TGPP_VENDOR_ID,
mediaSubComponent.byteArrayValue());
addAvp(mediaSubComponent);
}

So for Gq' it works properly.
The problem is that i based my original code on other Diameter RA's
and therefore in case of arrays there will be a problem in other
Diameter Legs RA.
For Example ImsInformationImpl in Diameter RO RA have
ApplicationServerInformation array as sub AVPS ( several other sub
avps array also ) , and uses

public void
setApplicationServerInformation( ApplicationServerInformation
applicationServerInformation )
{
addAvp(DiameterRoAvpCodes.APPLICATION_SERVER_INFORMATION,
DiameterRoAvpCodes.TGPP_VENDOR_ID,
applicationServerInformation.byteArrayValue());
}

to add subavp,which will lead to described problem.
I have opened new issue : http://code.google.com/p/mobicents/issues/detail?id=2546

Best regards
Yulian Oifa

Tomek

unread,
May 2, 2011, 9:04:44 AM5/2/11
to mobicents-public
Based on what I saw performPreAddOperations always removes the
previous instances of the AVP.
Did you try to use setExtensionAVPs method instead ? For me sometimes
it worked.

Regards
Tomasz
Reply all
Reply to author
Forward
0 new messages