Expressing SNMP SMI Datatypes in XML Schema Definition Language
Extracted elements (22)
IPv6 address representation is explicitly out of scope because the SMI relies on Textual Conventions (specifically InetAddress from RFC 4001) to specify IPv6 addresses, not the IpAddress base datatype.
OctetString is mapped to hexBinary rather than xs:string because xs:string cannot faithfully represent all valid octet values (0–255) in a way that provides easy human readability. The hexBinary canonical form reliably encodes arbitrary binary data.
The BITS pseudo-type is excluded from the base datatype mapping and treated as a Textual Convention because RFC 2578 itself classifies it as a construct rather than a base datatype.
The ObjectIdentifier pattern enforces a minimum of two sub-ids and limits the first two arcs to their ASN.1/BER-defined ranges (first arc 0–2; second arc 0–39 for arcs 0 and 1), avoiding a separate minLength restriction since the pattern itself enforces minimum length.
Application developers must account for special semantics of Gauge32, Counter32, Counter64, and TimeTicks (as specified in RFC 2578) when using their values for anything beyond display, storage, or literal transmission; XSD compliance alone does not capture those semantics.
Values of MIB objects defined with Textual Convention syntax are always encoded in XML as the underlying SMI base datatype, not as the TC type. This means, for example, InetAddress-typed objects use OctetString encoding, not IpAddress.
Various independent schemes for expressing SMI datatypes in XSD existed prior to this RFC, exhibiting commonality on numeric types but significant differences on non-numeric types. This document establishes the IETF standard mapping to ensure uniform expression and general interoperability.
All SMI base datatypes MUST have a corresponding XSD datatype.
SMIv2 is the normative SMI for this document. Legacy SMIv1 modules MUST be converted (at least logically) in accordance with Section 2.1 of RFC 3584 (the Coexistence RFC) prior to mapping datatypes into XSD.
The XML output produced as a result of meeting the foregoing requirements SHOULD be the most coherent and succinct representation (avoiding superfluous decoration) from the perspective of readability by humans.
The XSD datatype for a given SMI datatype MUST include any restrictions on values associated with the SMI datatype.
The XSD datatype MUST be the most logical XSD datatype, with the fewest necessary restrictions on its set of values, consistent with the foregoing requirements.
The eleven SMIv2 ObjectSyntax base datatypes covered by this XSD mapping are: INTEGER, Integer32, Unsigned32, Gauge32, Counter32, TimeTicks, Counter64, OCTET STRING, Opaque, IpAddress, and OBJECT IDENTIFIER. The BITS construct is treated as a Textual Convention, not a base datatype.
IANA registered the SMI Base Datatypes XML namespace 'urn:ietf:params:xml:ns:smi:base:1.0' in the IETF XML registry per RFC 3688.
IANA registered the SMI Base Datatypes XML schema 'urn:ietf:params:xml:schema:smi:base:1.0' in the IETF XML registry per RFC 3688, pointing to the XSD defined in Section 4 of this document.
If proxies or gateways are developed to convey SNMP management information to XML-based applications via this XSD mapping, special care must be taken to ensure all applicable SNMP security mechanisms are supported appropriately.
The XSD/SMI datatype mapping itself does not introduce new security considerations. Security considerations for any given SMI MIB module remain relevant to its XSD/XML mapping.
INTEGER and Integer32 are mapped to xs:int; Unsigned32, Gauge32, Counter32, and TimeTicks to xs:unsignedInt; Counter64 to xs:unsignedLong. No additional restriction statements beyond the base XSD type are required.
IpAddress is mapped to xs:string with a pattern restriction enforcing a dotted-decimal string of four values between 0 and 255 separated by periods, with leading zeros precluded.
ObjectIdentifier is mapped to xs:string with a pattern restriction producing a dotted-decimal string of up to 128 sub-ids, each an Unsigned32 integer value. The minimum representation is two sub-ids (e.g., '0.0').
OctetString is mapped to xs:hexBinary with a maxLength restriction of 65535 octets. Each octet is encoded as two hexadecimal digits; canonical representation limits hex digits to 0-9 and uppercase A-F.
Opaque is mapped to xs:hexBinary with no length restriction. Like OctetString, each octet is encoded as two hexadecimal digits.