|
From: Craig G. (opennms) <cg...@op...> - 2012-08-08 09:35:57
|
Hi Bernd,
Sorry we have all been on leave. It would be best for your team to look
at the wsdl generated from the RAM and MPAC models to find a number of
different examples but to simply answer your question here are two
examples;
1. attribute multiplicity is very similar to the MTOSI example and is
handled in the following way.
Ratehr than just have an anonomous array of elements, we tend to define
and reference named 'ArrayOfXXX' elements which are xsd:sequences with
minOccurs="0" maxOccurs="unbounded". the ArrayOfXXX can then be
referenced in several places which allows us to define iterator
responses using the same sequence. This is illustrated in the RAM model
'getResourceAlarms' operation which has an out argument of
ResourceAlarm[0..*] in the model
It is is rendered to look like this; (Because we have also asked for an
iterator, the result is slightly more complicated but the basic
multiplicity is defined throughout by ArrayOfResourceAlarm )
<xsd:complexType name="ResourceAlarmResultWithIterator">
<xsd:sequence>
<xsd:element name="result" type="tns:ArrayOfResourceAlarm"/>
<xsd:element name="iterator" type="iterator:IteratorInfo"/>
</xsd:sequence>
</xsd:complexType>
The way we handle the * is by referencing an 'ArrayOfResourceAlarm'
which is defined as
<xsd:complexType name="ArrayOfResourceAlarm">
<xsd:sequence>
<xsd:element name="item" type="tns:ResourceAlarm"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
2. How does JOSIF convert an Enumeration data type in the IA into XML?
If we take the org.tmforum.tip.resource.trouble.alarm.AlarmAckState
enumeration as an example. In the model this is defined as a string
enumeration with a number of values. The string can only take one of the
values defined in the enumeration.
In the xsd we get
<xsd:simpleType name="AlarmAckState">
<xsd:annotation>
<xsd:documentation>
<p>It defines the various alarm states that can be returned
using a get operation.</p>
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ALL_ALARMS">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value "ALL_ALARMS"</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ALL_ACTIVE_ALARMS">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value "ALL_ACTIVE_ALARMS"</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ALL_ACTIVE_AND_ACKNOWLEDGED_ALARMS">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value
"ALL_ACTIVE_AND_ACKNOWLEDGED_ALARMS"</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ALL_ACTIVE_AND_UNACKNOWLEDGED_ALARMS">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value
"ALL_ACTIVE_AND_UNACKNOWLEDGED_ALARMS"</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ALL_CLEARED_AND_UNACKNOWLEDGED_ALARMS">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value
"ALL_CLEARED_AND_UNACKNOWLEDGED_ALARMS"</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="ALL_UNACKNOWLEDGED_ALARMS">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value
"ALL_UNACKNOWLEDGED_ALARMS"</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
For integer enumerations, such as AlarmAckStatus in MPAC, we use the
same principle. AlarmAckStatus is defined as having values
int CLEARED = 0;
int PENDING = 5;
int WARNING = 6;
int INDETERMINATE = 2;
int MINOR = 4;
int MAJOR = 3;
int CRITICAL = 1;
However we actually use strings to represent the integers rather than
xsd:int values in the definition. (Actually we need to improve this sxd
generation by listing the value represented by the int in the
documentation).
<xsd:simpleType name="AlarmStatus">
<xsd:annotation>
<xsd:documentation>
<p/>
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="0">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 0</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="5">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 5</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="6">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 6</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="2">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 2</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="4">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 4</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="3">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 3</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="1">
<xsd:annotation>
<xsd:documentation>
<p/>
<p>This literal has value 1</p>
</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
Hope this helps
Craig
On 06/08/2012 08:52, B.Z...@te... wrote:
> Hallo Pierre, Craig,
> At the last MMUG meeting on Friday (3rd) we got to two questions
> regarding how JOSIF maps IA definitions into XSDs.
>
> 1. Attribute multiplicity "*"
> How does JOSIF convert the "*" multiplicity of an attribute in the
> IA into XML?
> Note: In MTOSI (where the XML is created "by hand") we define an
> intermediate complex type using a sequence; see following example:
> <!-- ============== -->
> <xsd:complexType name="LayeredSNPPListType">
> <xsd:annotation>
> <xsd:documentation>
> <p> The List of layered SNPPs. It is a list of the SNPPs
> at all layers. A given layerRate value can appear only once in
> this list.</p>
> </xsd:documentation>
> </xsd:annotation>
> <xsd:sequence>
> <xsd:element name="layeredSNPPType"
> type="tns:LayeredSNPPType" minOccurs="0" maxOccurs="unbounded"/>
> </xsd:sequence>
> </xsd:complexType>
> <!-- ============== -->
> 2. Enumerations
> How does JOSIF convert an Enumeration data type in the IA into XML?
> Excerpt from the minutes of the MMUG call:
> "In cases where ENUM is used in the IA and string in the IIS, it
> may be better (for backward compatibility reasons) to use a string
> in the IA also. We should check this point with the SII team.
> Bernd thought that this would make the IA weaker. Action Item:
> Bernd to check with someone on the SII team."
>
> Thank you for your help.
> Regards
> Bernd
>
> Deutsche Telekom AG
> Group Technology
> *Bernd Zeuner*
> Heinrich-Hertz-Str. 3-7, 64295 Darmstadt, Germany
> +49 6151 58-12086 (Phone)
> +49 391 580 222 588 (Fax)
> E-Mail: b.z...@te... <mailto:b.z...@te...>
> _www.telekom.com_ <http://www.telekom.com/>
>
> Life is for sharing.
>
> Deutsche Telekom AG
> Supervisory Board: Prof. Dr. Ulrich Lehner (Chairman)
> Board of Management: René Obermann (Chairman),
> Dr. Manfred Balz, Reinhard Clemens, Niek Jan van Damme,
> Timotheus Höttges, Claudia Nemat, Prof. Dr. Marion Schick
> Commercial register: Amtsgericht Bonn HRB 6794
> Registered office: Bonn
>
> *Big changes start small --conserve resources by not printing every
> e-mail.*
>
|