Thomas Vachuska | 6655bee | 2017-08-24 16:12:59 -0700 | [diff] [blame] | 1 | module openconfig-lldp { |
| 2 | |
| 3 | yang-version "1"; |
| 4 | |
| 5 | // namespace |
| 6 | namespace "http://openconfig.net/yang/lldp"; |
| 7 | |
| 8 | prefix "oc-lldp"; |
| 9 | |
| 10 | import openconfig-lldp-types { prefix oc-lldp-types; } |
| 11 | import openconfig-interfaces { prefix oc-if; } |
| 12 | import ietf-yang-types { prefix yang; } |
| 13 | import openconfig-extensions { prefix oc-ext; } |
| 14 | |
| 15 | |
| 16 | // meta |
| 17 | organization "OpenConfig working group"; |
| 18 | |
| 19 | contact |
| 20 | "OpenConfig working group |
| 21 | www.openconfig.net"; |
| 22 | |
| 23 | description |
| 24 | "This module defines configuration and operational state data |
| 25 | for the LLDP protocol."; |
| 26 | |
| 27 | oc-ext:openconfig-version "0.1.0"; |
| 28 | |
| 29 | revision "2016-05-16" { |
| 30 | description |
| 31 | "Initial public revision"; |
| 32 | reference "0.1.0"; |
| 33 | } |
| 34 | |
| 35 | |
| 36 | // identity statements |
| 37 | |
| 38 | |
| 39 | // grouping statements |
| 40 | |
| 41 | grouping lldp-common-counters { |
| 42 | description |
| 43 | "Definition of global and per-interface counters"; |
| 44 | |
| 45 | leaf frame-in { |
| 46 | type yang:counter64; |
| 47 | description |
| 48 | "The number of lldp frames received."; |
| 49 | } |
| 50 | |
| 51 | leaf frame-out { |
| 52 | type yang:counter64; |
| 53 | description |
| 54 | "The number of frames transmitted out."; |
| 55 | } |
| 56 | |
| 57 | leaf frame-error-in { |
| 58 | type yang:counter64; |
| 59 | description |
| 60 | "The number of LLDP frames received with errors."; |
| 61 | } |
| 62 | |
| 63 | leaf frame-discard { |
| 64 | type yang:counter64; |
| 65 | description |
| 66 | "The number of LLDP frames received and discarded."; |
| 67 | } |
| 68 | |
| 69 | leaf tlv-discard { |
| 70 | type yang:counter64; |
| 71 | description |
| 72 | "The number of TLV frames received and discarded."; |
| 73 | } |
| 74 | |
| 75 | leaf tlv-unknown { |
| 76 | type yang:counter64; |
| 77 | description |
| 78 | "The number of frames received with unknown TLV."; |
| 79 | } |
| 80 | |
| 81 | leaf last-clear { |
| 82 | type yang:date-and-time; |
| 83 | description |
| 84 | "Indicates the last time the counters were |
| 85 | cleared."; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | grouping lldp-global-counters { |
| 90 | description |
| 91 | "Definition of global LLDP counters"; |
| 92 | |
| 93 | uses lldp-common-counters; |
| 94 | |
| 95 | leaf tlv-accepted { |
| 96 | type yang:counter64; |
| 97 | description |
| 98 | "The number of valid TLVs received."; |
| 99 | } |
| 100 | |
| 101 | leaf entries-aged-out { |
| 102 | type yang:counter64; |
| 103 | description |
| 104 | "The number of entries aged out due to timeout."; |
| 105 | } |
| 106 | |
| 107 | } |
| 108 | |
| 109 | grouping lldp-interface-counters { |
| 110 | description |
| 111 | "Definition of per-interface LLDP counters"; |
| 112 | |
| 113 | uses lldp-common-counters; |
| 114 | |
| 115 | leaf frame-error-out { |
| 116 | type yang:counter64; |
| 117 | description |
| 118 | "The number of frame transmit errors on the |
| 119 | interface."; |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | grouping lldp-system-info-config { |
| 124 | description |
| 125 | "Configuration data for system-level local and remote |
| 126 | LLDP information"; |
| 127 | |
| 128 | leaf system-name { |
| 129 | type string { |
| 130 | length 0..255; |
| 131 | } |
| 132 | description |
| 133 | "The system name field shall contain an alpha-numeric string |
| 134 | that indicates the system's administratively assigned name. |
| 135 | The system name should be the system's fully qualified domain |
| 136 | name. If implementations support IETF RFC 3418, the sysName |
| 137 | object should be used for this field."; |
| 138 | } |
| 139 | |
| 140 | leaf system-description { |
| 141 | type string { |
| 142 | length 0..255; |
| 143 | } |
| 144 | description |
| 145 | "The system description field shall contain an alpha-numeric |
| 146 | string that is the textual description of the network entity. |
| 147 | The system description should include the full name and |
| 148 | version identification of the system's hardware type, |
| 149 | software operating system, and networking software. If |
| 150 | implementations support IETF RFC 3418, the sysDescr object |
| 151 | should be used for this field."; |
| 152 | } |
| 153 | |
| 154 | leaf chassis-id { |
| 155 | type string; |
| 156 | description |
| 157 | "The Chassis ID is a mandatory TLV which identifies the |
| 158 | chassis component of the endpoint identifier associated with |
| 159 | the transmitting LLDP agent"; |
| 160 | } |
| 161 | |
| 162 | leaf chassis-id-type { |
| 163 | type oc-lldp-types:chassis-id-type; |
| 164 | description |
| 165 | "This field identifies the format and source of the chassis |
| 166 | identifier string. It is an enumerator defined by the |
| 167 | LldpChassisIdSubtype object from IEEE 802.1AB MIB."; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | grouping lldp-system-info-state { |
| 172 | description |
| 173 | "Operational state data reported for the local and remote |
| 174 | systems"; |
| 175 | |
| 176 | } |
| 177 | |
| 178 | grouping lldp-neighbor-config { |
| 179 | description |
| 180 | "Configuration data for LLDP neighbors"; |
| 181 | |
| 182 | } |
| 183 | |
| 184 | grouping lldp-neighbor-state { |
| 185 | description |
| 186 | "Operational state data for LLDP neighbors"; |
| 187 | |
| 188 | leaf id { |
| 189 | type string; |
| 190 | description |
| 191 | "System generated identifier for the neighbor on the |
| 192 | interface."; |
| 193 | } |
| 194 | |
| 195 | leaf age { |
| 196 | type uint64; |
| 197 | units "seconds"; |
| 198 | description |
| 199 | "Age since discovery"; |
| 200 | } |
| 201 | |
| 202 | leaf last-update { |
| 203 | type int64; |
| 204 | description |
| 205 | "Seconds since last update received."; |
| 206 | } |
| 207 | |
| 208 | leaf port-id { |
| 209 | type string; |
| 210 | description |
| 211 | "The Port ID is a mandatory TLV which identifies the port |
| 212 | component of the endpoint identifier associated with the |
| 213 | transmitting LLDP agent. If the specified port is an IEEE |
| 214 | 802.3 Repeater port, then this TLV is optional."; |
| 215 | } |
| 216 | |
| 217 | leaf port-id-type { |
| 218 | type oc-lldp-types:port-id-type; |
| 219 | description |
| 220 | "This field identifies the format and source of the port |
| 221 | identifier string. It is an enumerator defined by the |
| 222 | PtopoPortIdType object from RFC2922."; |
| 223 | } |
| 224 | |
| 225 | leaf port-description { |
| 226 | type string; |
| 227 | description |
| 228 | "The binary string containing the actual port identifier for |
| 229 | the port which this LLDP PDU was transmitted. The source and |
| 230 | format of this field is defined by PtopoPortId from |
| 231 | RFC2922."; |
| 232 | } |
| 233 | |
| 234 | leaf management-address { |
| 235 | type string; |
| 236 | description |
| 237 | "The Management Address is a mandatory TLV which identifies a |
| 238 | network address associated with the local LLDP agent, which |
| 239 | can be used to reach the agent on the port identified in the |
| 240 | Port ID TLV."; |
| 241 | } |
| 242 | |
| 243 | leaf management-address-type { |
| 244 | type string; |
| 245 | description |
| 246 | "The enumerated value for the network address type |
| 247 | identified in this TLV. This enumeration is defined in the |
| 248 | 'Assigned Numbers' RFC [RFC3232] and the |
| 249 | ianaAddressFamilyNumbers object."; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | grouping lldp-capabilities-config { |
| 254 | description |
| 255 | "Configuration data for LLDP capabilities"; |
| 256 | } |
| 257 | |
| 258 | grouping lldp-capabilities-state { |
| 259 | description |
| 260 | "Operational state data for LLDP capabilities"; |
| 261 | |
| 262 | leaf name { |
| 263 | type identityref { |
| 264 | base oc-lldp-types:LLDP_SYSTEM_CAPABILITY; |
| 265 | } |
| 266 | description |
| 267 | "Name of the system capability advertised by the neighbor. |
| 268 | Capabilities are represented in a bitmap that defines the |
| 269 | primary functions of the system. The capabilities are |
| 270 | defined in IEEE 802.1AB."; |
| 271 | } |
| 272 | |
| 273 | leaf enabled { |
| 274 | type boolean; |
| 275 | description |
| 276 | "Indicates whether the corresponding system capability is |
| 277 | enabled on the neighbor."; |
| 278 | reference |
| 279 | "Sec 8.5.8.2 of IEEE 802.1AB-2009"; |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | grouping lldp-capabilities-top { |
| 284 | description |
| 285 | "Top-level grouping for LLDP capabilities"; |
| 286 | |
| 287 | container capabilities { |
| 288 | config false; |
| 289 | description |
| 290 | "Enclosing container for list of LLDP capabilities"; |
| 291 | |
| 292 | list capability { |
| 293 | key "name"; |
| 294 | description |
| 295 | "List of LLDP system capabilities advertised by the |
| 296 | neighbor"; |
| 297 | |
| 298 | leaf name { |
| 299 | type leafref { |
| 300 | path "../state/name"; |
| 301 | } |
| 302 | description |
| 303 | "Reference to capabilities list key"; |
| 304 | } |
| 305 | |
| 306 | container config { |
| 307 | description |
| 308 | "Configuration data for LLDP capabilities"; |
| 309 | |
| 310 | uses lldp-capabilities-config; |
| 311 | } |
| 312 | |
| 313 | container state { |
| 314 | |
| 315 | config false; |
| 316 | |
| 317 | description |
| 318 | "Operational state data for LLDP capabilities"; |
| 319 | |
| 320 | uses lldp-capabilities-config; |
| 321 | uses lldp-capabilities-state; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | grouping lldp-custom-tlv-config { |
| 328 | description |
| 329 | "Configuration data for custom LLDP TLVs"; |
| 330 | } |
| 331 | |
| 332 | grouping lldp-custom-tlv-state { |
| 333 | description |
| 334 | "Operational state data for custom LLDP TLVs"; |
| 335 | |
| 336 | leaf type { |
| 337 | type int32; |
| 338 | description |
| 339 | "The integer value identifying the type of information |
| 340 | contained in the value field."; |
| 341 | } |
| 342 | |
| 343 | leaf oui { |
| 344 | type string; |
| 345 | description |
| 346 | "The organizationally unique identifier field shall contain |
| 347 | the organization's OUI as defined in Clause 9 of IEEE Std |
| 348 | 802. The high-order octet is 0 and the low-order 3 octets |
| 349 | are the SMI Network Management Private Enterprise Code of |
| 350 | the Vendor in network byte order, as defined in the |
| 351 | 'Assigned Numbers' RFC [RFC3232]."; |
| 352 | } |
| 353 | |
| 354 | leaf oui-subtype { |
| 355 | type string; |
| 356 | description |
| 357 | "The organizationally defined subtype field shall contain a |
| 358 | unique subtype value assigned by the defining organization."; |
| 359 | } |
| 360 | |
| 361 | // TODO: consider making this string type |
| 362 | leaf value { |
| 363 | type binary; |
| 364 | description |
| 365 | "A variable-length octet-string containing the |
| 366 | instance-specific information for this TLV."; |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | grouping lldp-custom-tlv-top { |
| 371 | description |
| 372 | "Top-level grouping for custom LLDP TLVs"; |
| 373 | |
| 374 | container custom-tlvs { |
| 375 | config false; |
| 376 | description |
| 377 | "Enclosing container for list of custom TLVs from a |
| 378 | neighbor"; |
| 379 | |
| 380 | list tlv { |
| 381 | key "type oui oui-subtype"; |
| 382 | description |
| 383 | "List of custom LLDP TLVs from a neighbor"; |
| 384 | |
| 385 | leaf type { |
| 386 | type leafref { |
| 387 | path "../state/type"; |
| 388 | } |
| 389 | description |
| 390 | "Reference to type list key"; |
| 391 | } |
| 392 | |
| 393 | leaf oui { |
| 394 | type leafref { |
| 395 | path "../state/oui"; |
| 396 | } |
| 397 | description |
| 398 | "Reference to oui list key"; |
| 399 | } |
| 400 | |
| 401 | leaf oui-subtype { |
| 402 | type leafref { |
| 403 | path "../state/oui-subtype"; |
| 404 | } |
| 405 | description |
| 406 | "Reference to oui-subtype list key"; |
| 407 | } |
| 408 | |
| 409 | container config { |
| 410 | description |
| 411 | "Configuration data "; |
| 412 | |
| 413 | uses lldp-custom-tlv-config; |
| 414 | } |
| 415 | |
| 416 | container state { |
| 417 | |
| 418 | config false; |
| 419 | |
| 420 | description |
| 421 | "Operational state data "; |
| 422 | |
| 423 | uses lldp-custom-tlv-config; |
| 424 | uses lldp-custom-tlv-state; |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | grouping lldp-neighbor-top { |
| 431 | description |
| 432 | "Top-level grouping for the LLDP neighbor list"; |
| 433 | |
| 434 | container neighbors { |
| 435 | config false; |
| 436 | description |
| 437 | "Enclosing container for list of LLDP neighbors on an |
| 438 | interface"; |
| 439 | |
| 440 | list neighbor { |
| 441 | key "id"; |
| 442 | description |
| 443 | "List of LLDP neighbors"; |
| 444 | |
| 445 | leaf id { |
| 446 | type leafref { |
| 447 | path "../state/id"; |
| 448 | } |
| 449 | description |
| 450 | " "; |
| 451 | } |
| 452 | |
| 453 | container config { |
| 454 | description |
| 455 | "Configuration data "; |
| 456 | |
| 457 | uses lldp-neighbor-config; |
| 458 | } |
| 459 | |
| 460 | container state { |
| 461 | |
| 462 | config false; |
| 463 | |
| 464 | description |
| 465 | "Operational state data "; |
| 466 | |
| 467 | uses lldp-system-info-config; |
| 468 | uses lldp-system-info-state; |
| 469 | uses lldp-neighbor-config; |
| 470 | uses lldp-neighbor-state; |
| 471 | } |
| 472 | |
| 473 | uses lldp-custom-tlv-top; |
| 474 | uses lldp-capabilities-top; |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | grouping lldp-interface-config { |
| 480 | description |
| 481 | "Configuration data for LLDP on each interface"; |
| 482 | |
| 483 | leaf name { |
| 484 | type oc-if:base-interface-ref; |
| 485 | description |
| 486 | "Reference to the LLDP Ethernet interface"; |
| 487 | } |
| 488 | |
| 489 | leaf enabled { |
| 490 | type boolean; |
| 491 | default "true"; |
| 492 | description |
| 493 | "Enable or disable the LLDP protocol on the interface."; |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | grouping lldp-interface-state { |
| 498 | description |
| 499 | "Operational state data for LLDP on each interface"; |
| 500 | |
| 501 | container counters { |
| 502 | description |
| 503 | "LLDP counters on each interface"; |
| 504 | |
| 505 | uses lldp-interface-counters; |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | grouping lldp-interface-top { |
| 510 | description |
| 511 | "Top-level grouping "; |
| 512 | |
| 513 | container interfaces { |
| 514 | description |
| 515 | "Enclosing container "; |
| 516 | |
| 517 | list interface { |
| 518 | key "name"; |
| 519 | description |
| 520 | "List of interfaces on which LLDP is enabled / available"; |
| 521 | |
| 522 | leaf name { |
| 523 | type leafref { |
| 524 | path "../config/name"; |
| 525 | } |
| 526 | description |
| 527 | "Reference to the list key"; |
| 528 | } |
| 529 | |
| 530 | container config { |
| 531 | description |
| 532 | "Configuration data for LLDP on each interface"; |
| 533 | |
| 534 | uses lldp-interface-config; |
| 535 | } |
| 536 | |
| 537 | container state { |
| 538 | |
| 539 | config false; |
| 540 | |
| 541 | description |
| 542 | "Operational state data "; |
| 543 | |
| 544 | uses lldp-interface-config; |
| 545 | uses lldp-interface-state; |
| 546 | } |
| 547 | |
| 548 | uses lldp-neighbor-top; |
| 549 | } |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | |
| 554 | grouping lldp-config { |
| 555 | description |
| 556 | "Configuration data for global LLDP parameters"; |
| 557 | |
| 558 | leaf enabled { |
| 559 | type boolean; |
| 560 | default "true"; |
| 561 | description |
| 562 | "System level state of the LLDP protocol."; |
| 563 | } |
| 564 | |
| 565 | leaf hello-timer { |
| 566 | type uint64; |
| 567 | units "seconds"; |
| 568 | description |
| 569 | "System level hello timer for the LLDP protocol."; |
| 570 | } |
| 571 | |
| 572 | leaf-list suppress-tlv-advertisement { |
| 573 | type identityref { |
| 574 | base oc-lldp-types:LLDP_TLV; |
| 575 | } |
| 576 | description |
| 577 | "Indicates whether the local system should suppress the |
| 578 | advertisement of particular TLVs with the LLDP PDUs that it |
| 579 | transmits. Where a TLV type is specified within this list, it |
| 580 | should not be included in any LLDP PDU transmitted by the |
| 581 | local agent."; |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | grouping lldp-state { |
| 586 | description |
| 587 | "Operational state data for global LLDP parameters"; |
| 588 | |
| 589 | container counters { |
| 590 | description |
| 591 | "Global LLDP counters"; |
| 592 | |
| 593 | uses lldp-global-counters; |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | grouping lldp-top { |
| 598 | description |
| 599 | "Top-level grouping for LLDP model"; |
| 600 | |
| 601 | container lldp { |
| 602 | description |
| 603 | "Top-level container for LLDP configuration and state data"; |
| 604 | |
| 605 | container config { |
| 606 | description |
| 607 | "Configuration data "; |
| 608 | |
| 609 | uses lldp-config; |
| 610 | uses lldp-system-info-config; |
| 611 | } |
| 612 | |
| 613 | container state { |
| 614 | |
| 615 | config false; |
| 616 | |
| 617 | description |
| 618 | "Operational state data "; |
| 619 | |
| 620 | uses lldp-config; |
| 621 | uses lldp-system-info-config; |
| 622 | uses lldp-system-info-state; |
| 623 | uses lldp-state; |
| 624 | } |
| 625 | |
| 626 | uses lldp-interface-top; |
| 627 | } |
| 628 | } |
| 629 | |
| 630 | // data definition statements |
| 631 | |
| 632 | uses lldp-top; |
| 633 | |
| 634 | |
| 635 | } |