Tomáš Pecka | 2a4ea7b | 2021-03-30 17:01:37 +0200 | [diff] [blame] | 1 | module ietf-routing { |
| 2 | yang-version "1.1"; |
| 3 | namespace "urn:ietf:params:xml:ns:yang:ietf-routing"; |
| 4 | prefix "rt"; |
| 5 | |
| 6 | import ietf-yang-types { |
| 7 | prefix "yang"; |
| 8 | } |
| 9 | |
| 10 | import ietf-interfaces { |
| 11 | prefix "if"; |
| 12 | description |
| 13 | "An 'ietf-interfaces' module version that is compatible with |
| 14 | the Network Management Datastore Architecture (NMDA) |
| 15 | is required."; |
| 16 | } |
| 17 | |
| 18 | organization |
| 19 | "IETF NETMOD (Network Modeling) Working Group"; |
| 20 | contact |
| 21 | "WG Web: <https://datatracker.ietf.org/wg/netmod/> |
| 22 | WG List: <mailto:rtgwg@ietf.org> |
| 23 | |
| 24 | Editor: Ladislav Lhotka |
| 25 | <mailto:lhotka@nic.cz> |
| 26 | Acee Lindem |
| 27 | <mailto:acee@cisco.com> |
| 28 | Yingzhen Qu |
| 29 | <mailto:yingzhen.qu@huawei.com>"; |
| 30 | |
| 31 | description |
| 32 | "This YANG module defines essential components for the management |
| 33 | of a routing subsystem. The model fully conforms to the Network |
| 34 | Management Datastore Architecture (NMDA). |
| 35 | |
| 36 | Copyright (c) 2018 IETF Trust and the persons |
| 37 | identified as authors of the code. All rights reserved. |
| 38 | |
| 39 | Redistribution and use in source and binary forms, with or |
| 40 | without modification, is permitted pursuant to, and subject |
| 41 | to the license terms contained in, the Simplified BSD License |
| 42 | set forth in Section 4.c of the IETF Trust's Legal Provisions |
| 43 | Relating to IETF Documents |
| 44 | (https://trustee.ietf.org/license-info). |
| 45 | This version of this YANG module is part of RFC 8349; see |
| 46 | the RFC itself for full legal notices."; |
| 47 | |
| 48 | revision 2018-03-13 { |
| 49 | description |
| 50 | "Network Management Datastore Architecture (NMDA) revision."; |
| 51 | reference |
| 52 | "RFC 8349: A YANG Data Model for Routing Management |
| 53 | (NMDA Version)"; |
| 54 | } |
| 55 | |
| 56 | revision 2016-11-04 { |
| 57 | description |
| 58 | "Initial revision."; |
| 59 | reference |
| 60 | "RFC 8022: A YANG Data Model for Routing Management"; |
| 61 | } |
| 62 | |
| 63 | /* Features */ |
| 64 | feature multiple-ribs { |
| 65 | description |
| 66 | "This feature indicates that the server supports |
| 67 | user-defined RIBs. |
| 68 | |
| 69 | Servers that do not advertise this feature SHOULD provide |
| 70 | exactly one system-controlled RIB per supported address family |
| 71 | and also make it the default RIB. This RIB then appears as an |
| 72 | entry in the list '/routing/ribs/rib'."; |
| 73 | } |
| 74 | |
| 75 | feature router-id { |
| 76 | description |
| 77 | "This feature indicates that the server supports an explicit |
| 78 | 32-bit router ID that is used by some routing protocols. |
| 79 | |
| 80 | Servers that do not advertise this feature set a router ID |
| 81 | algorithmically, usually to one of the configured IPv4 |
| 82 | addresses. However, this algorithm is implementation |
| 83 | specific."; |
| 84 | } |
| 85 | |
| 86 | /* Identities */ |
| 87 | |
| 88 | identity address-family { |
| 89 | description |
| 90 | "Base identity from which identities describing address |
| 91 | families are derived."; |
| 92 | } |
| 93 | identity ipv4 { |
| 94 | base address-family; |
| 95 | description |
| 96 | "This identity represents an IPv4 address family."; |
| 97 | } |
| 98 | |
| 99 | identity ipv6 { |
| 100 | base address-family; |
| 101 | description |
| 102 | "This identity represents an IPv6 address family."; |
| 103 | } |
| 104 | |
| 105 | identity control-plane-protocol { |
| 106 | description |
| 107 | "Base identity from which control-plane protocol identities are |
| 108 | derived."; |
| 109 | } |
| 110 | |
| 111 | identity routing-protocol { |
| 112 | base control-plane-protocol; |
| 113 | description |
| 114 | "Identity from which Layer 3 routing protocol identities are |
| 115 | derived."; |
| 116 | } |
| 117 | |
| 118 | identity direct { |
| 119 | base routing-protocol; |
| 120 | description |
| 121 | "Routing pseudo-protocol that provides routes to directly |
| 122 | connected networks."; |
| 123 | } |
| 124 | |
| 125 | identity static { |
| 126 | base routing-protocol; |
| 127 | description |
| 128 | "'Static' routing pseudo-protocol."; |
| 129 | } |
| 130 | |
| 131 | /* Type Definitions */ |
| 132 | |
| 133 | typedef route-preference { |
| 134 | type uint32; |
| 135 | description |
| 136 | "This type is used for route preferences."; |
| 137 | } |
| 138 | |
| 139 | /* Groupings */ |
| 140 | |
| 141 | grouping address-family { |
| 142 | description |
| 143 | "This grouping provides a leaf identifying an address |
| 144 | family."; |
| 145 | leaf address-family { |
| 146 | type identityref { |
| 147 | base address-family; |
| 148 | } |
| 149 | mandatory true; |
| 150 | description |
| 151 | "Address family."; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | grouping router-id { |
| 156 | description |
| 157 | "This grouping provides a router ID."; |
| 158 | leaf router-id { |
| 159 | type yang:dotted-quad; |
| 160 | description |
| 161 | "A 32-bit number in the form of a dotted quad that is used by |
| 162 | some routing protocols identifying a router."; |
| 163 | reference |
| 164 | "RFC 2328: OSPF Version 2"; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | grouping special-next-hop { |
| 169 | description |
| 170 | "This grouping provides a leaf with an enumeration of special |
| 171 | next hops."; |
| 172 | leaf special-next-hop { |
| 173 | type enumeration { |
| 174 | enum blackhole { |
| 175 | description |
| 176 | "Silently discard the packet."; |
| 177 | } |
| 178 | enum unreachable { |
| 179 | description |
| 180 | "Discard the packet and notify the sender with an error |
| 181 | message indicating that the destination host is |
| 182 | unreachable."; |
| 183 | } |
| 184 | enum prohibit { |
| 185 | description |
| 186 | "Discard the packet and notify the sender with an error |
| 187 | message indicating that the communication is |
| 188 | administratively prohibited."; |
| 189 | } |
| 190 | enum receive { |
| 191 | description |
| 192 | "The packet will be received by the local system."; |
| 193 | } |
| 194 | } |
| 195 | description |
| 196 | "Options for special next hops."; |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | grouping next-hop-content { |
| 201 | description |
| 202 | "Generic parameters of next hops in static routes."; |
| 203 | choice next-hop-options { |
| 204 | mandatory true; |
| 205 | description |
| 206 | "Options for next hops in static routes. |
| 207 | |
| 208 | It is expected that further cases will be added through |
| 209 | augments from other modules."; |
| 210 | case simple-next-hop { |
| 211 | description |
| 212 | "This case represents a simple next hop consisting of the |
| 213 | next-hop address and/or outgoing interface. |
| 214 | |
| 215 | Modules for address families MUST augment this case with a |
| 216 | leaf containing a next-hop address of that address |
| 217 | family."; |
| 218 | leaf outgoing-interface { |
| 219 | type if:interface-ref; |
| 220 | description |
| 221 | "Name of the outgoing interface."; |
| 222 | } |
| 223 | } |
| 224 | case special-next-hop { |
| 225 | uses special-next-hop; |
| 226 | } |
| 227 | case next-hop-list { |
| 228 | container next-hop-list { |
| 229 | description |
| 230 | "Container for multiple next hops."; |
| 231 | list next-hop { |
| 232 | key "index"; |
| 233 | description |
| 234 | "An entry in a next-hop list. |
| 235 | |
| 236 | Modules for address families MUST augment this list |
| 237 | with a leaf containing a next-hop address of that |
| 238 | address family."; |
| 239 | leaf index { |
| 240 | type string; |
| 241 | description |
| 242 | "A user-specified identifier utilized to uniquely |
| 243 | reference the next-hop entry in the next-hop list. |
| 244 | The value of this index has no semantic meaning |
| 245 | other than for referencing the entry."; |
| 246 | } |
| 247 | leaf outgoing-interface { |
| 248 | type if:interface-ref; |
| 249 | description |
| 250 | "Name of the outgoing interface."; |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | grouping next-hop-state-content { |
| 259 | description |
| 260 | "Generic state parameters of next hops."; |
| 261 | choice next-hop-options { |
| 262 | mandatory true; |
| 263 | description |
| 264 | "Options for next hops. |
| 265 | |
| 266 | It is expected that further cases will be added through |
| 267 | augments from other modules, e.g., for recursive |
| 268 | next hops."; |
| 269 | case simple-next-hop { |
| 270 | description |
| 271 | "This case represents a simple next hop consisting of the |
| 272 | next-hop address and/or outgoing interface. |
| 273 | |
| 274 | Modules for address families MUST augment this case with a |
| 275 | leaf containing a next-hop address of that address |
| 276 | family."; |
| 277 | leaf outgoing-interface { |
| 278 | type if:interface-ref; |
| 279 | description |
| 280 | "Name of the outgoing interface."; |
| 281 | } |
| 282 | } |
| 283 | case special-next-hop { |
| 284 | uses special-next-hop; |
| 285 | } |
| 286 | case next-hop-list { |
| 287 | container next-hop-list { |
| 288 | description |
| 289 | "Container for multiple next hops."; |
| 290 | list next-hop { |
| 291 | description |
| 292 | "An entry in a next-hop list. |
| 293 | |
| 294 | Modules for address families MUST augment this list |
| 295 | with a leaf containing a next-hop address of that |
| 296 | address family."; |
| 297 | leaf outgoing-interface { |
| 298 | type if:interface-ref; |
| 299 | description |
| 300 | "Name of the outgoing interface."; |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | grouping route-metadata { |
| 309 | description |
| 310 | "Common route metadata."; |
| 311 | leaf source-protocol { |
| 312 | type identityref { |
| 313 | base routing-protocol; |
| 314 | } |
| 315 | mandatory true; |
| 316 | description |
| 317 | "Type of the routing protocol from which the route |
| 318 | originated."; |
| 319 | } |
| 320 | leaf active { |
| 321 | type empty; |
| 322 | description |
| 323 | "The presence of this leaf indicates that the route is |
| 324 | preferred among all routes in the same RIB that have the |
| 325 | same destination prefix."; |
| 326 | } |
| 327 | leaf last-updated { |
| 328 | type yang:date-and-time; |
| 329 | description |
| 330 | "Timestamp of the last modification of the route. If the |
| 331 | route was never modified, it is the time when the route was |
| 332 | inserted into the RIB."; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | /* Data nodes */ |
| 337 | |
| 338 | container routing { |
| 339 | description |
| 340 | "Configuration parameters for the routing subsystem."; |
| 341 | uses router-id { |
| 342 | if-feature "router-id"; |
| 343 | description |
| 344 | "Support for the global router ID. Routing protocols |
| 345 | that use a router ID can use this parameter or override it |
| 346 | with another value."; |
| 347 | } |
| 348 | container interfaces { |
| 349 | config false; |
| 350 | description |
| 351 | "Network-layer interfaces used for routing."; |
| 352 | leaf-list interface { |
| 353 | type if:interface-ref; |
| 354 | description |
| 355 | "Each entry is a reference to the name of a configured |
| 356 | network-layer interface."; |
| 357 | } |
| 358 | } |
| 359 | container control-plane-protocols { |
| 360 | description |
| 361 | "Support for control-plane protocol instances."; |
| 362 | list control-plane-protocol { |
| 363 | key "type name"; |
| 364 | description |
| 365 | "Each entry contains a control-plane protocol instance."; |
| 366 | leaf type { |
| 367 | type identityref { |
| 368 | base control-plane-protocol; |
| 369 | } |
| 370 | description |
| 371 | "Type of the control-plane protocol -- an identity |
| 372 | derived from the 'control-plane-protocol' |
| 373 | base identity."; |
| 374 | } |
| 375 | leaf name { |
| 376 | type string; |
| 377 | description |
| 378 | "An arbitrary name of the control-plane protocol |
| 379 | instance."; |
| 380 | } |
| 381 | leaf description { |
| 382 | type string; |
| 383 | description |
| 384 | "Textual description of the control-plane protocol |
| 385 | instance."; |
| 386 | } |
| 387 | container static-routes { |
| 388 | when "derived-from-or-self(../type, 'rt:static')" { |
| 389 | description |
| 390 | "This container is only valid for the 'static' routing |
| 391 | protocol."; |
| 392 | } |
| 393 | description |
| 394 | "Support for the 'static' pseudo-protocol. |
| 395 | |
| 396 | Address-family-specific modules augment this node with |
| 397 | their lists of routes."; |
| 398 | } |
| 399 | } |
| 400 | } |
| 401 | container ribs { |
| 402 | description |
| 403 | "Support for RIBs."; |
| 404 | list rib { |
| 405 | key "name"; |
| 406 | description |
| 407 | "Each entry contains a configuration for a RIB identified |
| 408 | by the 'name' key. |
| 409 | |
| 410 | Entries having the same key as a system-controlled entry |
| 411 | in the list '/routing/ribs/rib' are used for |
| 412 | configuring parameters of that entry. Other entries |
| 413 | define additional user-controlled RIBs."; |
| 414 | leaf name { |
| 415 | type string; |
| 416 | description |
| 417 | "The name of the RIB. |
| 418 | |
| 419 | For system-controlled entries, the value of this leaf |
| 420 | must be the same as the name of the corresponding entry |
| 421 | in the operational state. |
| 422 | |
| 423 | For user-controlled entries, an arbitrary name can be |
| 424 | used."; |
| 425 | } |
| 426 | uses address-family { |
| 427 | description |
| 428 | "The address family of the system-controlled RIB."; |
| 429 | } |
| 430 | |
| 431 | leaf default-rib { |
| 432 | if-feature "multiple-ribs"; |
| 433 | type boolean; |
| 434 | default "true"; |
| 435 | config false; |
| 436 | description |
| 437 | "This flag has the value of 'true' if and only if the RIB |
| 438 | is the default RIB for the given address family. |
| 439 | |
| 440 | By default, control-plane protocols place their routes |
| 441 | in the default RIBs."; |
| 442 | } |
| 443 | container routes { |
| 444 | config false; |
| 445 | description |
| 446 | "Current contents of the RIB."; |
| 447 | list route { |
| 448 | description |
| 449 | "A RIB route entry. This data node MUST be augmented |
| 450 | with information specific to routes of each address |
| 451 | family."; |
| 452 | leaf route-preference { |
| 453 | type route-preference; |
| 454 | description |
| 455 | "This route attribute, also known as 'administrative |
| 456 | distance', allows for selecting the preferred route |
| 457 | among routes with the same destination prefix. A |
| 458 | smaller value indicates a route that is |
| 459 | more preferred."; |
| 460 | } |
| 461 | container next-hop { |
| 462 | description |
| 463 | "Route's next-hop attribute."; |
| 464 | uses next-hop-state-content; |
| 465 | } |
| 466 | uses route-metadata; |
| 467 | } |
| 468 | } |
| 469 | action active-route { |
| 470 | description |
| 471 | "Return the active RIB route that is used for the |
| 472 | destination address. |
| 473 | |
| 474 | Address-family-specific modules MUST augment input |
| 475 | parameters with a leaf named 'destination-address'."; |
| 476 | output { |
| 477 | container route { |
| 478 | description |
| 479 | "The active RIB route for the specified destination. |
| 480 | |
| 481 | If no route exists in the RIB for the destination |
| 482 | address, no output is returned. |
| 483 | |
| 484 | Address-family-specific modules MUST augment this |
| 485 | container with appropriate route contents."; |
| 486 | container next-hop { |
| 487 | description |
| 488 | "Route's next-hop attribute."; |
| 489 | uses next-hop-state-content; |
| 490 | } |
| 491 | uses route-metadata; |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | leaf description { |
| 496 | type string; |
| 497 | description |
| 498 | "Textual description of the RIB."; |
| 499 | } |
| 500 | } |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | /* |
| 505 | * The subsequent data nodes are obviated and obsoleted |
| 506 | * by the Network Management Datastore Architecture |
| 507 | * as described in RFC 8342. |
| 508 | */ |
| 509 | container routing-state { |
| 510 | config false; |
| 511 | status obsolete; |
| 512 | description |
| 513 | "State data of the routing subsystem."; |
| 514 | uses router-id { |
| 515 | status obsolete; |
| 516 | description |
| 517 | "Global router ID. |
| 518 | |
| 519 | It may be either configured or assigned algorithmically by |
| 520 | the implementation."; |
| 521 | } |
| 522 | container interfaces { |
| 523 | status obsolete; |
| 524 | description |
| 525 | "Network-layer interfaces used for routing."; |
| 526 | leaf-list interface { |
| 527 | type if:interface-state-ref; |
| 528 | status obsolete; |
| 529 | description |
| 530 | "Each entry is a reference to the name of a configured |
| 531 | network-layer interface."; |
| 532 | } |
| 533 | } |
| 534 | container control-plane-protocols { |
| 535 | status obsolete; |
| 536 | description |
| 537 | "Container for the list of routing protocol instances."; |
| 538 | list control-plane-protocol { |
| 539 | key "type name"; |
| 540 | status obsolete; |
| 541 | description |
| 542 | "State data of a control-plane protocol instance. |
| 543 | |
| 544 | An implementation MUST provide exactly one |
| 545 | system-controlled instance of the 'direct' |
| 546 | pseudo-protocol. Instances of other control-plane |
| 547 | protocols MAY be created by configuration."; |
| 548 | leaf type { |
| 549 | type identityref { |
| 550 | base control-plane-protocol; |
| 551 | } |
| 552 | status obsolete; |
| 553 | description |
| 554 | "Type of the control-plane protocol."; |
| 555 | } |
| 556 | leaf name { |
| 557 | type string; |
| 558 | status obsolete; |
| 559 | description |
| 560 | "The name of the control-plane protocol instance. |
| 561 | |
| 562 | For system-controlled instances, this name is |
| 563 | persistent, i.e., it SHOULD NOT change across |
| 564 | reboots."; |
| 565 | } |
| 566 | } |
| 567 | } |
| 568 | container ribs { |
| 569 | status obsolete; |
| 570 | description |
| 571 | "Container for RIBs."; |
| 572 | list rib { |
| 573 | key "name"; |
| 574 | min-elements 1; |
| 575 | status obsolete; |
| 576 | description |
| 577 | "Each entry represents a RIB identified by the 'name' |
| 578 | key. All routes in a RIB MUST belong to the same address |
| 579 | family. |
| 580 | |
| 581 | An implementation SHOULD provide one system-controlled |
| 582 | default RIB for each supported address family."; |
| 583 | leaf name { |
| 584 | type string; |
| 585 | status obsolete; |
| 586 | description |
| 587 | "The name of the RIB."; |
| 588 | } |
| 589 | uses address-family { |
| 590 | status obsolete; |
| 591 | description |
| 592 | "The address family of the RIB."; |
| 593 | } |
| 594 | leaf default-rib { |
| 595 | if-feature "multiple-ribs"; |
| 596 | type boolean; |
| 597 | default "true"; |
| 598 | status obsolete; |
| 599 | description |
| 600 | "This flag has the value of 'true' if and only if the |
| 601 | RIB is the default RIB for the given address family. |
| 602 | |
| 603 | By default, control-plane protocols place their routes |
| 604 | in the default RIBs."; |
| 605 | } |
| 606 | container routes { |
| 607 | status obsolete; |
| 608 | description |
| 609 | "Current contents of the RIB."; |
| 610 | list route { |
| 611 | status obsolete; |
| 612 | description |
| 613 | "A RIB route entry. This data node MUST be augmented |
| 614 | with information specific to routes of each address |
| 615 | family."; |
| 616 | leaf route-preference { |
| 617 | type route-preference; |
| 618 | status obsolete; |
| 619 | description |
| 620 | "This route attribute, also known as 'administrative |
| 621 | distance', allows for selecting the preferred route |
| 622 | among routes with the same destination prefix. A |
| 623 | smaller value indicates a route that is |
| 624 | more preferred."; |
| 625 | } |
| 626 | container next-hop { |
| 627 | status obsolete; |
| 628 | description |
| 629 | "Route's next-hop attribute."; |
| 630 | uses next-hop-state-content { |
| 631 | status obsolete; |
| 632 | description |
| 633 | "Route's next-hop attribute operational state."; |
| 634 | } |
| 635 | } |
| 636 | uses route-metadata { |
| 637 | status obsolete; |
| 638 | description |
| 639 | "Route metadata."; |
| 640 | } |
| 641 | } |
| 642 | } |
| 643 | action active-route { |
| 644 | status obsolete; |
| 645 | description |
| 646 | "Return the active RIB route that is used for the |
| 647 | destination address. |
| 648 | |
| 649 | Address-family-specific modules MUST augment input |
| 650 | parameters with a leaf named 'destination-address'."; |
| 651 | output { |
| 652 | container route { |
| 653 | status obsolete; |
| 654 | description |
| 655 | "The active RIB route for the specified |
| 656 | destination. |
| 657 | |
| 658 | If no route exists in the RIB for the destination |
| 659 | address, no output is returned. |
| 660 | |
| 661 | Address-family-specific modules MUST augment this |
| 662 | container with appropriate route contents."; |
| 663 | container next-hop { |
| 664 | status obsolete; |
| 665 | description |
| 666 | "Route's next-hop attribute."; |
| 667 | uses next-hop-state-content { |
| 668 | status obsolete; |
| 669 | description |
| 670 | "Active route state data."; |
| 671 | } |
| 672 | } |
| 673 | uses route-metadata { |
| 674 | status obsolete; |
| 675 | description |
| 676 | "Active route metadata."; |
| 677 | } |
| 678 | } |
| 679 | } |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | } |
| 684 | } |