idnits 2.17.1 draft-ietf-netmod-rfc6991-bis-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 2 characters in excess of 72. == There are 1 instance of lines with non-RFC6890-compliant IPv4 addresses in the document. If these are example addresses, they should be changed. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (February 22, 2021) is 1153 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'XPATH' -- Obsolete informational reference (is this intentional?): RFC 793 (Obsoleted by RFC 9293) -- Obsolete informational reference (is this intentional?): RFC 2460 (Obsoleted by RFC 8200) -- Obsolete informational reference (is this intentional?): RFC 4960 (Obsoleted by RFC 9260) Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Schoenwaelder, Ed. 3 Internet-Draft Jacobs University 4 Obsoletes: 6991 (if approved) February 22, 2021 5 Intended status: Standards Track 6 Expires: August 26, 2021 8 Common YANG Data Types 9 draft-ietf-netmod-rfc6991-bis-05 11 Abstract 13 This document introduces a collection of common data types to be used 14 with the YANG data modeling language. This document obsoletes RFC 15 6991. 17 Status of This Memo 19 This Internet-Draft is submitted in full conformance with the 20 provisions of BCP 78 and BCP 79. 22 Internet-Drafts are working documents of the Internet Engineering 23 Task Force (IETF). Note that other groups may also distribute 24 working documents as Internet-Drafts. The list of current Internet- 25 Drafts is at https://datatracker.ietf.org/drafts/current/. 27 Internet-Drafts are draft documents valid for a maximum of six months 28 and may be updated, replaced, or obsoleted by other documents at any 29 time. It is inappropriate to use Internet-Drafts as reference 30 material or to cite them other than as "work in progress." 32 This Internet-Draft will expire on August 26, 2021. 34 Copyright Notice 36 Copyright (c) 2021 IETF Trust and the persons identified as the 37 document authors. All rights reserved. 39 This document is subject to BCP 78 and the IETF Trust's Legal 40 Provisions Relating to IETF Documents 41 (https://trustee.ietf.org/license-info) in effect on the date of 42 publication of this document. Please review these documents 43 carefully, as they describe your rights and restrictions with respect 44 to this document. Code Components extracted from this document must 45 include Simplified BSD License text as described in Section 4.e of 46 the Trust Legal Provisions and are provided without warranty as 47 described in the Simplified BSD License. 49 This document may contain material from IETF Documents or IETF 50 Contributions published or made publicly available before November 51 10, 2008. The person(s) controlling the copyright in some of this 52 material may not have granted the IETF Trust the right to allow 53 modifications of such material outside the IETF Standards Process. 54 Without obtaining an adequate license from the person(s) controlling 55 the copyright in such materials, this document may not be modified 56 outside the IETF Standards Process, and derivative works of it may 57 not be created outside the IETF Standards Process, except to format 58 it for publication as an RFC or to translate it into languages other 59 than English. 61 Table of Contents 63 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 64 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 3 65 3. Core YANG Derived Types . . . . . . . . . . . . . . . . . . . 5 66 4. Internet-Specific Derived Types . . . . . . . . . . . . . . . 21 67 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 34 68 6. Security Considerations . . . . . . . . . . . . . . . . . . . 34 69 7. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 35 70 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 35 71 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 35 72 9.1. Normative References . . . . . . . . . . . . . . . . . . 35 73 9.2. Informative References . . . . . . . . . . . . . . . . . 36 74 Appendix A. Changes from RFC 6991 . . . . . . . . . . . . . . . 40 75 Appendix B. Changes from RFC 6021 . . . . . . . . . . . . . . . 40 76 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 41 78 1. Introduction 80 YANG [RFC7950] is a data modeling language used to model 81 configuration and state data manipulated by the Network Configuration 82 Protocol (NETCONF) [RFC6241]. The YANG language supports a small set 83 of built-in data types and provides mechanisms to derive other types 84 from the built-in types. 86 This document introduces a collection of common data types derived 87 from the built-in YANG data types. The derived types are designed to 88 be applicable for modeling all areas of management information. The 89 definitions are organized in several YANG modules. The 90 "ietf-yang-types" module contains generally useful data types. The 91 "ietf-inet-types" module contains definitions that are relevant for 92 the Internet protocol suite. 94 This document adds new type definitions to the YANG modules and 95 obsoletes [RFC6991]. For further details, see the revision 96 statements of the YANG modules in Section 3 and Section 4 and the 97 summary in Appendix A. 99 This document uses the YANG terminology defined in Section 3 of 100 [RFC7950]. 102 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 103 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 104 "OPTIONAL" in this document are to be interpreted as described in BCP 105 14 [RFC2119] [RFC8174] when, and only when, they appear in all 106 capitals, as shown here. 108 2. Overview 110 This section provides a short overview of the types defined in 111 subsequent sections and their equivalent Structure of Management 112 Information Version 2 (SMIv2) [RFC2578][RFC2579] data types. A YANG 113 data type is equivalent to an SMIv2 data type if the data types have 114 the same set of values and the semantics of the values are 115 equivalent. 117 Table 1 lists the types defined in the ietf-yang-types YANG module 118 and the corresponding SMIv2 types (- indicates there is no 119 corresponding SMIv2 type). 121 +-----------------------+--------------------------------+ 122 | YANG type | Equivalent SMIv2 type (module) | 123 +-----------------------+--------------------------------+ 124 | counter32 | Counter32 (SNMPv2-SMI) | 125 | zero-based-counter32 | ZeroBasedCounter32 (RMON2-MIB) | 126 | counter64 | Counter64 (SNMPv2-SMI) | 127 | zero-based-counter64 | ZeroBasedCounter64 (HCNUM-TC) | 128 | gauge32 | Gauge32 (SNMPv2-SMI) | 129 | gauge64 | CounterBasedGauge64 (HCNUM-TC) | 130 | object-identifier | - | 131 | object-identifier-128 | OBJECT IDENTIFIER | 132 | date-and-time | - | 133 | date | - | 134 | time | - | 135 | hours32 | - | 136 | minutes32 | - | 137 | seconds32 | - | 138 | centiseconds32 | TimeInterval (SNMPv2-TC) | 139 | milliseconds32 | - | 140 | microseconds32 | - | 141 | microseconds64 | - | 142 | nanoseconds32 | - | 143 | nanoseconds64 | - | 144 | timeticks | TimeTicks (SNMPv2-SMI) | 145 | timestamp | TimeStamp (SNMPv2-TC) | 146 | phys-address | PhysAddress (SNMPv2-TC) | 147 | mac-address | MacAddress (SNMPv2-TC) | 148 | xpath1.0 | - | 149 | hex-string | - | 150 | uuid | - | 151 | dotted-quad | - | 152 | yang-identifier | - | 153 | revision-identifier | - | 154 | percent | - | 155 | percent-i32 | - | 156 | percent-u32 | - | 157 +-----------------------+--------------------------------+ 159 Table 1: ietf-yang-types 161 Table 2 lists the types defined in the ietf-inet-types YANG module 162 and the corresponding SMIv2 types (if any). 164 +----------------------+--------------------------------------------+ 165 | YANG type | Equivalent SMIv2 type (module) | 166 +----------------------+--------------------------------------------+ 167 | ip-version | InetVersion (INET-ADDRESS-MIB) | 168 | dscp | Dscp (DIFFSERV-DSCP-TC) | 169 | ipv6-flow-label | IPv6FlowLabel (IPV6-FLOW-LABEL-MIB) | 170 | port-number | InetPortNumber (INET-ADDRESS-MIB) | 171 | as-number | InetAutonomousSystemNumber (INET-ADDRESS- | 172 | | MIB) | 173 | ip-address | - | 174 | ipv4-address | - | 175 | ipv6-address | - | 176 | ip-address-no-zone | - | 177 | ipv4-address-no-zone | - | 178 | ipv6-address-no-zone | - | 179 | ip-prefix | - | 180 | ipv4-prefix | - | 181 | ipv6-prefix | - | 182 | domain-name | - | 183 | host-name | - | 184 | host | - | 185 | uri | Uri (URI-TC-MIB) | 186 | email-address | - | 187 +----------------------+--------------------------------------------+ 189 Table 2: ietf-inet-types 191 3. Core YANG Derived Types 193 The ietf-yang-types YANG module references [IEEE802], [ISO9834-1], 194 [RFC2578], [RFC2579], [RFC2856], [RFC3339], [RFC4122], [RFC4502], 195 [RFC7950], [RFC8294], [XPATH], and [XSD-TYPES]. 197 file "ietf-yang-types@2021-02-22.yang" 199 module ietf-yang-types { 201 namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types"; 202 prefix "yang"; 204 organization 205 "IETF Network Modeling (NETMOD) Working Group"; 207 contact 208 "WG Web: 209 WG List: 211 Editor: Juergen Schoenwaelder 212 "; 214 description 215 "This module contains a collection of generally useful derived 216 YANG data types. 218 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL 219 NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', 220 'MAY', and 'OPTIONAL' in this document are to be interpreted as 221 described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, 222 they appear in all capitals, as shown here. 224 Copyright (c) 2021 IETF Trust and the persons identified as 225 authors of the code. All rights reserved. 227 Redistribution and use in source and binary forms, with or 228 without modification, is permitted pursuant to, and subject 229 to the license terms contained in, the Simplified BSD License 230 set forth in Section 4.c of the IETF Trust's Legal Provisions 231 Relating to IETF Documents 232 (http://trustee.ietf.org/license-info). 234 This version of this YANG module is part of RFC XXXX; 235 see the RFC itself for full legal notices."; 237 revision 2021-02-22 { 238 description 239 "This revision adds the following new data types: 240 - date, time 241 - hours32, minutes32, seconds32, centiseconds32, milliseconds32, 242 - microseconds32, microseconds64, nanoseconds32, nanoseconds64 243 - revision-identifier 244 - percent, percent-i32, percent-u32"; 245 reference 246 "RFC XXXX: Common YANG Data Types"; 247 } 249 revision 2013-07-15 { 250 description 251 "This revision adds the following new data types: 252 - yang-identifier 253 - hex-string 254 - uuid 255 - dotted-quad"; 256 reference 257 "RFC 6991: Common YANG Data Types"; 258 } 259 revision 2010-09-24 { 260 description 261 "Initial revision."; 262 reference 263 "RFC 6021: Common YANG Data Types"; 264 } 266 /*** collection of counter and gauge types ***/ 268 typedef counter32 { 269 type uint32; 270 description 271 "The counter32 type represents a non-negative integer 272 that monotonically increases until it reaches a 273 maximum value of 2^32-1 (4294967295 decimal), when it 274 wraps around and starts increasing again from zero. 276 Counters have no defined 'initial' value, and thus, a 277 single value of a counter has (in general) no information 278 content. Discontinuities in the monotonically increasing 279 value normally occur at re-initialization of the 280 management system, and at other times as specified in the 281 description of a schema node using this type. If such 282 other times can occur, for example, the instantiation of 283 a schema node of type counter32 at times other than 284 re-initialization, then a corresponding schema node 285 should be defined, with an appropriate type, to indicate 286 the last discontinuity. 288 The counter32 type should not be used for configuration 289 schema nodes. A default statement SHOULD NOT be used in 290 combination with the type counter32. 292 In the value set and its semantics, this type is equivalent 293 to the Counter32 type of the SMIv2."; 294 reference 295 "RFC 2578: Structure of Management Information Version 2 296 (SMIv2)"; 297 } 299 typedef zero-based-counter32 { 300 type yang:counter32; 301 default "0"; 302 description 303 "The zero-based-counter32 type represents a counter32 304 that has the defined 'initial' value zero. 306 A schema node instance of this type will be set to zero (0) 307 on creation and will thereafter increase monotonically until 308 it reaches a maximum value of 2^32-1 (4294967295 decimal), 309 when it wraps around and starts increasing again from zero. 311 Provided that an application discovers a new schema node 312 instance of this type within the minimum time to wrap, it 313 can use the 'initial' value as a delta. It is important for 314 a management station to be aware of this minimum time and the 315 actual time between polls, and to discard data if the actual 316 time is too long or there is no defined minimum time. 318 In the value set and its semantics, this type is equivalent 319 to the ZeroBasedCounter32 textual convention of the SMIv2."; 320 reference 321 "RFC 4502: Remote Network Monitoring Management Information 322 Base Version 2"; 323 } 325 typedef counter64 { 326 type uint64; 327 description 328 "The counter64 type represents a non-negative integer 329 that monotonically increases until it reaches a 330 maximum value of 2^64-1 (18446744073709551615 decimal), 331 when it wraps around and starts increasing again from zero. 333 Counters have no defined 'initial' value, and thus, a 334 single value of a counter has (in general) no information 335 content. Discontinuities in the monotonically increasing 336 value normally occur at re-initialization of the 337 management system, and at other times as specified in the 338 description of a schema node using this type. If such 339 other times can occur, for example, the instantiation of 340 a schema node of type counter64 at times other than 341 re-initialization, then a corresponding schema node 342 should be defined, with an appropriate type, to indicate 343 the last discontinuity. 345 The counter64 type should not be used for configuration 346 schema nodes. A default statement SHOULD NOT be used in 347 combination with the type counter64. 349 In the value set and its semantics, this type is equivalent 350 to the Counter64 type of the SMIv2."; 351 reference 352 "RFC 2578: Structure of Management Information Version 2 353 (SMIv2)"; 354 } 355 typedef zero-based-counter64 { 356 type yang:counter64; 357 default "0"; 358 description 359 "The zero-based-counter64 type represents a counter64 that 360 has the defined 'initial' value zero. 362 A schema node instance of this type will be set to zero (0) 363 on creation and will thereafter increase monotonically until 364 it reaches a maximum value of 2^64-1 (18446744073709551615 365 decimal), when it wraps around and starts increasing again 366 from zero. 368 Provided that an application discovers a new schema node 369 instance of this type within the minimum time to wrap, it 370 can use the 'initial' value as a delta. It is important for 371 a management station to be aware of this minimum time and the 372 actual time between polls, and to discard data if the actual 373 time is too long or there is no defined minimum time. 375 In the value set and its semantics, this type is equivalent 376 to the ZeroBasedCounter64 textual convention of the SMIv2."; 377 reference 378 "RFC 2856: Textual Conventions for Additional High Capacity 379 Data Types"; 380 } 382 typedef gauge32 { 383 type uint32; 384 description 385 "The gauge32 type represents a non-negative integer, which 386 may increase or decrease, but shall never exceed a maximum 387 value, nor fall below a minimum value. The maximum value 388 cannot be greater than 2^32-1 (4294967295 decimal), and 389 the minimum value cannot be smaller than 0. The value of 390 a gauge32 has its maximum value whenever the information 391 being modeled is greater than or equal to its maximum 392 value, and has its minimum value whenever the information 393 being modeled is smaller than or equal to its minimum value. 394 If the information being modeled subsequently decreases 395 below (increases above) the maximum (minimum) value, the 396 gauge32 also decreases (increases). 398 In the value set and its semantics, this type is equivalent 399 to the Gauge32 type of the SMIv2."; 400 reference 401 "RFC 2578: Structure of Management Information Version 2 402 (SMIv2)"; 404 } 406 typedef gauge64 { 407 type uint64; 408 description 409 "The gauge64 type represents a non-negative integer, which 410 may increase or decrease, but shall never exceed a maximum 411 value, nor fall below a minimum value. The maximum value 412 cannot be greater than 2^64-1 (18446744073709551615), and 413 the minimum value cannot be smaller than 0. The value of 414 a gauge64 has its maximum value whenever the information 415 being modeled is greater than or equal to its maximum 416 value, and has its minimum value whenever the information 417 being modeled is smaller than or equal to its minimum value. 418 If the information being modeled subsequently decreases 419 below (increases above) the maximum (minimum) value, the 420 gauge64 also decreases (increases). 422 In the value set and its semantics, this type is equivalent 423 to the CounterBasedGauge64 SMIv2 textual convention defined 424 in RFC 2856"; 425 reference 426 "RFC 2856: Textual Conventions for Additional High Capacity 427 Data Types"; 428 } 430 /*** collection of identifier-related types ***/ 432 typedef object-identifier { 433 type string { 434 pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))' 435 + '(\.(0|([1-9]\d*)))*'; 436 } 437 description 438 "The object-identifier type represents administratively 439 assigned names in a registration-hierarchical-name tree. 441 Values of this type are denoted as a sequence of numerical 442 non-negative sub-identifier values. Each sub-identifier 443 value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers 444 are separated by single dots and without any intermediate 445 whitespace. 447 The ASN.1 standard restricts the value space of the first 448 sub-identifier to 0, 1, or 2. Furthermore, the value space 449 of the second sub-identifier is restricted to the range 450 0 to 39 if the first sub-identifier is 0 or 1. Finally, 451 the ASN.1 standard requires that an object identifier 452 has always at least two sub-identifiers. The pattern 453 captures these restrictions. 455 Although the number of sub-identifiers is not limited, 456 module designers should realize that there may be 457 implementations that stick with the SMIv2 limit of 128 458 sub-identifiers. 460 This type is a superset of the SMIv2 OBJECT IDENTIFIER type 461 since it is not restricted to 128 sub-identifiers. Hence, 462 this type SHOULD NOT be used to represent the SMIv2 OBJECT 463 IDENTIFIER type; the object-identifier-128 type SHOULD be 464 used instead."; 465 reference 466 "ISO9834-1: Information technology -- Open Systems 467 Interconnection -- Procedures for the operation of OSI 468 Registration Authorities: General procedures and top 469 arcs of the ASN.1 Object Identifier tree"; 470 } 472 typedef object-identifier-128 { 473 type object-identifier { 474 pattern '\d*(\.\d*){1,127}'; 475 } 476 description 477 "This type represents object-identifiers restricted to 128 478 sub-identifiers. 480 In the value set and its semantics, this type is equivalent 481 to the OBJECT IDENTIFIER type of the SMIv2."; 482 reference 483 "RFC 2578: Structure of Management Information Version 2 484 (SMIv2)"; 485 } 487 /*** collection of types related to date and time ***/ 489 typedef date-and-time { 490 type string { 491 pattern '\d{4}-(1[0-2]|0[1-9])-(0[1-9]|[1|2][0-9]|3[0-1])' 492 + 'T(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.\d+)?' 493 + '(Z|[\+\-]((1[0-3]|0[0-9]):([0-5][0-9])|14:00))?'; 494 } 495 description 496 "The date-and-time type is a profile of the ISO 8601 497 standard for representation of dates and times using the 498 Gregorian calendar. The profile is defined by the 499 date-time production in Section 5.6 of RFC 3339. 501 The date-and-time type is compatible with the dateTime XML 502 schema type with the following notable exceptions: 504 (a) The date-and-time type does not allow negative years. 506 (b) The time-offset -00:00 indicates that the date-and-time 507 value is reported in UTC and that the local time zone 508 reference point is unknown. The time-offsets +00:00 and Z 509 both indicate that the date-and-time value is reported in 510 UTC and that the local time reference point is UTC (see RFC 511 3339 section 4.3). 513 (c) The canonical format (see below) of date-and-time values 514 differs from the canonical format used by the dateTime XML 515 schema type, which requires all times to be in UTC using 516 the time-offset 'Z'. 518 This type is not equivalent to the DateAndTime textual 519 convention of the SMIv2 since RFC 3339 uses a different 520 separator between full-date and full-time and provides 521 higher resolution of time-secfrac. 523 The canonical format for date-and-time values with a known time 524 zone uses a numeric time zone offset that is calculated using 525 the device's configured known offset to UTC time. A change of 526 the device's offset to UTC time will cause date-and-time values 527 to change accordingly. Such changes might happen periodically 528 in case a server follows automatically daylight saving time 529 (DST) time zone offset changes. The canonical format for 530 date-and-time values with an unknown time zone (usually 531 referring to the notion of local time) uses the time-offset 532 -00:00, i.e., date-and-time values must be reported in UTC."; 533 reference 534 "RFC 3339: Date and Time on the Internet: Timestamps 535 RFC 2579: Textual Conventions for SMIv2 536 XSD-TYPES: XML Schema Part 2: Datatypes Second Edition"; 537 } 539 typedef date { 540 type string { 541 pattern '\d{4}-(1[0-2]|0[1-9])-(0[1-9]|[1|2][0-9]|3[0-1])' 542 + '(Z|[\+\-]((1[0-3]|0[0-9]):([0-5][0-9])|14:00))?'; 543 } 544 description 545 "The date type represents a time-interval of the length 546 of a day, i.e., 24 hours. 548 The date type is compatible with the date XML schema 549 type with the following notable exceptions: 551 (a) The date type does not allow negative years. 553 (b) The time-offset -00:00 indicates that the date value is 554 reported in UTC and that the local time zone reference point 555 is unknown. The time-offsets +00:00 and Z both indicate that 556 the date value is reported in UTC and that the local time 557 reference point is UTC (see RFC 3339 section 4.3). 559 (c) The canonical format (see below) of data values 560 differs from the canonical format used by the date XML 561 schema type, which requires all times to be in UTC using 562 the time-offset 'Z'. 564 The canonical format for date values with a known time 565 zone uses a numeric time zone offset that is calculated using 566 the device's configured known offset to UTC time. A change of 567 the device's offset to UTC time will cause date values 568 to change accordingly. Such changes might happen periodically 569 in case a server follows automatically daylight saving time 570 (DST) time zone offset changes. The canonical format for 571 date values with an unknown time zone (usually referring 572 to the notion of local time) uses the time-offset -00:00, 573 i.e., date values must be reported in UTC."; 574 reference 575 "RFC 3339: Date and Time on the Internet: Timestamps 576 XSD-TYPES: XML Schema Part 2: Datatypes Second Edition"; 577 } 579 /* 580 * DISCUSS: 581 * - XML schema seems to use a different canonical format, we 582 * need to take a closer look how to define the canonical format 583 * given that a date really identifies a 24 hour interval and 584 * what XSD means with 'interval midpoint'. 585 */ 587 typedef time { 588 type string { 589 pattern '(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.\d+)?' 590 + '(Z|[\+\-]((1[0-3]|0[0-9]):([0-5][0-9])|14:00))?'; 591 } 592 description 593 "The time type represents an instance of time of zero-duration 594 that recurs every day. 596 The time type is compatible with the time XML schema 597 type with the following notable exceptions: 599 (a) The time-offset -00:00 indicates that the time value is 600 reported in UTC and that the local time zone reference point 601 is unknown. The time-offsets +00:00 and Z both indicate that 602 the time value is reported in UTC and that the local time 603 reference point is UTC (see RFC 3339 section 4.3). 605 (c) The canonical format (see below) of time values 606 differs from the canonical format used by the time XML 607 schema type, which requires all times to be in UTC using 608 the time-offset 'Z'. 610 The canonical format for time values with a known time 611 zone uses a numeric time zone offset that is calculated using 612 the device's configured known offset to UTC time. A change of 613 the device's offset to UTC time will cause time values 614 to change accordingly. Such changes might happen periodically 615 in case a server follows automatically daylight saving time 616 (DST) time zone offset changes. The canonical format for 617 time values with an unknown time zone (usually referring 618 to the notion of local time) uses the time-offset -00:00, 619 i.e., time values must be reported in UTC."; 620 reference 621 "RFC 3339: Date and Time on the Internet: Timestamps 622 XSD-TYPES: XML Schema Part 2: Datatypes Second Edition"; 623 } 625 typedef hours32 { 626 type int32; 627 units "hours"; 628 description 629 "A period of time, measured in units of hours. 631 The maximum time period that can be expressed is in the 632 range [89478485 days 08:00:00 to 89478485 days 07:00:00]. 634 This type should be range restricted in situations 635 where only non-negative time periods are desirable, 636 (i.e., range '0..max')."; 637 } 639 typedef minutes32 { 640 type int32; 641 units "minutes"; 642 description 643 "A period of time, measured in units of minutes. 645 The maximum time period that can be expressed is in the 646 range [-1491308 days 2:08:00 to 1491308 days 2:07:00]. 648 This type should be range restricted in situations 649 where only non-negative time periods are desirable, 650 (i.e., range '0..max')."; 651 } 653 typedef seconds32 { 654 type int32; 655 units "seconds"; 656 description 657 "A period of time, measured in units of seconds. 659 The maximum time period that can be expressed is in the 660 range [-24855 days 03:14:08 to 24855 days 03:14:07]. 662 This type should be range restricted in situations 663 where only non-negative time periods are desirable, 664 (i.e., range '0..max')."; 665 } 667 typedef centiseconds32 { 668 type int32; 669 units "centiseconds"; 670 description 671 "A period of time, measured in units of 10^-2 seconds. 673 The maximum time period that can be expressed is in the 674 range [-248 days 13:13:56 to 248 days 13:13:56]. 676 This type should be range restricted in situations 677 where only non-negative time periods are desirable, 678 (i.e., range '0..max')."; 679 } 681 typedef milliseconds32 { 682 type int32; 683 units "milliseconds"; 684 description 685 "A period of time, measured in units of 10^-3 seconds. 687 The maximum time period that can be expressed is in the 688 range [-24 days 20:31:23 to 24 days 20:31:23]. 690 This type should be range restricted in situations 691 where only non-negative time periods are desirable, 692 (i.e., range '0..max')."; 694 } 696 typedef microseconds32 { 697 type int32; 698 units "microseconds"; 699 description 700 "A period of time, measured in units of 10^-6 seconds. 702 The maximum time period that can be expressed is in the 703 range [-00:35:47 to 00:35:47]. 705 This type should be range restricted in situations 706 where only non-negative time periods are desirable, 707 (i.e., range '0..max')."; 708 } 710 typedef microseconds64 { 711 type int64; 712 units "microseconds"; 713 description 714 "A period of time, measured in units of 10^-6 seconds. 716 The maximum time period that can be expressed is in the 717 range [-106751991 days 04:00:54 to 106751991 days 04:00:54]. 719 This type should be range restricted in situations 720 where only non-negative time periods are desirable, 721 (i.e., range '0..max')."; 722 } 724 typedef nanoseconds32 { 725 type int32; 726 units "nanoseconds"; 727 description 728 "A period of time, measured in units of 10^-9 seconds. 730 The maximum time period that can be expressed is in the 731 range [-00:00:02 to 00:00:02]. 733 This type should be range restricted in situations 734 where only non-negative time periods are desirable, 735 (i.e., range '0..max')."; 736 } 738 typedef nanoseconds64 { 739 type int64; 740 units "nanoseconds"; 741 description 742 "A period of time, measured in units of 10^-9 seconds. 744 The maximum time period that can be expressed is in the 745 range [-106753 days 23:12:44 to 106752 days 0:47:16]. 747 This type should be range restricted in situations 748 where only non-negative time periods are desirable, 749 (i.e., range '0..max')."; 750 } 752 typedef timeticks { 753 type uint32; 754 description 755 "The timeticks type represents a non-negative integer that 756 represents the time, modulo 2^32 (4294967296 decimal), in 757 hundredths of a second between two epochs. When a schema 758 node is defined that uses this type, the description of 759 the schema node identifies both of the reference epochs. 761 In the value set and its semantics, this type is equivalent 762 to the TimeTicks type of the SMIv2."; 763 reference 764 "RFC 2578: Structure of Management Information Version 2 765 (SMIv2)"; 766 } 768 typedef timestamp { 769 type yang:timeticks; 770 description 771 "The timestamp type represents the value of an associated 772 timeticks schema node instance at which a specific occurrence 773 happened. The specific occurrence must be defined in the 774 description of any schema node defined using this type. When 775 the specific occurrence occurred prior to the last time the 776 associated timeticks schema node instance was zero, then the 777 timestamp value is zero. 779 Note that this requires all timestamp values to be reset to 780 zero when the value of the associated timeticks schema node 781 instance reaches 497+ days and wraps around to zero. 783 The associated timeticks schema node must be specified 784 in the description of any schema node using this type. 786 In the value set and its semantics, this type is equivalent 787 to the TimeStamp textual convention of the SMIv2."; 788 reference 789 "RFC 2579: Textual Conventions for SMIv2"; 791 } 793 /*** collection of generic address types ***/ 795 typedef phys-address { 796 type string { 797 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?'; 798 } 799 description 800 "Represents media- or physical-level addresses represented 801 as a sequence octets, each octet represented by two hexadecimal 802 numbers. Octets are separated by colons. The canonical 803 representation uses lowercase characters. 805 In the value set and its semantics, this type is equivalent 806 to the PhysAddress textual convention of the SMIv2."; 807 reference 808 "RFC 2579: Textual Conventions for SMIv2"; 809 } 811 typedef mac-address { 812 type string { 813 pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}'; 814 } 815 description 816 "The mac-address type represents an IEEE 802 MAC address. 817 The canonical representation uses lowercase characters. 819 In the value set and its semantics, this type is equivalent 820 to the MacAddress textual convention of the SMIv2."; 821 reference 822 "IEEE 802: IEEE Standard for Local and Metropolitan Area 823 Networks: Overview and Architecture 824 RFC 2579: Textual Conventions for SMIv2"; 825 } 827 /*** collection of XML-specific types ***/ 829 typedef xpath1.0 { 830 type string; 831 description 832 "This type represents an XPATH 1.0 expression. 834 When a schema node is defined that uses this type, the 835 description of the schema node MUST specify the XPath 836 context in which the XPath expression is evaluated."; 837 reference 838 "XPATH: XML Path Language (XPath) Version 1.0"; 840 } 842 /*** collection of string types ***/ 844 typedef hex-string { 845 type string { 846 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?'; 847 } 848 description 849 "A hexadecimal string with octets represented as hex digits 850 separated by colons. The canonical representation uses 851 lowercase characters."; 852 } 854 typedef uuid { 855 type string { 856 pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-' 857 + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'; 858 } 859 description 860 "A Universally Unique IDentifier in the string representation 861 defined in RFC 4122. The canonical representation uses 862 lowercase characters. 864 The following is an example of a UUID in string representation: 865 f81d4fae-7dec-11d0-a765-00a0c91e6bf6 866 "; 867 reference 868 "RFC 4122: A Universally Unique IDentifier (UUID) URN 869 Namespace"; 870 } 872 typedef dotted-quad { 873 type string { 874 pattern 875 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' 876 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; 877 } 878 description 879 "An unsigned 32-bit number expressed in the dotted-quad 880 notation, i.e., four octets written as decimal numbers 881 and separated with the '.' (full stop) character."; 882 } 884 /*** collection of YANG specific types ***/ 886 typedef yang-identifier { 887 type string { 888 length "1..max"; 889 pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*'; 890 pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*'; 891 } 892 description 893 "A YANG identifier string as defined by the 'identifier' 894 rule in Section 12 of RFC 6020. An identifier must 895 start with an alphabetic character or an underscore 896 followed by an arbitrary sequence of alphabetic or 897 numeric characters, underscores, hyphens, or dots. 899 A YANG identifier MUST NOT start with any possible 900 combination of the lowercase or uppercase character 901 sequence 'xml'."; 902 reference 903 "RFC 6020: YANG - A Data Modeling Language for the Network 904 Configuration Protocol (NETCONF)"; 905 } 907 typedef revision-identifier { 908 type date { 909 pattern '\d{4}-(1[0-2]|0[1-9])-(0[1-9]|[1|2][0-9]|3[0-1])'; 910 } 911 description 912 "Represents a specific revision of a YANG module by means of 913 a date value without a time zone."; 914 } 916 /* DISCUSS: 917 * - Do we also need percentage types with fractional parts? 918 * There are even more variations, precision of range and 919 * fractional part. Perhaps also drop percent-i32 and 920 * percent-u32 since creating a percentage type with a 921 * suitable range really is trivial. 922 */ 924 typedef percent-i32 { 925 type int32; 926 units "percent"; 927 description 928 "This type represents a 32-bit signed percentage value. 929 Depending on the usage scenario, it may make sense to 930 add range constraints. For example, the type definition 932 percent-i32 { range '-100..100'; } 934 restricts the range to -100 to 100."; 935 } 936 typedef percent-u32 { 937 type uint32; 938 units "percent"; 939 description 940 "This type represents a 32-bit unsigned percentage value. 941 Depending on the usage scenario, it may make sense to 942 add range constraints. For example, the type definition 944 percent-u32 { range '0..200'; } 946 restricts the range to 0 to 200."; 947 } 949 typedef percent { 950 type uint8; 951 units "percent"; 952 description 953 "This type represents an 8-bit unsigned percentage value 954 and it is equivalent to the percentage type defined in 955 the ietf-routing-types module (RFC 8294). While the 956 type definition 958 percent-u32 { range '0..100' } 960 yields the same value space, it is possible that encodings 961 choose different encodings due to the different base types."; 962 reference 963 "RFC 8294: Common YANG Data Types for the Routing Area"; 964 } 966 } 968 970 4. Internet-Specific Derived Types 972 The ietf-inet-types YANG module references [RFC0768], [RFC0791], 973 [RFC0793], [RFC0952], [RFC1034], [RFC1123], [RFC1930], [RFC2317], 974 [RFC2460], [RFC2474], [RFC2780], [RFC2782], [RFC3289], [RFC3305], 975 [RFC3595], [RFC3986], [RFC4001], [RFC4007], [RFC4271], [RFC4291], 976 [RFC4340], [RFC4592] [RFC4960], [RFC5017], [RFC5322], [RFC5890], 977 [RFC5952], and [RFC6793]. 979 file "ietf-inet-types@2021-02-22.yang" 981 module ietf-inet-types { 983 namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types"; 984 prefix "inet"; 986 organization 987 "IETF Network Modeling (NETMOD) Working Group"; 989 contact 990 "WG Web: 991 WG List: 993 Editor: Juergen Schoenwaelder 994 "; 996 description 997 "This module contains a collection of generally useful derived 998 YANG data types for Internet addresses and related things. 1000 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL 1001 NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', 1002 'MAY', and 'OPTIONAL' in this document are to be interpreted as 1003 described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, 1004 they appear in all capitals, as shown here. 1006 Copyright (c) 2021 IETF Trust and the persons identified as 1007 authors of the code. All rights reserved. 1009 Redistribution and use in source and binary forms, with or 1010 without modification, is permitted pursuant to, and subject 1011 to the license terms contained in, the Simplified BSD License 1012 set forth in Section 4.c of the IETF Trust's Legal Provisions 1013 Relating to IETF Documents 1014 (http://trustee.ietf.org/license-info). 1016 This version of this YANG module is part of RFC XXXX; 1017 see the RFC itself for full legal notices."; 1019 revision 2021-02-22 { 1020 description 1021 "This revision adds the following new data types: 1022 - inet:ip-address-and-prefix 1023 - inet:ipv4-address-and-prefix 1024 - inet:ipv6-address-and-prefix 1025 - inet:host-name 1026 - inet:email-address 1027 The inet:host union was changed to use inet:host-name instead 1028 of inet:domain-name."; 1029 reference 1030 "RFC XXXX: Common YANG Data Types"; 1031 } 1032 revision 2013-07-15 { 1033 description 1034 "This revision adds the following new data types: 1035 - inet:ip-address-no-zone 1036 - inet:ipv4-address-no-zone 1037 - inet:ipv6-address-no-zone"; 1038 reference 1039 "RFC 6991: Common YANG Data Types"; 1040 } 1042 revision 2010-09-24 { 1043 description 1044 "Initial revision."; 1045 reference 1046 "RFC 6021: Common YANG Data Types"; 1047 } 1049 /*** collection of types related to protocol fields ***/ 1051 typedef ip-version { 1052 type enumeration { 1053 enum unknown { 1054 value "0"; 1055 description 1056 "An unknown or unspecified version of the Internet 1057 protocol."; 1058 } 1059 enum ipv4 { 1060 value "1"; 1061 description 1062 "The IPv4 protocol as defined in RFC 791."; 1063 } 1064 enum ipv6 { 1065 value "2"; 1066 description 1067 "The IPv6 protocol as defined in RFC 2460."; 1068 } 1069 } 1070 description 1071 "This value represents the version of the IP protocol. 1073 In the value set and its semantics, this type is equivalent 1074 to the InetVersion textual convention of the SMIv2."; 1075 reference 1076 "RFC 791: Internet Protocol 1077 RFC 2460: Internet Protocol, Version 6 (IPv6) Specification 1078 RFC 4001: Textual Conventions for Internet Network Addresses"; 1079 } 1080 typedef dscp { 1081 type uint8 { 1082 range "0..63"; 1083 } 1084 description 1085 "The dscp type represents a Differentiated Services Code Point 1086 that may be used for marking packets in a traffic stream. 1088 In the value set and its semantics, this type is equivalent 1089 to the Dscp textual convention of the SMIv2."; 1090 reference 1091 "RFC 3289: Management Information Base for the Differentiated 1092 Services Architecture 1093 RFC 2474: Definition of the Differentiated Services Field 1094 (DS Field) in the IPv4 and IPv6 Headers 1095 RFC 2780: IANA Allocation Guidelines For Values In 1096 the Internet Protocol and Related Headers"; 1097 } 1099 typedef ipv6-flow-label { 1100 type uint32 { 1101 range "0..1048575"; 1102 } 1103 description 1104 "The ipv6-flow-label type represents the flow identifier or 1105 Flow Label in an IPv6 packet header that may be used to 1106 discriminate traffic flows. 1108 In the value set and its semantics, this type is equivalent 1109 to the IPv6FlowLabel textual convention of the SMIv2."; 1110 reference 1111 "RFC 3595: Textual Conventions for IPv6 Flow Label 1112 RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"; 1113 } 1115 typedef port-number { 1116 type uint16 { 1117 range "0..65535"; 1118 } 1119 description 1120 "The port-number type represents a 16-bit port number of an 1121 Internet transport-layer protocol such as UDP, TCP, DCCP, or 1122 SCTP. Port numbers are assigned by IANA. A current list of 1123 all assignments is available from . 1125 Note that the port number value zero is reserved by IANA. In 1126 situations where the value zero does not make sense, it can 1127 be excluded by subtyping the port-number type. 1129 In the value set and its semantics, this type is equivalent 1130 to the InetPortNumber textual convention of the SMIv2."; 1131 reference 1132 "RFC 768: User Datagram Protocol 1133 RFC 793: Transmission Control Protocol 1134 RFC 4960: Stream Control Transmission Protocol 1135 RFC 4340: Datagram Congestion Control Protocol (DCCP) 1136 RFC 4001: Textual Conventions for Internet Network Addresses"; 1137 } 1139 /*** collection of types related to autonomous systems ***/ 1141 typedef as-number { 1142 type uint32; 1143 description 1144 "The as-number type represents autonomous system numbers 1145 which identify an Autonomous System (AS). An AS is a set 1146 of routers under a single technical administration, using 1147 an interior gateway protocol and common metrics to route 1148 packets within the AS, and using an exterior gateway 1149 protocol to route packets to other ASes. IANA maintains 1150 the AS number space and has delegated large parts to the 1151 regional registries. 1153 Autonomous system numbers were originally limited to 16 1154 bits. BGP extensions have enlarged the autonomous system 1155 number space to 32 bits. This type therefore uses an uint32 1156 base type without a range restriction in order to support 1157 a larger autonomous system number space. 1159 In the value set and its semantics, this type is equivalent 1160 to the InetAutonomousSystemNumber textual convention of 1161 the SMIv2."; 1162 reference 1163 "RFC 1930: Guidelines for creation, selection, and registration 1164 of an Autonomous System (AS) 1165 RFC 4271: A Border Gateway Protocol 4 (BGP-4) 1166 RFC 4001: Textual Conventions for Internet Network Addresses 1167 RFC 6793: BGP Support for Four-Octet Autonomous System (AS) 1168 Number Space"; 1169 } 1171 /*** collection of types related to IP addresses and hostnames ***/ 1173 typedef ip-address { 1174 type union { 1175 type inet:ipv4-address; 1176 type inet:ipv6-address; 1178 } 1179 description 1180 "The ip-address type represents an IP address and is IP 1181 version neutral. The format of the textual representation 1182 implies the IP version. This type supports scoped addresses 1183 by allowing zone identifiers in the address format."; 1184 reference 1185 "RFC 4007: IPv6 Scoped Address Architecture"; 1186 } 1188 typedef ipv4-address { 1189 type string { 1190 pattern 1191 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' 1192 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' 1193 + '(%[\p{N}\p{L}]+)?'; 1194 } 1195 description 1196 "The ipv4-address type represents an IPv4 address in 1197 dotted-quad notation. The IPv4 address may include a zone 1198 index, separated by a % sign. 1200 The zone index is used to disambiguate identical address 1201 values. For link-local addresses, the zone index will 1202 typically be the interface index number or the name of an 1203 interface. If the zone index is not present, the default 1204 zone of the device will be used. 1206 The canonical format for the zone index is the numerical 1207 format"; 1208 } 1210 typedef ipv6-address { 1211 type string { 1212 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' 1213 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' 1214 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' 1215 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' 1216 + '(%[\p{N}\p{L}]+)?'; 1217 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' 1218 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' 1219 + '(%.+)?'; 1220 } 1221 description 1222 "The ipv6-address type represents an IPv6 address in full, 1223 mixed, shortened, and shortened-mixed notation. The IPv6 1224 address may include a zone index, separated by a % sign. 1226 The zone index is used to disambiguate identical address 1227 values. For link-local addresses, the zone index will 1228 typically be the interface index number or the name of an 1229 interface. If the zone index is not present, the default 1230 zone of the device will be used. 1232 The canonical format of IPv6 addresses uses the textual 1233 representation defined in Section 4 of RFC 5952. The 1234 canonical format for the zone index is the numerical 1235 format as described in Section 11.2 of RFC 4007."; 1236 reference 1237 "RFC 4291: IP Version 6 Addressing Architecture 1238 RFC 4007: IPv6 Scoped Address Architecture 1239 RFC 5952: A Recommendation for IPv6 Address Text 1240 Representation"; 1241 } 1243 typedef ip-address-no-zone { 1244 type union { 1245 type inet:ipv4-address-no-zone; 1246 type inet:ipv6-address-no-zone; 1247 } 1248 description 1249 "The ip-address-no-zone type represents an IP address and is 1250 IP version neutral. The format of the textual representation 1251 implies the IP version. This type does not support scoped 1252 addresses since it does not allow zone identifiers in the 1253 address format."; 1254 reference 1255 "RFC 4007: IPv6 Scoped Address Architecture"; 1256 } 1258 typedef ipv4-address-no-zone { 1259 type inet:ipv4-address { 1260 pattern '[0-9\.]*'; 1261 } 1262 description 1263 "An IPv4 address without a zone index. This type, derived from 1264 ipv4-address, may be used in situations where the zone is known 1265 from the context and hence no zone index is needed."; 1266 } 1268 typedef ipv6-address-no-zone { 1269 type inet:ipv6-address { 1270 pattern '[0-9a-fA-F:\.]*'; 1271 } 1272 description 1273 "An IPv6 address without a zone index. This type, derived from 1274 ipv6-address, may be used in situations where the zone is known 1275 from the context and hence no zone index is needed."; 1276 reference 1277 "RFC 4291: IP Version 6 Addressing Architecture 1278 RFC 4007: IPv6 Scoped Address Architecture 1279 RFC 5952: A Recommendation for IPv6 Address Text 1280 Representation"; 1281 } 1283 typedef ip-prefix { 1284 type union { 1285 type inet:ipv4-prefix; 1286 type inet:ipv6-prefix; 1287 } 1288 description 1289 "The ip-prefix type represents an IP prefix and is IP 1290 version neutral. The format of the textual representations 1291 implies the IP version."; 1292 } 1294 typedef ipv4-prefix { 1295 type string { 1296 pattern 1297 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' 1298 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' 1299 + '/(([0-9])|([1-2][0-9])|(3[0-2]))'; 1300 } 1301 description 1302 "The ipv4-prefix type represents an IPv4 prefix. 1303 The prefix length is given by the number following the 1304 slash character and must be less than or equal to 32. 1306 A prefix length value of n corresponds to an IP address 1307 mask that has n contiguous 1-bits from the most 1308 significant bit (MSB) and all other bits set to 0. 1310 The canonical format of an IPv4 prefix has all bits of 1311 the IPv4 address set to zero that are not part of the 1312 IPv4 prefix. 1314 The definition of ipv4-prefix does not require that bits, 1315 which are not part of the prefix, are set to zero. However, 1316 implementations have to return values in canonical format, 1317 which requires non-prefix bits to be set to zero. This means 1318 that 192.0.2.1/24 must be accepted as a valid value but it 1319 will be converted into the canonical format 192.0.2.0/24."; 1320 } 1321 typedef ipv6-prefix { 1322 type string { 1323 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' 1324 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' 1325 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' 1326 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' 1327 + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'; 1328 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' 1329 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' 1330 + '(/.+)'; 1331 } 1332 description 1333 "The ipv6-prefix type represents an IPv6 prefix. 1334 The prefix length is given by the number following the 1335 slash character and must be less than or equal to 128. 1337 A prefix length value of n corresponds to an IP address 1338 mask that has n contiguous 1-bits from the most 1339 significant bit (MSB) and all other bits set to 0. 1341 The canonical format of an IPv6 prefix has all bits of 1342 the IPv6 address set to zero that are not part of the 1343 IPv6 prefix. Furthermore, the IPv6 address is represented 1344 as defined in Section 4 of RFC 5952. 1346 The definition of ipv6-prefix does not require that bits, 1347 which are not part of the prefix, are set to zero. However, 1348 implementations have to return values in canonical format, 1349 which requires non-prefix bits to be set to zero. This means 1350 that 2001:db8::1/64 must be accepted as a valid value but it 1351 will be converted into the canonical format 2001:db8::/64."; 1352 reference 1353 "RFC 5952: A Recommendation for IPv6 Address Text 1354 Representation"; 1355 } 1357 typedef ip-address-and-prefix { 1358 type union { 1359 type inet:ipv4-address-and-prefix; 1360 type inet:ipv6-address-and-prefix; 1361 } 1362 description 1363 "The ip-address-and-prefix type represents an IP address and 1364 prefix and is IP version neutral. The format of the textual 1365 representations implies the IP version."; 1366 } 1368 typedef ipv4-address-and-prefix { 1369 type string { 1370 pattern 1371 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}' 1372 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])' 1373 + '/(([0-9])|([1-2][0-9])|(3[0-2]))'; 1374 } 1375 description 1376 "The ipv4-address-and-prefix type represents an IPv4 1377 address and an associated ipv4 prefix. 1378 The prefix length is given by the number following the 1379 slash character and must be less than or equal to 32. 1381 A prefix length value of n corresponds to an IP address 1382 mask that has n contiguous 1-bits from the most 1383 significant bit (MSB) and all other bits set to 0."; 1384 } 1386 typedef ipv6-address-and-prefix { 1387 type string { 1388 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}' 1389 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|' 1390 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}' 1391 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))' 1392 + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))'; 1393 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|' 1394 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)' 1395 + '(/.+)'; 1396 } 1397 description 1398 "The ipv6-address-and-prefix type represents an IPv6 1399 address and an associated ipv4 prefix. 1400 The prefix length is given by the number following the 1401 slash character and must be less than or equal to 128. 1403 A prefix length value of n corresponds to an IP address 1404 mask that has n contiguous 1-bits from the most 1405 significant bit (MSB) and all other bits set to 0. 1407 The canonical format requires that the IPv6 address is 1408 represented as defined in Section 4 of RFC 5952."; 1409 reference 1410 "RFC 5952: A Recommendation for IPv6 Address Text 1411 Representation"; 1412 } 1414 /*** collection of domain name and URI types ***/ 1416 typedef domain-name { 1417 type string { 1418 length "1..253"; 1419 pattern 1420 '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*' 1421 + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)' 1422 + '|\.'; 1423 } 1424 description 1425 "The domain-name type represents a DNS domain name. The 1426 name SHOULD be fully qualified whenever possible. This 1427 type does not support wildcards (see RFC 4592) or 1428 classless in-addr.arpa delegations (see RFC 2317). 1430 Internet domain names are only loosely specified. Section 1431 3.5 of RFC 1034 recommends a syntax (modified in Section 1432 2.1 of RFC 1123). The pattern above is intended to allow 1433 for current practice in domain name use, and some possible 1434 future expansion. Note that Internet host names have a 1435 stricter syntax (described in RFC 952) than the DNS 1436 recommendations in RFCs 1034 and 1123. Schema nodes 1437 representing host names should use the host-name type 1438 instead of the domain-type. 1440 The encoding of DNS names in the DNS protocol is limited 1441 to 255 characters. Since the encoding consists of labels 1442 prefixed by a length bytes and there is a trailing NULL 1443 byte, only 253 characters can appear in the textual dotted 1444 notation. 1446 The description clause of schema nodes using the domain-name 1447 type MUST describe when and how these names are resolved to 1448 IP addresses. Note that the resolution of a domain-name value 1449 may require to query multiple DNS records (e.g., A for IPv4 1450 and AAAA for IPv6). The order of the resolution process and 1451 which DNS record takes precedence can either be defined 1452 explicitly or may depend on the configuration of the 1453 resolver. 1455 Domain-name values use the US-ASCII encoding. Their canonical 1456 format uses lowercase US-ASCII characters. Internationalized 1457 domain names MUST be A-labels as per RFC 5890."; 1458 reference 1459 "RFC 952: DoD Internet Host Table Specification 1460 RFC 1034: Domain Names - Concepts and Facilities 1461 RFC 1123: Requirements for Internet Hosts -- Application 1462 and Support 1463 RFC 2317: Classless IN-ADDR.ARPA delegation 1464 RFC 2782: A DNS RR for specifying the location of services 1465 (DNS SRV) 1466 RFC 4592: The Role of Wildcards in the Domain Name System 1467 RFC 5890: Internationalized Domain Names in Applications 1468 (IDNA): Definitions and Document Framework"; 1469 } 1471 typedef host-name { 1472 type domain-name { 1473 pattern '[a-zA-Z0-9\-\.]+'; 1474 length "2..max"; 1475 } 1476 description 1477 "The host-name type represents (fully qualified) host names. 1478 Host names must be at least two characters long (see RFC 952) 1479 and they are restricted to labels consisting of letters, digits 1480 and hyphens separated by dots (see RFC1123 and RFC 952)."; 1481 reference 1482 "RFC 952: DoD Internet Host Table Specification 1483 RFC 1123: Requirements for Internet Hosts: Application and Support"; 1484 } 1486 typedef host { 1487 type union { 1488 type inet:ip-address; 1489 type inet:host-name; 1490 } 1491 description 1492 "The host type represents either an IP address or a (fully 1493 qualified) host name."; 1494 } 1496 /* 1497 * DISCUSS: 1498 * - It was discussed to define int-domain-name and int-host-name 1499 * that use U-labels instead of A-labels and to add int-host-name 1500 * to the inet:host union, perhaps all gated by an inet:idna-aware 1501 * feature. 1502 * - It is not clear how inet:idna-aware affects inet:email-address 1503 * and inet:uri - do we also need int-uri and int-email-address? 1504 */ 1506 typedef uri { 1507 type string; 1508 description 1509 "The uri type represents a Uniform Resource Identifier 1510 (URI) as defined by STD 66. 1512 Objects using the uri type MUST be in US-ASCII encoding, 1513 and MUST be normalized as described by RFC 3986 Sections 1514 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary 1515 percent-encoding is removed, and all case-insensitive 1516 characters are set to lowercase except for hexadecimal 1517 digits, which are normalized to uppercase as described in 1518 Section 6.2.2.1. 1520 The purpose of this normalization is to help provide 1521 unique URIs. Note that this normalization is not 1522 sufficient to provide uniqueness. Two URIs that are 1523 textually distinct after this normalization may still be 1524 equivalent. 1526 Objects using the uri type may restrict the schemes that 1527 they permit. For example, 'data:' and 'urn:' schemes 1528 might not be appropriate. 1530 A zero-length URI is not a valid URI. This can be used to 1531 express 'URI absent' where required. 1533 In the value set and its semantics, this type is equivalent 1534 to the Uri SMIv2 textual convention defined in RFC 5017."; 1535 reference 1536 "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax 1537 RFC 3305: Report from the Joint W3C/IETF URI Planning Interest 1538 Group: Uniform Resource Identifiers (URIs), URLs, 1539 and Uniform Resource Names (URNs): Clarifications 1540 and Recommendations 1541 RFC 5017: MIB Textual Conventions for Uniform Resource 1542 Identifiers (URIs)"; 1543 } 1545 typedef email-address { 1546 type string { 1547 // dot-atom-text "@" ... 1548 pattern '[a-zA-Z0-9!#$%&'+"'"+'*+/=?^_`{|}~-]+' 1549 + '(\.[a-zA-Z0-9!#$%&'+"'"+'*+/=?^_`{|}~-]+)*' 1550 + '@' 1551 + '[a-zA-Z0-9!#$%&'+"'"+'*+/=?^_`{|}~-]+' 1552 + '(\.[a-zA-Z0-9!#$%&'+"'"+'*+/=?^_`{|}~-]+)*'; 1553 } 1554 description 1555 "The email-address type represents an email address as 1556 defined as addr-spec in RFC 5322 section 3.4.1."; 1557 reference 1558 "RFC 5322: Internet Message Format"; 1559 } 1560 /* 1561 * DISCUSS: 1562 * - Need to define a pattern that has a meaningful trade-off 1563 * between precision and complexity (there are very tight 1564 * pattern that are very long and complex). The current 1565 * pattern does not take care of quoted-string, obs-local-part, 1566 * domain-literal, obs-domain. 1567 */ 1569 } 1571 1573 5. IANA Considerations 1575 This document registers two URIs in the IETF XML registry [RFC3688]. 1576 Following the format in RFC 3688, the following registrations have 1577 been made. 1579 URI: urn:ietf:params:xml:ns:yang:ietf-yang-types 1580 Registrant Contact: The NETMOD WG of the IETF. 1581 XML: N/A, the requested URI is an XML namespace. 1583 URI: urn:ietf:params:xml:ns:yang:ietf-inet-types 1584 Registrant Contact: The NETMOD WG of the IETF. 1585 XML: N/A, the requested URI is an XML namespace. 1587 This document registers two YANG modules in the YANG Module Names 1588 registry [RFC6020]. 1590 name: ietf-yang-types 1591 namespace: urn:ietf:params:xml:ns:yang:ietf-yang-types 1592 prefix: yang 1593 reference: RFC XXXX 1595 name: ietf-inet-types 1596 namespace: urn:ietf:params:xml:ns:yang:ietf-inet-types 1597 prefix: inet 1598 reference: RFC XXXX 1600 6. Security Considerations 1602 This document defines common data types using the YANG data modeling 1603 language. The definitions themselves have no security impact on the 1604 Internet, but the usage of these definitions in concrete YANG modules 1605 might have. The security considerations spelled out in the YANG 1606 specification [RFC7950] apply for this document as well. 1608 7. Contributors 1610 The following people contributed significantly to the initial version 1611 of this document: 1613 - Andy Bierman (Brocade) 1614 - Martin Bjorklund (Tail-f Systems) 1615 - Balazs Lengyel (Ericsson) 1616 - David Partain (Ericsson) 1617 - Phil Shafer (Juniper Networks) 1619 8. Acknowledgments 1621 The editor wishes to thank the following individuals for providing 1622 helpful comments on various versions of this document: Andy Bierman, 1623 Martin Bjorklund, Benoit Claise, Joel M. Halpern, Ladislav Lhotka, 1624 Lars-Johan Liman, and Dan Romascanu. 1626 Juergen Schoenwaelder was partly funded by the European Union's 1627 Seventh Framework Programme under Grant Agreement ICT-318488 and the 1628 European Union's Horizon 2020 research and innovation programme under 1629 Grant Agreement No. 830927. 1631 9. References 1633 9.1. Normative References 1635 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1636 Requirement Levels", BCP 14, RFC 2119, 1637 DOI 10.17487/RFC2119, March 1997, 1638 . 1640 [RFC3339] Klyne, G. and C. Newman, "Date and Time on the Internet: 1641 Timestamps", RFC 3339, DOI 10.17487/RFC3339, July 2002, 1642 . 1644 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 1645 DOI 10.17487/RFC3688, January 2004, 1646 . 1648 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1649 Resource Identifier (URI): Generic Syntax", STD 66, 1650 RFC 3986, DOI 10.17487/RFC3986, January 2005, 1651 . 1653 [RFC4007] Deering, S., Haberman, B., Jinmei, T., Nordmark, E., and 1654 B. Zill, "IPv6 Scoped Address Architecture", RFC 4007, 1655 DOI 10.17487/RFC4007, March 2005, 1656 . 1658 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 1659 Unique IDentifier (UUID) URN Namespace", RFC 4122, 1660 DOI 10.17487/RFC4122, July 2005, 1661 . 1663 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing 1664 Architecture", RFC 4291, DOI 10.17487/RFC4291, February 1665 2006, . 1667 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for 1668 the Network Configuration Protocol (NETCONF)", RFC 6020, 1669 DOI 10.17487/RFC6020, October 2010, 1670 . 1672 [RFC6991] Schoenwaelder, J., Ed., "Common YANG Data Types", 1673 RFC 6991, DOI 10.17487/RFC6991, July 2013, 1674 . 1676 [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", 1677 RFC 7950, DOI 10.17487/RFC7950, August 2016, 1678 . 1680 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1681 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1682 May 2017, . 1684 [RFC8294] Liu, X., Qu, Y., Lindem, A., Hopps, C., and L. Berger, 1685 "Common YANG Data Types for the Routing Area", RFC 8294, 1686 DOI 10.17487/RFC8294, December 2017, 1687 . 1689 [XPATH] Clark, J. and S. DeRose, "XML Path Language (XPath) 1690 Version 1.0", World Wide Web Consortium Recommendation 1691 REC-xpath-19991116, November 1999, 1692 . 1694 9.2. Informative References 1696 [IEEE802] IEEE, "IEEE Standard for Local and Metropolitan Area 1697 Networks: Overview and Architecture", IEEE Std. 802-2001, 1698 June 2001. 1700 [ISO9834-1] 1701 ISO/IEC, "Information technology -- Open Systems 1702 Interconnection -- Procedures for the operation of OSI 1703 Registration Authorities: General procedures and top arcs 1704 of the ASN.1 Object Identifier tree", ISO/IEC 9834-1:2008, 1705 2008. 1707 [RFC0768] Postel, J., "User Datagram Protocol", STD 6, RFC 768, 1708 DOI 10.17487/RFC0768, August 1980, 1709 . 1711 [RFC0791] Postel, J., "Internet Protocol", STD 5, RFC 791, 1712 DOI 10.17487/RFC0791, September 1981, 1713 . 1715 [RFC0793] Postel, J., "Transmission Control Protocol", STD 7, 1716 RFC 793, DOI 10.17487/RFC0793, September 1981, 1717 . 1719 [RFC0952] Harrenstien, K., Stahl, M., and E. Feinler, "DoD Internet 1720 host table specification", RFC 952, DOI 10.17487/RFC0952, 1721 October 1985, . 1723 [RFC1034] Mockapetris, P., "Domain names - concepts and facilities", 1724 STD 13, RFC 1034, DOI 10.17487/RFC1034, November 1987, 1725 . 1727 [RFC1123] Braden, R., Ed., "Requirements for Internet Hosts - 1728 Application and Support", STD 3, RFC 1123, 1729 DOI 10.17487/RFC1123, October 1989, 1730 . 1732 [RFC1930] Hawkinson, J. and T. Bates, "Guidelines for creation, 1733 selection, and registration of an Autonomous System (AS)", 1734 BCP 6, RFC 1930, DOI 10.17487/RFC1930, March 1996, 1735 . 1737 [RFC2317] Eidnes, H., de Groot, G., and P. Vixie, "Classless IN- 1738 ADDR.ARPA delegation", BCP 20, RFC 2317, 1739 DOI 10.17487/RFC2317, March 1998, 1740 . 1742 [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 1743 (IPv6) Specification", RFC 2460, DOI 10.17487/RFC2460, 1744 December 1998, . 1746 [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, 1747 "Definition of the Differentiated Services Field (DS 1748 Field) in the IPv4 and IPv6 Headers", RFC 2474, 1749 DOI 10.17487/RFC2474, December 1998, 1750 . 1752 [RFC2578] McCloghrie, K., Ed., Perkins, D., Ed., and J. 1753 Schoenwaelder, Ed., "Structure of Management Information 1754 Version 2 (SMIv2)", STD 58, RFC 2578, 1755 DOI 10.17487/RFC2578, April 1999, 1756 . 1758 [RFC2579] McCloghrie, K., Ed., Perkins, D., Ed., and J. 1759 Schoenwaelder, Ed., "Textual Conventions for SMIv2", 1760 STD 58, RFC 2579, DOI 10.17487/RFC2579, April 1999, 1761 . 1763 [RFC2780] Bradner, S. and V. Paxson, "IANA Allocation Guidelines For 1764 Values In the Internet Protocol and Related Headers", 1765 BCP 37, RFC 2780, DOI 10.17487/RFC2780, March 2000, 1766 . 1768 [RFC2782] Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for 1769 specifying the location of services (DNS SRV)", RFC 2782, 1770 DOI 10.17487/RFC2782, February 2000, 1771 . 1773 [RFC2856] Bierman, A., McCloghrie, K., and R. Presuhn, "Textual 1774 Conventions for Additional High Capacity Data Types", 1775 RFC 2856, DOI 10.17487/RFC2856, June 2000, 1776 . 1778 [RFC3289] Baker, F., Chan, K., and A. Smith, "Management Information 1779 Base for the Differentiated Services Architecture", 1780 RFC 3289, DOI 10.17487/RFC3289, May 2002, 1781 . 1783 [RFC3305] Mealling, M., Ed. and R. Denenberg, Ed., "Report from the 1784 Joint W3C/IETF URI Planning Interest Group: Uniform 1785 Resource Identifiers (URIs), URLs, and Uniform Resource 1786 Names (URNs): Clarifications and Recommendations", 1787 RFC 3305, DOI 10.17487/RFC3305, August 2002, 1788 . 1790 [RFC3595] Wijnen, B., "Textual Conventions for IPv6 Flow Label", 1791 RFC 3595, DOI 10.17487/RFC3595, September 2003, 1792 . 1794 [RFC4001] Daniele, M., Haberman, B., Routhier, S., and J. 1795 Schoenwaelder, "Textual Conventions for Internet Network 1796 Addresses", RFC 4001, DOI 10.17487/RFC4001, February 2005, 1797 . 1799 [RFC4271] Rekhter, Y., Ed., Li, T., Ed., and S. Hares, Ed., "A 1800 Border Gateway Protocol 4 (BGP-4)", RFC 4271, 1801 DOI 10.17487/RFC4271, January 2006, 1802 . 1804 [RFC4340] Kohler, E., Handley, M., and S. Floyd, "Datagram 1805 Congestion Control Protocol (DCCP)", RFC 4340, 1806 DOI 10.17487/RFC4340, March 2006, 1807 . 1809 [RFC4502] Waldbusser, S., "Remote Network Monitoring Management 1810 Information Base Version 2", RFC 4502, 1811 DOI 10.17487/RFC4502, May 2006, 1812 . 1814 [RFC4592] Lewis, E., "The Role of Wildcards in the Domain Name 1815 System", RFC 4592, DOI 10.17487/RFC4592, July 2006, 1816 . 1818 [RFC4960] Stewart, R., Ed., "Stream Control Transmission Protocol", 1819 RFC 4960, DOI 10.17487/RFC4960, September 2007, 1820 . 1822 [RFC5017] McWalter, D., Ed., "MIB Textual Conventions for Uniform 1823 Resource Identifiers (URIs)", RFC 5017, 1824 DOI 10.17487/RFC5017, September 2007, 1825 . 1827 [RFC5322] Resnick, P., Ed., "Internet Message Format", RFC 5322, 1828 DOI 10.17487/RFC5322, October 2008, 1829 . 1831 [RFC5890] Klensin, J., "Internationalized Domain Names for 1832 Applications (IDNA): Definitions and Document Framework", 1833 RFC 5890, DOI 10.17487/RFC5890, August 2010, 1834 . 1836 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 1837 Address Text Representation", RFC 5952, 1838 DOI 10.17487/RFC5952, August 2010, 1839 . 1841 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 1842 and A. Bierman, Ed., "Network Configuration Protocol 1843 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 1844 . 1846 [RFC6793] Vohra, Q. and E. Chen, "BGP Support for Four-Octet 1847 Autonomous System (AS) Number Space", RFC 6793, 1848 DOI 10.17487/RFC6793, December 2012, 1849 . 1851 [XSD-TYPES] 1852 Malhotra, A. and P. Biron, "XML Schema Part 2: Datatypes 1853 Second Edition", World Wide Web Consortium Recommendation 1854 REC-xmlschema-2-20041028, October 2004, 1855 . 1857 Appendix A. Changes from RFC 6991 1859 This version adds new type definitions to the YANG modules. The 1860 following new data types have been added to the ietf-yang-types 1861 module: 1863 o date, time 1865 o hours32, minutes32, seconds32, centiseconds32, milliseconds32, 1867 o microseconds32, microseconds64, nanoseconds32, nanoseconds64 1869 o revision-identifiers 1871 o percent, percent-i32, percent-u32 1873 The following new data types have been added to the ietf-inet-types 1874 module: 1876 o ip-address-and-prefix, ipv4-address-and-prefix, ipv6-address-and- 1877 prefix 1879 o host-name, email-address 1881 This version addresses errata 4076 and 5105 of RFC 6991. 1883 Appendix B. Changes from RFC 6021 1885 This version adds new type definitions to the YANG modules. The 1886 following new data types have been added to the ietf-yang-types 1887 module: 1889 o yang-identifier 1891 o hex-string 1893 o uuid 1895 o dotted-quad 1897 The following new data types have been added to the ietf-inet-types 1898 module: 1900 o ip-address-no-zone 1902 o ipv4-address-no-zone 1904 o ipv6-address-no-zone 1906 Author's Address 1908 Juergen Schoenwaelder (editor) 1909 Jacobs University 1911 Email: j.schoenwaelder@jacobs-university.de