Subject: [NGO] Schema for SMI data types

From: Andy Bierman <[email-masked]>
Date: Wed, 06 Dec 2006 09:53:05 -0800

Hi,

I'm posting this schema for comment, and to hopefully
converge on the proper way to represent these data types in XML.
(Schema for inetAddress to follow.)

(The WEB site indicated in the targetLocation is not yet available,
so XSD validation tools will complain they can't find an imported schema.)

This is compiled from smidump -xsd, 
draft-romascanu-netconf-datatypes-01.txt,
and some I made up from various RFCs.

The point is agree on the XML encoding sooner than later,
so the impact on implementations is lower.

Andy

<xs:schema xmlns="http://netconfcentral.org/ncx/ncx"
 targetNamespace="http://netconfcentral.org/ncx/ncx"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.netconfcentral.org/xsd/ncx/smi.xsd"
 elementFormDefault="qualified" attributeFormDefault="unqualified" xml:lang="en"
 version="0.4"
 xmlns:ncx="http://netconfcentral.org/ncx/1.0"
 xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
 <xs:annotation>
  <xs:documentation>
    Converted from NCX module by ncxdump v0.1

    Module: smi
    Owner: ncx
    Application: ncx
    Version: 0.4
    Copyright (C) Andy Bierman (2006).  All Rights Reserved.
    Contact Info: Translated by Andy Bierman.
       Send comments to [email-masked].

    Description:
      SMIv2 data types converted from the following sources: 

        * RFC 2578: Structure of Management Information Version 2 (SMIv2)
          
        * RFC 2579: Textual Conventions for SMIv2

        * RFC 2856: High Capacity Data Types

        * draft-romascanu-netconf-datatypes-01.txt

        * libsmi output from 'smidump -f xsd' command
          http://www.ibr.cs.tu-bs.de/projects/libsmi/ 

    Revision History:

      Revision: 0.4
      Change BITS from list to ustring

      Revision: 0.3
      Try to align to smidump and draft-romascanu.

      Revision: 0.2
      Refine OID and other tabular data types.

      Revision: 0.1
      Initial version.

  </xs:documentation>
 </xs:annotation>

 <xs:import namespace="http://www.w3.org/XML/1998/namespace"
  schemaLocation="http://www.w3.org/2001/xml.xsd"/>

 <xs:simpleType name="INTEGER">
  <xs:annotation>
   <xs:documentation>
    INTEGER from RFC 2578, page 8 and sec. 7.1.1.
         An enumerated integer is simply the 'enum' data type
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:int"/>
 </xs:simpleType>

 <xs:simpleType name="OctetString">
  <xs:annotation>
   <xs:documentation>
    OCTET STRING from RFC 2578, page 8.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:hexBinary">
   <xs:maxLength value="65535"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="ObjectIdentifier">
  <xs:annotation>
   <xs:documentation>
    OBJECT IDENTIFIER from RFC 2578, page 8.,
                   libsmi v0.4.5 output.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:pattern value="[0-2](\.(0|([1-9]([0-9]*))))*"/>
   <xs:minLength value="2"/>
   <xs:maxLength value="128"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="Integer32">
  <xs:annotation>
   <xs:documentation>
    Integer32 from RFC 2578, sec. 7.1.1
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:int"/>
 </xs:simpleType>

 <xs:simpleType name="IpAddress">
  <xs:annotation>
   <xs:documentation>IpAddress from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:hexBinary">
   <xs:minLength value="8"/>
   <xs:maxLength value="8"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="Counter32">
  <xs:annotation>
   <xs:documentation>Counter32 from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt"/>
 </xs:simpleType>

 <xs:simpleType name="Gauge32">
  <xs:annotation>
   <xs:documentation>Gauge32 from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt"/>
 </xs:simpleType>

 <xs:simpleType name="Unsigned32">
  <xs:annotation>
   <xs:documentation>Unsigned32 from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt"/>
 </xs:simpleType>

 <xs:simpleType name="TimeTicks">
  <xs:annotation>
   <xs:documentation>TimeTicks from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt"/>
 </xs:simpleType>

 <xs:simpleType name="Opaque">
  <xs:annotation>
   <xs:documentation>Opaque from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:hexBinary"/>
 </xs:simpleType>

 <xs:simpleType name="Counter64">
  <xs:annotation>
   <xs:documentation>Counter64 from RFC 2578, page 8.</xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedLong"/>
 </xs:simpleType>

 <xs:simpleType name="Unsigned64">
  <xs:annotation>
   <xs:documentation>
    Unsigned64 TC (missing) from RFC 2856.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedLong"/>
 </xs:simpleType>

 <xs:simpleType name="CounterBasedGauge64">
  <xs:annotation>
   <xs:documentation>
    CounterBasedGauge64 TC from RFC 2856, pages 5 -6.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedLong"/>
 </xs:simpleType>

 <xs:simpleType name="ZeroBasedCounter64">
  <xs:annotation>
   <xs:documentation>
    ZeroBasedCounter64 TC from RFC 2856, page 6.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedLong"/>
 </xs:simpleType>

 <xs:simpleType name="BITS">
  <xs:annotation>
   <xs:documentation>
    BITS from RFC 2579, page 3.
         Bit definition in the hexBinary string are in network 
         byte order.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:hexBinary">
   <xs:maxLength value="65535"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="DisplayString">
  <xs:annotation>
   <xs:documentation>
    DisplayString TC from RFC 2579, page 3.,
                   smidump v0.4.5;

        Represents textual information taken from the NVT ASCII
        character set, as defined in pages 4, 10-11 of RFC 854.

        To summarize RFC 854, the NVT ASCII repertoire specifies:

          - the use of character codes 0-127 (decimal)

          - the graphics characters (32-126) are interpreted as
            US ASCII

          - NUL, LF, CR, BEL, BS, HT, VT and FF have the special
            meanings specified in RFC 854

          - the other 25 codes have no standard interpretation

          - the sequence 'CR LF' means newline

          - the sequence 'CR NUL' means carriage-return

          - an 'LF' not preceded by a 'CR' means moving to the
            same column on the next line.

          - the sequence 'CR x' for any x other than LF or NUL is
            illegal.  (Note that this also means that a string may
            end with either 'CR LF' or 'CR NUL', but not with CR.)

        Any object defined using this syntax may not exceed 255
        characters in length.
   </xs:documentation>
   <xs:appinfo>
    <ncx:displayHint>255a</ncx:displayHint>
   </xs:appinfo>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:pattern value="((((\p{IsBasicLatin})){0,255})){0,1}"/>
   <xs:maxLength value="255"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="PhysAddress">
  <xs:annotation>
   <xs:documentation>
    PhysAddress TC from RFC 2579, page 4.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:pattern value="(((([0-9A-Fa-f]{2}):)*([0-9A-Fa-f]{2}))){0,1}"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="MacAddress">
  <xs:annotation>
   <xs:documentation>
    IEE 802 MAC Address String. from smidump v0.4.5,

        Represents an 802 MAC address represented in the
        `canonical' order defined by IEEE 802.1a, i.e., as if it
        were transmitted least significant bit first, even though
        802.5 (in contrast to other 802.x protocols) requires MAC
        addresses to be transmitted most significant bit first.
   </xs:documentation>
   <xs:appinfo>
    <ncx:displayHint>1x:</ncx:displayHint>
   </xs:appinfo>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:pattern value="(((([0-9A-Fa-f]{2}):){5,5})([0-9A-Fa-f]{2}))"/>
   <xs:minLength value="17"/>
   <xs:maxLength value="17"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="TruthValue">
  <xs:annotation>
   <xs:documentation>
    TruthValue TC from RFC 2579, page 5.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:enumeration value="true"/>
   <xs:enumeration value="false"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="TestAndIncr">
  <xs:annotation>
   <xs:documentation>
    TestAndIncr TC from RFC 2579, page 5.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt">
   <xs:maxInclusive value="2147483647"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="AutonomousType">
  <xs:annotation>
   <xs:documentation>
    AutonomousType TC from RFC 2579, page 5.
   </xs:documentation>
  </xs:annotation>
  <xs:simpleContent>
   <xs:extension base="ObjectIdentifier"/>
  </xs:simpleContent>
 </xs:complexType>

 <xs:complexType name="InstancePointer">
  <xs:annotation>
   <xs:documentation>
    A pointer to either a specific instance of a MIB object or
         a conceptual row of a MIB table in the managed device.  In
         the latter case, by convention, it is the name of the
         particular instance of the first accessible columnar object
         in the conceptual row.

         The two uses of this textual convention are replaced by
         VariablePointer and RowPointer, respectively.
   </xs:documentation>
   <xs:appinfo>
    <ncx:status>deprecated</ncx:status>
   </xs:appinfo>
  </xs:annotation>
  <xs:simpleContent>
   <xs:extension base="ObjectIdentifier"/>
  </xs:simpleContent>
 </xs:complexType>

 <xs:complexType name="VariablePointer">
  <xs:annotation>
   <xs:documentation>
    VariablePointer TC from RFC 2579, page 6. smidump v0.4.5,

         A pointer to a specific object instance.  For example,
         sysContact.0 or ifInOctets.3.
   </xs:documentation>
  </xs:annotation>
  <xs:simpleContent>
   <xs:extension base="ObjectIdentifier"/>
  </xs:simpleContent>
 </xs:complexType>

 <xs:simpleType name="RowPointer">
  <xs:annotation>
   <xs:documentation>
    RowPointer TC from RFC 2579, page 6.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:hexBinary"/>
 </xs:simpleType>

 <xs:simpleType name="RowStatus">
  <xs:annotation>
   <xs:documentation>
    RowStatus TC from RFC 2579, pages 6 - 17.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:enumeration value="active"/>
   <xs:enumeration value="notInService"/>
   <xs:enumeration value="notReady"/>
   <xs:enumeration value="createAndGo"/>
   <xs:enumeration value="createAndWait"/>
   <xs:enumeration value="destroy"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="TimeStamp">
  <xs:annotation>
   <xs:documentation>
    TimeStamp TC from RFC 2579, pages 17 - 18.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt">
   <xs:maxInclusive value="2147483647"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="TimeInterval">
  <xs:annotation>
   <xs:documentation>
    TimeInterval TC from RFC 2579, page 18.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:unsignedInt">
   <xs:maxInclusive value="2147483647"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="DateAndTime">
  <xs:annotation>
   <xs:documentation>
    DateAndTime TC from RFC 2579, pages 18 - 19.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:minLength value="8"/>
   <xs:maxLength value="28"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="StorageType">
  <xs:annotation>
   <xs:documentation>
    StorageType TC from RFC 2579, page 19.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:string">
   <xs:enumeration value="other"/>
   <xs:enumeration value="volatile"/>
   <xs:enumeration value="nonVolatile"/>
   <xs:enumeration value="permanent"/>
   <xs:enumeration value="readOnly"/>
  </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="TDomain">
  <xs:annotation>
   <xs:documentation>TDomain TC from RFC 2579, page 20.</xs:documentation>
  </xs:annotation>
  <xs:simpleContent>
   <xs:extension base="ObjectIdentifier"/>
  </xs:simpleContent>
 </xs:complexType>

 <xs:simpleType name="TAddress">
  <xs:annotation>
   <xs:documentation>
    TAddress TC from RFC 2579, page 20.
   </xs:documentation>
  </xs:annotation>
  <xs:restriction base="xs:hexBinary">
   <xs:minLength value="1"/>
   <xs:maxLength value="255"/>
  </xs:restriction>
 </xs:simpleType>
</xs:schema>
_______________________________________________
NGO mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/ngo

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 07 Dec 2006 21:06:29 +0100 (CET)

Hi,

It's not obvious from the schema (it can't really be expressed...) how
enumerations and BITS are encoded.

We use the encoding chosen by smidump, i.e. an enumeration is encoded
as the corresponding label as a string, and BITS as a xs:list of the
bit-labels.

Actually, it seems you suggest BITS are encoded as a hexBinary?

Why is RowPointer a hexBinary?  Shouldn't it be ObjectIdentifier?

We translate DateAndTime into xs:DateTime.

We also use a hexList instead of hexBinary, where a hexList is
e.g. 10:FB:4A:44 just to make it easier to read.

/martin

---

From: Andy Bierman <[email-masked]>
Date: Thu, 07 Dec 2006 13:31:32 -0800

> as the corresponding label as a string, and BITS as a xs:list of the

okay -- that seems more user-friendly than bit strings

> Why is RowPointer a hexBinary?  Shouldn't it be ObjectIdentifier?

yes

> e.g. 10:FB:4A:44 just to make it easier to read.

hexBinary is part of XSD though
Is hexList a data type in XSD?

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 07 Dec 2006 22:35:58 +0100 (CET)

> hexBinary is part of XSD though

Yes I know,

> Is hexList a data type in XSD?

No.  It's not a big deal, but when we started to view data from real
agents we found that hexBinary was difficult to read... 

/martin