--- /dev/null
+module ietf-inet-types {\r
+\r
+namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";\r
+prefix "inet";\r
+\r
+organization\r
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";\r
+\r
+contact\r
+ "WG Web: <http://tools.ietf.org/wg/netmod/>\r
+ WG List: <mailto:netmod@ietf.org>\r
+ WG Chair: David Kessens\r
+ <mailto:david.kessens@nsn.com>\r
+ WG Chair: Juergen Schoenwaelder\r
+ <mailto:j.schoenwaelder@jacobs-university.de>\r
+ Editor: Juergen Schoenwaelder\r
+ <mailto:j.schoenwaelder@jacobs-university.de>";\r
+\r
+description\r
+ "This module contains a collection of generally useful derived\r
+ YANG data types for Internet addresses and related things.\r
+ Copyright (c) 2013 IETF Trust and the persons identified as\r
+ authors of the code. All rights reserved.\r
+ Redistribution and use in source and binary forms, with or\r
+ without modification, is permitted pursuant to, and subject\r
+ to the license terms contained in, the Simplified BSD License\r
+ set forth in Section 4.c of the IETF Trust's Legal Provisions\r
+ Relating to IETF Documents\r
+ (http://trustee.ietf.org/license-info).\r
+ This version of this YANG module is part of RFC 6991; see\r
+ the RFC itself for full legal notices.";\r
+\r
+revision 2013-07-15 {\r
+ description\r
+ "This revision adds the following new data types:\r
+ - ip-address-no-zone\r
+ - ipv4-address-no-zone\r
+ - ipv6-address-no-zone";\r
+ reference\r
+ "RFC 6991: Common YANG Data Types";\r
+}\r
+\r
+revision 2010-09-24 {\r
+ description\r
+ "Initial revision.";\r
+ reference\r
+ "RFC 6021: Common YANG Data Types";\r
+}\r
+\r
+/*** collection of types related to protocol fields ***/\r
+\r
+typedef ip-version {\r
+ type enumeration {\r
+ enum unknown {\r
+ value "0";\r
+ description\r
+ "An unknown or unspecified version of the Internet\r
+ protocol.";\r
+ }\r
+ enum ipv4 {\r
+ value "1";\r
+ description\r
+ "The IPv4 protocol as defined in RFC 791.";\r
+ }\r
+ enum ipv6 {\r
+ value "2";\r
+ description\r
+ "The IPv6 protocol as defined in RFC 2460.";\r
+ }\r
+ }\r
+ description\r
+ "This value represents the version of the IP protocol.\r
+ In the value set and its semantics, this type is equivalent\r
+ to the InetVersion textual convention of the SMIv2.";\r
+ reference\r
+ "RFC 791: Internet Protocol\r
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification\r
+ RFC 4001: Textual Conventions for Internet Network Addresses";\r
+}\r
+\r
+typedef dscp {\r
+ type uint8 {\r
+ range "0..63";\r
+ }\r
+ description\r
+ "The dscp type represents a Differentiated Services Code Point\r
+ that may be used for marking packets in a traffic stream.\r
+ In the value set and its semantics, this type is equivalent\r
+ to the Dscp textual convention of the SMIv2.";\r
+ reference\r
+ "RFC 3289: Management Information Base for the Differentiated\r
+ Services Architecture\r
+ RFC 2474: Definition of the Differentiated Services Field\r
+ (DS Field) in the IPv4 and IPv6 Headers\r
+ RFC 2780: IANA Allocation Guidelines For Values In\r
+ the Internet Protocol and Related Headers";\r
+}\r
+\r
+typedef ipv6-flow-label {\r
+ type uint32 {\r
+ range "0..1048575";\r
+ }\r
+ description\r
+ "The ipv6-flow-label type represents the flow identifier or Flow\r
+ Label in an IPv6 packet header that may be used to\r
+ discriminate traffic flows.\r
+ In the value set and its semantics, this type is equivalent\r
+ to the IPv6FlowLabel textual convention of the SMIv2.";\r
+ reference\r
+ "RFC 3595: Textual Conventions for IPv6 Flow Label\r
+ RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";\r
+}\r
+\r
+typedef port-number {\r
+ type uint16 {\r
+ range "0..65535";\r
+ }\r
+ description\r
+ "The port-number type represents a 16-bit port number of an\r
+ Internet transport-layer protocol such as UDP, TCP, DCCP, or\r
+ SCTP. Port numbers are assigned by IANA. A current list of\r
+ all assignments is available from <http://www.iana.org/>.\r
+ Note that the port number value zero is reserved by IANA. In\r
+ situations where the value zero does not make sense, it can\r
+ be excluded by subtyping the port-number type.\r
+ In the value set and its semantics, this type is equivalent\r
+ to the InetPortNumber textual convention of the SMIv2.";\r
+ reference\r
+ "RFC 768: User Datagram Protocol\r
+ RFC 793: Transmission Control Protocol\r
+ RFC 4960: Stream Control Transmission Protocol\r
+ RFC 4340: Datagram Congestion Control Protocol (DCCP)\r
+ RFC 4001: Textual Conventions for Internet Network Addresses";\r
+}\r
+\r
+/*** collection of types related to autonomous systems ***/\r
+\r
+typedef as-number {\r
+ type uint32;\r
+ description\r
+ "The as-number type represents autonomous system numbers\r
+ which identify an Autonomous System (AS). An AS is a set\r
+ of routers under a single technical administration, using\r
+ an interior gateway protocol and common metrics to route\r
+ packets within the AS, and using an exterior gateway\r
+ protocol to route packets to other ASes. IANA maintains\r
+ the AS number space and has delegated large parts to the\r
+ regional registries.\r
+ Autonomous system numbers were originally limited to 16\r
+ bits. BGP extensions have enlarged the autonomous system\r
+ number space to 32 bits. This type therefore uses an uint32\r
+ base type without a range restriction in order to support\r
+ a larger autonomous system number space.\r
+ In the value set and its semantics, this type is equivalent\r
+ to the InetAutonomousSystemNumber textual convention of\r
+ the SMIv2.";\r
+ reference\r
+ "RFC 1930: Guidelines for creation, selection, and registration\r
+ of an Autonomous System (AS)\r
+ RFC 4271: A Border Gateway Protocol 4 (BGP-4)\r
+ RFC 4001: Textual Conventions for Internet Network Addresses\r
+ RFC 6793: BGP Support for Four-Octet Autonomous System (AS)\r
+ Number Space";\r
+}\r
+\r
+/*** collection of types related to IP addresses and hostnames ***/\r
+\r
+typedef ip-address {\r
+ type union {\r
+ type inet:ipv4-address;\r
+ type inet:ipv6-address;\r
+ }\r
+ description\r
+ "The ip-address type represents an IP address and is IP\r
+ version neutral. The format of the textual representation\r
+ implies the IP version. This type supports scoped addresses\r
+ by allowing zone identifiers in the address format.";\r
+ reference\r
+ "RFC 4007: IPv6 Scoped Address Architecture";\r
+}\r
+\r
+typedef ipv4-address {\r
+ type string {\r
+ pattern\r
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'\r
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'\r
+ + '(%[\p{N}\p{L}]+)?';\r
+ }\r
+ description\r
+ "The ipv4-address type represents an IPv4 address in\r
+ dotted-quad notation. The IPv4 address may include a zone\r
+ index, separated by a % sign.\r
+ The zone index is used to disambiguate identical address\r
+ values. For link-local addresses, the zone index will\r
+ typically be the interface index number or the name of an\r
+ interface. If the zone index is not present, the default\r
+ zone of the device will be used.\r
+ The canonical format for the zone index is the numerical\r
+ format";\r
+}\r
+\r
+typedef ipv6-address {\r
+ type string {\r
+ pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'\r
+ + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'\r
+ + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'\r
+ + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'\r
+ + '(%[\p{N}\p{L}]+)?';\r
+ pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'\r
+ + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'\r
+ + '(%.+)?';\r
+ }\r
+ description\r
+ "The ipv6-address type represents an IPv6 address in full,\r
+ mixed, shortened, and shortened-mixed notation. The IPv6\r
+ address may include a zone index, separated by a % sign.\r
+ The zone index is used to disambiguate identical address\r
+ values. For link-local addresses, the zone index will\r
+ typically be the interface index number or the name of an\r
+ interface. If the zone index is not present, the default\r
+ zone of the device will be used.\r
+ The canonical format of IPv6 addresses uses the textual\r
+ representation defined in Section 4 of RFC 5952. The\r
+ canonical format for the zone index is the numerical\r
+ format as described in Section 11.2 of RFC 4007.";\r
+ reference\r
+ "RFC 4291: IP Version 6 Addressing Architecture\r
+ RFC 4007: IPv6 Scoped Address Architecture\r
+ RFC 5952: A Recommendation for IPv6 Address Text\r
+ Representation";\r
+}\r
+\r
+typedef ip-address-no-zone {\r
+ type union {\r
+ type inet:ipv4-address-no-zone;\r
+ type inet:ipv6-address-no-zone;\r
+ }\r
+ description\r
+ "The ip-address-no-zone type represents an IP address and is\r
+ IP version neutral. The format of the textual representation\r
+ implies the IP version. This type does not support scoped\r
+ addresses since it does not allow zone identifiers in the\r
+ address format.";\r
+ reference\r
+ "RFC 4007: IPv6 Scoped Address Architecture";\r
+}\r
+\r
+typedef ipv4-address-no-zone {\r
+ type inet:ipv4-address {\r
+ pattern '[0-9\.]*';\r
+ }\r
+ description\r
+ "An IPv4 address without a zone index. This type, derived from\r
+ ipv4-address, may be used in situations where the zone is\r
+ known from the context and hence no zone index is needed.";\r
+}\r
+\r
+typedef ipv6-address-no-zone {\r
+ type inet:ipv6-address {\r
+ pattern '[0-9a-fA-F:\.]*';\r
+ }\r
+ description\r
+ "An IPv6 address without a zone index. This type, derived from\r
+ ipv6-address, may be used in situations where the zone is\r
+ known from the context and hence no zone index is needed.";\r
+ reference\r
+ "RFC 4291: IP Version 6 Addressing Architecture\r
+ RFC 4007: IPv6 Scoped Address Architecture\r
+ RFC 5952: A Recommendation for IPv6 Address Text\r
+ Representation";\r
+}\r
+\r
+typedef ip-prefix {\r
+ type union {\r
+ type inet:ipv4-prefix;\r
+ type inet:ipv6-prefix;\r
+ }\r
+ description\r
+ "The ip-prefix type represents an IP prefix and is IP\r
+ version neutral. The format of the textual representations\r
+ implies the IP version.";\r
+}\r
+\r
+typedef ipv4-prefix {\r
+ type string {\r
+ pattern\r
+ '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'\r
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'\r
+ + '/(([0-9])|([1-2][0-9])|(3[0-2]))';\r
+ }\r
+ description\r
+ "The ipv4-prefix type represents an IPv4 address prefix.\r
+ The prefix length is given by the number following the\r
+ slash character and must be less than or equal to 32.\r
+ A prefix length value of n corresponds to an IP address\r
+ mask that has n contiguous 1-bits from the most\r
+ significant bit (MSB) and all other bits set to 0.\r
+ The canonical format of an IPv4 prefix has all bits of\r
+ the IPv4 address set to zero that are not part of the\r
+ IPv4 prefix.";\r
+}\r
+\r
+typedef ipv6-prefix {\r
+ type string {\r
+ pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'\r
+ + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'\r
+ + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'\r
+ + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'\r
+ + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';\r
+ pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'\r
+ + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'\r
+ + '(/.+)';\r
+ }\r
+\r
+ description\r
+ "The ipv6-prefix type represents an IPv6 address prefix.\r
+ The prefix length is given by the number following the\r
+ slash character and must be less than or equal to 128.\r
+ A prefix length value of n corresponds to an IP address\r
+ mask that has n contiguous 1-bits from the most\r
+ significant bit (MSB) and all other bits set to 0.\r
+ The IPv6 address should have all bits that do not belong\r
+ to the prefix set to zero.\r
+ The canonical format of an IPv6 prefix has all bits of\r
+ the IPv6 address set to zero that are not part of the\r
+ IPv6 prefix. Furthermore, the IPv6 address is represented\r
+ as defined in Section 4 of RFC 5952.";\r
+ reference\r
+ "RFC 5952: A Recommendation for IPv6 Address Text\r
+ Representation";\r
+}\r
+\r
+/*** collection of domain name and URI types ***/\r
+\r
+typedef domain-name {\r
+ type string {\r
+ pattern\r
+ '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'\r
+ + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'\r
+ + '|\.';\r
+ length "1..253";\r
+ }\r
+ description\r
+ "The domain-name type represents a DNS domain name. The\r
+ name SHOULD be fully qualified whenever possible.\r
+ Internet domain names are only loosely specified. Section\r
+ 3.5 of RFC 1034 recommends a syntax (modified in Section\r
+ 2.1 of RFC 1123). The pattern above is intended to allow\r
+ for current practice in domain name use, and some possible\r
+ future expansion. It is designed to hold various types of\r
+ domain names, including names used for A or AAAA records\r
+ (host names) and other records, such as SRV records. Note\r
+ that Internet host names have a stricter syntax (described\r
+ in RFC 952) than the DNS recommendations in RFCs 1034 and\r
+ 1123, and that systems that want to store host names in\r
+ schema nodes using the domain-name type are recommended to\r
+ adhere to this stricter standard to ensure interoperability.\r
+ The encoding of DNS names in the DNS protocol is limited\r
+ to 255 characters. Since the encoding consists of labels\r
+ prefixed by a length bytes and there is a trailing NULL\r
+ byte, only 253 characters can appear in the textual dotted\r
+ notation.\r
+ The description clause of schema nodes using the domain-name\r
+ type MUST describe when and how these names are resolved to\r
+ IP addresses. Note that the resolution of a domain-name value\r
+ may require to query multiple DNS records (e.g., A for IPv4\r
+ and AAAA for IPv6). The order of the resolution process and\r
+ which DNS record takes precedence can either be defined\r
+ explicitly or may depend on the configuration of the\r
+ resolver.\r
+ Domain-name values use the US-ASCII encoding. Their canonical\r
+ format uses lowercase US-ASCII characters. Internationalized\r
+ domain names MUST be A-labels as per RFC 5890.";\r
+ reference\r
+ "RFC 952: DoD Internet Host Table Specification\r
+ RFC 1034: Domain Names - Concepts and Facilities\r
+ RFC 1123: Requirements for Internet Hosts -- Application\r
+ and Support\r
+ RFC 2782: A DNS RR for specifying the location of services\r
+ (DNS SRV)\r
+ RFC 5890: Internationalized Domain Names in Applications\r
+ (IDNA): Definitions and Document Framework";\r
+}\r
+\r
+typedef host {\r
+ type union {\r
+ type inet:ip-address;\r
+ type inet:domain-name;\r
+ }\r
+ description\r
+ "The host type represents either an IP address or a DNS\r
+ domain name.";\r
+}\r
+\r
+typedef uri {\r
+ type string;\r
+ description\r
+ "The uri type represents a Uniform Resource Identifier\r
+ (URI) as defined by STD 66.\r
+ Objects using the uri type MUST be in US-ASCII encoding,\r
+ and MUST be normalized as described by RFC 3986 Sections\r
+ 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary\r
+ percent-encoding is removed, and all case-insensitive\r
+ characters are set to lowercase except for hexadecimal\r
+ digits, which are normalized to uppercase as described in\r
+ Section 6.2.2.1.\r
+ The purpose of this normalization is to help provide\r
+ unique URIs. Note that this normalization is not\r
+ sufficient to provide uniqueness. Two URIs that are\r
+ textually distinct after this normalization may still be\r
+ equivalent.\r
+ Objects using the uri type may restrict the schemes that\r
+ they permit. For example, 'data:' and 'urn:' schemes\r
+ might not be appropriate.\r
+ A zero-length URI is not a valid URI. This can be used to\r
+ express 'URI absent' where required.\r
+ In the value set and its semantics, this type is equivalent\r
+ to the Uri SMIv2 textual convention defined in RFC 5017.";\r
+ reference\r
+ "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax\r
+ RFC 3305: Report from the Joint W3C/IETF URI Planning Interest\r
+ Group: Uniform Resource Identifiers (URIs), URLs,\r
+ and Uniform Resource Names (URNs): Clarifications\r
+ and Recommendations\r
+ RFC 5017: MIB Textual Conventions for Uniform Resource\r
+ Identifiers (URIs)";\r
+}\r
+\r
+}\r