Subject: RE: [diameter] Re: [AAA-WG]: Re: questions and comments regarding the Diameter A PI draft

From: Cain Brian-BCAIN1 <[email-masked]>
Date: Thu, 3 May 2001 18:05:55 -0500

> -----Original Message-----
> From: Mark Jones [mailto:[email-masked]]
> 
> I wanted to exclude expressing the command format simply because I was
> struggling with how it could be expressed without using XML 
> Schema. Last
> time I looked, it was difficult to find a C++ parsing library that
> supported XML Schema.
> 
> Without using XML schema, the XML for:
> 
>       Example-Command ::= < Diameter-Header: 9999999 >
>                           { User-Name }
>                         * { Origin-FQDN }
>                         * [ AVP ]
> 
> would be:
> 
> 	<DiameterMessage name="Example-Command" code="9999999">
> 		<RequiredAVP avpName="User-Name">
> 		<RequiredAVP avpName="Origin-FQDN" occurance="Many">
> 		<ArbitraryAVP occurance="Many">
> 	</DiameterMessage>
> 
> using the following DTD:
> 
> <!ELEMENT DiameterMessage (FixedAVP | RequiredAVP | OptionalAVP |
> ArbitraryAVP)+>

How about something along these lines:

<!ELEMENT DiameterMessage  (FixedAVPs? RequiredAVPs? OptionalAVPs? ArbitraryAVPs? FixedAVPs?)>

<!ELEMENT FixedAVPs      (AVPDescription)*>
<!ELEMENT RequiredAVPs   (AVPDescription)*>
<!ELEMENT OptionalAVPs   (AVPDescription)*>
<!ELEMENT ArbitraryAVPs  (AVPOccurance)>

<!ELEMENT AVPDescription AVPOccurance?>
<!ATTLIST AVPDescription avpName IDREFS #REQUIRED>

<!ELEMENT AVPOccurance EMPTY>
<!ATTLIST AVPOccurance 
                          minimum CDATA #IMPLIED "1"
                          maximum CDATA #IMPLIED "1"

Which would make the XML look like:

  	<DiameterMessage name="Example-Command" code="9999999">
  		<RequiredAVPs>
			<AVPDescription avpName="User-Name">
	  		<AVPDescription avpName="Origin-FQDN">
				<AVPOccurance maximum="Many">
			</AVPDescription>
		</RequiredAVPs>
  		<ArbitraryAVPs>
				<AVPOccurance maximum="Many">
		</ArbitraryAVPs>
  	</DiameterMessage>

This will address a couple of concerns: first, the ability to create inconsistent attributes is removed (occurance="One" minOccurs="0" maxOccurs="0"), fixed AVPs are also possible at the end of the message, and it's impossible to create a fixed AVP that follows a required AVP but precedes an optional AVP.

I think the occurance attribute is somewhat redundant, and may only be useful as a shorthand for minOccurs and maxOccurs.  I'm not familiar enough w/DTD syntax to state with certainty that you can have the #IMPLIED part of the CDATA attributes, like I suggest, though.  But, if we can force a structure that won't allow as many internal inconsistencies, we'll probably be better off, right?  I don't like that my suggestion requires one attribute (maximum) to logically take on an integer or string value (maximum can be "3" or "Many" -- this seems bad).  The only other thing I could offer would be to have "-1" as a possibility to represent an occurance frequency without a maximum (maximum="Many").

The format "(FixedAVP | RequiredAVP | OptionalAVP | ArbitraryAVP)+" will probably match the message below:

  	<DiameterMessage name="Example-Command" code="9999999">
   	      <RequiredAVP avpName="User-Name">
  	      <ArbitraryAVP occurance="Many">
            <FixedAVP avpName="Origin-FQDN" occurance="Many">
            <RequiredAVP avpName="IMEI" occurance="Many">
  	</DiameterMessage>

, which is illegal.  FixedAVPs may occur only at the beginning or the end of a command, and RequiredAVPs must occur before ArbitraryAVPs, etc.  Plus, the ArbitraryAVP should only show up once in a command definition, or not at all.

My suggestion for the DTD does not enforce that at least one AVP is included in every command definition.  I don't know of a way to do that within the framework I've set up.

Feedback?

-Brian

---

From: "Mark Jones" <[email-masked]>
Date: Thu, 3 May 2001 21:13:59 -0400

Brian,

Great! Your proposed structure addresses the AVP ordering problem that I
was struggling with(including the FixedAVP ordering issue that Pat pointed
out earlier).

Unfortunately, I doubt we are going to be able to completely enforce the
Diameter message format without using XML Schema to provide the missing
constraints. Will a heavily commented DTD which states these constraints
be sufficient?

> This will address a couple of concerns: first, the ability to
> create inconsistent attributes is removed (occurance="One"
> minOccurs="0" maxOccurs="0"),

I don't think you have removed the ability to create inconsistent
attributes:
	+ A RequiredAVP with maximum="0"
	+ An OptionalAVP with minimum="1"
	+ minimum="10", maximum="1"
	+ minimum="many"

> I think the occurance attribute is somewhat redundant, and may
> only be useful as a shorthand for minOccurs and maxOccurs.

Correct, it is shorthand. I figured the vaste majority of attribute
definitions would not be specifying minimum or maximum occurences. I was
also trying to avoid assigning a "special" value to 'maxOccurs' for
"Many".

> I'm not familiar enough w/DTD syntax to state with certainty that you
> can have the #IMPLIED part of the CDATA attributes, like I
> suggest, though.

#IMPLIED means that no default value is provided. If you intended
'minimum' and 'maximum' to have a value of 1 if they were not specified in
the XML then you just need:
                          minimum CDATA "1"
                          maximum CDATA "1"

Regards,
       Mark