rfc-6021

Common YANG Data Types

J. Schoenwaelder (Editor)
date2010-10 streamIETF areaops wgnetmod statusPROPOSED STANDARD pages26 canonicalhttps://www.rfc-editor.org/rfc/rfc6021 doi10.17487/RFC6021
This document introduces a collection of common data types to be used with the YANG data modeling language. [STANDARDS-TRACK]

obsoleted by

Extracted elements (29)

design-rationale §4

The as-number type uses uint32 with no range restriction rather than a 16-bit type, explicitly to support BGP's four-octet AS number extension (RFC 4893) which enlarged the AS space from 16 to 32 bits. Using uint32 unconditionally avoids a future breaking change to the type.

yang, bgp

interoperability-note §3

The date-and-time type is not equivalent to the SMIv2 DateAndTime textual convention: RFC 3339 uses 'T' as the date/time separator (versus a space in SMIv2), provides higher-resolution fractional seconds, and assigns distinct semantics to -00:00 (unknown timezone).

yang, snmp

normative-requirement §3 SHOULD NOT

A default statement SHOULD NOT be used in combination with the counter32 or counter64 types, because counters have no defined initial value and a single counter value carries no information content in general.

yang, snmp

normative-requirement §3 MUST NOT

Each sub-identifier value in an object-identifier MUST NOT exceed 2^32-1 (4294967295).

yang

normative-requirement §4 MUST

Internationalized domain names used with the domain-name type MUST be encoded in punycode as described in RFC 3492.

yang, dns

normative-requirement §4 MUST

Objects using the uri type MUST be in US-ASCII encoding and MUST be normalized as described by RFC 3986 sections 6.2.1, 6.2.2.1, and 6.2.2.2, removing unnecessary percent-encoding and lowercasing case-insensitive characters (except hex digits, which are uppercased).

yang

normative-requirement §4 MUST

The description clause of schema nodes using the domain-name type MUST describe when and how domain names are resolved to IP addresses, including the resolution order and which DNS record type takes precedence.

yang, dns

normative-requirement §3 SHOULD NOT

The object-identifier type SHOULD NOT be used to represent the SMIv2 OBJECT IDENTIFIER type; the object-identifier-128 type SHOULD be used instead, since the unrestricted type is a superset and interoperability with 128-sub-identifier-limited implementations cannot be guaranteed.

yang, snmp

protocol-element §4

The as-number type (uint32, no range restriction) represents a 32-bit autonomous system number, accommodating both the original 16-bit and the BGP four-octet AS number space (RFC 4893). Equivalent to SMIv2 InetAutonomousSystemNumber.

yang, bgp

protocol-element §3

The counter32 type (uint32 base) represents a non-negative integer that monotonically increases to 2^32-1 (4294967295) then wraps to zero. Counters have no defined initial value; discontinuities should be accompanied by a companion schema node indicating the last discontinuity time. Equivalent to SMIv2 Counter32.

yang, snmp

protocol-element §3

The counter64 type (uint64 base) represents a non-negative integer that monotonically increases to 2^64-1 (18446744073709551615) then wraps to zero. Semantically equivalent to SMIv2 Counter64; same discontinuity tracking requirements as counter32 apply.

yang, snmp

protocol-element §3

The date-and-time type is a string with pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-]\d{2}:\d{2})' following the RFC 3339 date-time profile of ISO 8601. The offset -00:00 denotes unknown timezone; canonical format uses a numeric offset derived from the device's configured UTC offset.

yang

protocol-element §4

The domain-name type (string, length 1..253) represents a DNS domain name. Internationalized domain names MUST be encoded in punycode (RFC 3492); canonical format uses lowercase US-ASCII characters. Schema nodes using this type MUST describe resolution behavior.

yang, dns

protocol-element §4

The dscp type (uint8, range 0..63) represents a Differentiated Services Code-Point for marking traffic streams. Equivalent to SMIv2 Dscp textual convention from DIFFSERV-DSCP-TC.

yang, diffserv

protocol-element §3

The gauge32 (uint32) and gauge64 (uint64) types represent non-negative integers that may increase or decrease but are clamped at their maximum and minimum bounds. Equivalent to SMIv2 Gauge32 and CounterBasedGauge64 respectively.

yang, snmp

protocol-element §4

The ietf-inet-types YANG module (namespace urn:ietf:params:xml:ns:yang:ietf-inet-types, prefix 'inet') defines derived data types for Internet protocol suite use: IP addresses, prefixes, port numbers, AS numbers, domain names, and URIs.

yang, netconf, ip

protocol-element §3

The ietf-yang-types YANG module (namespace urn:ietf:params:xml:ns:yang:ietf-yang-types, prefix 'yang') defines generally useful derived data types: counters, gauges, object identifiers, date/time types, address types, and XPath expressions. It is the core reusable type library for YANG-based management data models.

yang, netconf, snmp

protocol-element §4

The ip-version type is an enumeration with values unknown(0), ipv4(1), and ipv6(2) representing the IP protocol version. Equivalent to SMIv2 InetVersion from INET-ADDRESS-MIB.

yang, ip

protocol-element §4

The ipv4-address type (dotted-quad string with regex, optional zone index after %) and ipv6-address type (full/mixed/shortened/shortened-mixed notation with optional zone index) represent IPv4 and IPv6 addresses respectively. The ipv6-address canonical format follows RFC 5952 compressed lowercase notation.

yang, ip

protocol-element §4

The ipv4-prefix type represents an IPv4 prefix as address/length (length ≤ 32) with canonical format zeroing non-prefix bits. The ipv6-prefix type is analogous (length ≤ 128), applying RFC 4291 compressed canonical form with non-prefix bits set to zero.

yang, ip

protocol-element §3

The mac-address type (string pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}') represents an IEEE 802 MAC address; canonical representation uses lowercase hex. Equivalent to SMIv2 MacAddress textual convention.

yang

protocol-element §3

The object-identifier type (string with ASN.1-compliant regex) represents hierarchically assigned names as dot-separated non-negative integers; each sub-identifier MUST NOT exceed 2^32-1. The object-identifier-128 subtype restricts to at most 128 sub-identifiers, matching the SMIv2 OBJECT IDENTIFIER type.

yang, snmp

protocol-element §4

The port-number type (uint16, range 0..65535) represents a 16-bit IANA-assigned port number for UDP, TCP, DCCP, or SCTP. Port zero is reserved and may be excluded by subtyping.

yang, tcp, udp

protocol-element §3

The timeticks type (uint32) represents time modulo 2^32 in hundredths of a second between two epochs. The timestamp type derives from timeticks and records the timeticks value at which a specific occurrence happened; it resets to zero when the associated timeticks attribute wraps (after ~497 days).

yang, snmp

protocol-element §4

The uri type (unconstrained string) represents a URI per STD 66 (RFC 3986). Objects using this type MUST be in US-ASCII encoding and MUST be normalized per RFC 3986 sections 6.2.1, 6.2.2.1, and 6.2.2.2. A zero-length URI is not valid and may represent 'URI absent'.

yang

protocol-element §3

The xpath1.0 type (unconstrained string) represents an XPath 1.0 expression. The description of any schema node using this type MUST specify the XPath evaluation context.

yang

protocol-element §3

The zero-based-counter32 and zero-based-counter64 types derive from counter32/counter64 with a defined initial value of zero (default '0'), allowing applications to use the creation value as a delta. Applications must track the minimum wrap time and discard data if polling intervals exceed it.

yang, snmp

registry §5

This document registers two XML namespace URIs in the IETF XML registry (RFC 3688): urn:ietf:params:xml:ns:yang:ietf-yang-types and urn:ietf:params:xml:ns:yang:ietf-inet-types. It also registers ietf-yang-types and ietf-inet-types in the YANG Module Names registry defined by RFC 6020.

yang, registry, netconf

security-consideration §6

The common type definitions themselves have no security impact on the Internet, but their usage in concrete YANG modules might. The security considerations from the YANG specification (RFC 6020) apply to this document.

yang, security