Skip to content
an-telemetry.yang 29.7 KiB
Newer Older
brunnermarcu's avatar
brunnermarcu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728
module an-telemetry {
    yang-version "1.1";
    namespace "urn:an:yang:an-telemetry";

    prefix "an-telemetry";

    import an-inet-types {
        prefix an-inet;
    }
    import an-telemetry-types {
        prefix an-telemetry-types;
    }

    description
        "Data model which creates the configuration for the telemetry
         systems and functions on the device.

         This file is modified from openconfig-telemetry.yang, the original author of openconfig-telemetry.yang is OpenConfig,
         OpenConfig holds the copyright of the original work. openconfig-telemetry.yang is licensed under the Apache License 2.0,
         For details, please refer to https://www.openconfig.net/ and https://github.com/openconfig/public/blob/master/LICENSE";

    revision "2020-09-22";

    grouping telemetry-top {
        description
            "Top level grouping for telemetry configuration and operational
             state data";

        container telemetry-system {
            description
                "Top level configuration and state for the
                 device's telemetry system.";

            container sensor-groups {
                description
                    "Top level container for sensor-groups.";

                list sensor-group {
                    key "sensor-group-id";
                    description
                        "List of telemetry sensory groups on the local
                         system, where a sensor grouping represents a resuable
                         grouping of multiple paths and exclude filters.";

                    leaf sensor-group-id {
                        type leafref {
                            path "../config/sensor-group-id";
                        }
                        description
                            "Reference to the name or identifier of the
                             sensor grouping";
                    }

                    container config {
                        description
                            "Configuration parameters relating to the
                             telemetry sensor grouping";
                        uses telemetry-sensor-group-config;
                    }

                    container state {
                        config false;
                        description
                            "State information relating to the telemetry
                             sensor group";
                        uses telemetry-sensor-group-config;
                    }

                    container sensor-paths {
                        description
                            "Top level container to hold a set of sensor
                             paths grouped together";

                        list sensor-path {
                            key "path";
                            description
                                "List of paths in the model which together
                                 comprise a sensor grouping. Filters for each path
                                 to exclude items are also provided.";

                            leaf path {
                                type leafref {
                                    path "../config/path";
                                }
                                description
                                    "Reference to the path of interest";
                            }

                            container config {
                                description
                                    "Configuration parameters to configure a set
                                     of data model paths as a sensor grouping";
                                uses telemetry-sensor-path-config;
                            }

                            container state {
                                config false;
                                description
                                    "Configuration parameters to configure a set
                                     of data model paths as a sensor grouping";
                                uses telemetry-sensor-path-config;
                            }
                        }
                    }
                }
            }

                container destination-groups {
                    description
                        "Top level container for destination group configuration
                         and state.";

                    list destination-group {
                        key "group-id";
                        description
                            "List of destination-groups. Destination groups allow the
                             reuse of common telemetry destinations across the
                             telemetry configuration. An operator references a
                             set of destinations via the configurable
                             destination-group-identifier.

                             A destination group may contain one or more telemetry
                             destinations";

                        leaf group-id {
                            type leafref {
                                path "../config/group-id";
                            }
                            description
                                "Unique identifier for the destination group";
                        }

                        container config {
                            description
                                "Top level config container for destination groups";
                            leaf group-id {
                                type string;
                                description
                                    "Unique identifier for the destination group";
                            }
                        }

                        container state {
                            config false;
                            description
                                "Top level state container for destination groups";

                            leaf group-id {
                                type string;
                                description
                                    "Unique identifier for destination group";
                            }
                        }

                        container destinations {
                            description
                                "The destination container lists the destination
                                 information such as IP address and port of the
                                 telemetry messages from the network element.";
                            list destination {
                                key "destination-address destination-port";
                                description
                                    "List of telemetry stream destinations";

                                leaf destination-address {
                                    type leafref {
                                        path "../config/destination-address";
                                    }
                                    description
                                        "Reference to the destination address of the
                                         telemetry stream";
                                }

                                leaf destination-port {
                                    type leafref {
                                        path "../config/destination-port";
                                    }
                                    description
                                        "Reference to the port number of the stream
                                         destination";
                                }

                                container config {
                                    description
                                        "Configuration parameters relating to
                                         telemetry destinations";
                                    uses telemetry-stream-destination-config;
                                }

                                container state {
                                    config false;
                                    description
                                        "State information associated with
                                         telemetry destinations";
                                    uses telemetry-stream-destination-config;
                                }
                            }
                        }
                    }
                }

            container subscriptions {
                description
                    "This container holds information for both persistent
                     and dynamic telemetry subscriptions.";

                container persistent-subscriptions {
                    description
                        "This container holds information relating to persistent
                         telemetry subscriptions. A persistent telemetry
                         subscription is configued locally on the device through
                         configuration, and is persistent across device restarts or
                         other redundancy changes.";

                    list persistent-subscription {
                        key "name";
                        description
                            "List of telemetry subscriptions. A telemetry
                             subscription consists of a set of collection
                             destinations, stream attributes, and associated paths to
                             state information in the model (sensor data)";

                        leaf name {
                            type leafref {
                                path "../config/name";
                            }
                            description
                                "Reference to the identifier of the subscription
                                 itself. The id will be the handle to refer to the
                                 subscription once created";
                        }

                        container config {
                            description
                                "Config parameters relating to the telemetry
                                 subscriptions on the local device";

                            uses telemetry-subscription-name-config;
                            uses telemetry-local-source-address-config;
                            uses telemetry-qos-marking-config;
                            uses telemetry-stream-protocol-config;
                            uses telemetry-stream-encoding-config;
                        }

                        container state {
                            config false;
                            description
                                "State parameters relating to the telemetry
                                 subscriptions on the local device";

                            uses telemetry-subscription-name-config;
                            uses telemetry-subscription-config;
                            uses telemetry-subscription-state;
                            uses telemetry-local-source-address-config;
                            uses telemetry-qos-marking-config;
                            uses telemetry-stream-protocol-config;
                            uses telemetry-stream-encoding-config;
                        }

                        container sensor-profiles {
                            description
                                "A sensor profile is a set of sensor groups or
                                 individual sensor paths which are associated with a
                                 telemetry subscription. This is the source of the
                                 telemetry data for the subscription to send to the
                                 defined collectors.";
                            list sensor-profile {
                                key "sensor-group";
                                description
                                    "List of telemetry sensor groups used
                                     in the subscription";

                                leaf sensor-group {
                                    type leafref {
                                        path "../config/sensor-group";
                                    }
                                    description
                                        "Reference to the telemetry sensor group name";
                                }

                                container config {
                                    description
                                        "Configuration parameters related to the sensor
                                         profile for a subscription";
                                    uses telemetry-sensor-profile-config;
                                }

                                container state {
                                    config false;
                                    description
                                        "State information relating to the sensor profile
                                         for a subscription";
                                    uses telemetry-sensor-profile-config;
                                }
                            }
                        }

                        container destination-groups {
                            description
                                "A subscription may specify destination addresses.
                                 If the subscription supplies destination addresses,
                                 the network element will be the initiator of the
                                 telemetry streaming, sending it to the destination(s)
                                 specified.

                                 If the destination set is omitted, the subscription
                                 preconfigures certain elements such as paths and
                                 sample intervals under a specified subscription ID.
                                 In this case, the network element will NOT initiate an
                                 outbound connection for telemetry, but will wait for
                                 an inbound connection from a network management
                                 system.

                                 It is expected that the network management system
                                 connecting to the network element will reference
                                 the preconfigured subscription ID when initiating
                                 a subscription.";

                            list destination-group {
                                key "group-id";
                                description
                                    "Identifier of the previously defined destination
                                     group";

                                leaf group-id {
                                    type leafref {
                                        path "../config/group-id";
                                    }
                                    description
                                        "The destination group id references a configured
                                         group of destinations for the telemetry stream.";
                                }

                                container config {
                                    description
                                    "Configuration parameters related to telemetry
                                     destinations.";

                                    leaf group-id {
                                        type leafref {
                                            path "../../../../../../../destination-groups"
                                                + "/destination-group/group-id";
                                        }
                                        description
                                            "The destination group id references a reusable
                                             group of destination addresses and ports for
                                             the telemetry stream.";
                                    }
                                }

                                container state {
                                    config false;
                                    description
                                    "State information related to telemetry
                                     destinations";

                                    leaf group-id {
                                        type leafref {
                                            path "../../../../../../../destination-groups"
                                                + "/destination-group/group-id";
                                        }
                                        description
                                            "The destination group id references a reusable
                                             group of destination addresses and ports for
                                             the telemetry stream.";
                                    }
                                }
                            }
                        }
                    }
                }

                container dynamic-subscriptions {
                    description
                        "This container holds information relating to dynamic
                         telemetry subscriptions. A dynamic subscription is
                         typically configured through an RPC channel, and does not
                         persist across device restarts, or if the RPC channel is
                         reset or otherwise torn down.";


                    list dynamic-subscription {
                        key "id";

                        config false;
                        description
                            "List representation of telemetry subscriptions that
                             are configured via an inline RPC, otherwise known
                             as dynamic telemetry subscriptions.";

                        leaf id {
                            type leafref {
                                path "../state/id";
                            }

                            description
                                "Reference to the identifier of the subscription
                                 itself. The id will be the handle to refer to the
                                 subscription once created";
                        }

                        container state {
                            config false;
                            description
                                "State information relating to dynamic telemetry
                                 subscriptions.";

                            uses telemetry-subscription-config;
                            uses telemetry-stream-destination-config;
                            uses telemetry-stream-frequency-config;
                            uses telemetry-heartbeat-config;
                            uses telemetry-suppress-redundant-config;
                            uses telemetry-qos-marking-config;
                            uses telemetry-stream-protocol-config;
                            uses telemetry-stream-encoding-config;
                        }

                        container sensor-paths {
                            description
                                "Top level container to hold a set of sensor
                                 paths grouped together";

                            list sensor-path {
                                key "path";
                                description
                                    "List of paths in the model which together
                                     comprise a sensor grouping. Filters for each path
                                     to exclude items are also provided.";

                                leaf path {
                                    type leafref {
                                        path "../state/path";
                                    }
                                    description
                                        "Reference to the path of interest";
                                }

                                container state {
                                    config false;
                                    description
                                        "State information for a dynamic subscription's
                                         paths of interest";
                                    uses telemetry-sensor-path-config;
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    // identity statements

    // typedef statements

    // grouping statements

    grouping telemetry-sensor-path-config {
        description
            "Configuration parameters relating to the
             grouping of data model paths comprising a
             sensor grouping";
            leaf path {
                type string;
                description
                    "Path to a section of operational state of interest
                     (the sensor).";
            }

            leaf exclude-filter {
                type string;
                description
                    "Filter to exclude certain values out of the state
                     values";
                //May not be necessary. Could remove.
            }
    }

    grouping telemetry-heartbeat-config {
        description
            "Configuration parameters relating to the
             heartbeat of the telemetry subscription";
        leaf heartbeat-interval {
            type uint64;
            description
                "Maximum time interval in seconds that may pass
                 between updates from a device to a telemetry collector.
                 If this interval expires, but there is no updated data to
                 send (such as if suppress_updates has been configured), the
                 device must send a telemetry message to the collector.";
        }
    }

    grouping telemetry-suppress-redundant-config {
        description
            "Configuration parameters relating to suppression of
             redundant upstream updates";
        leaf suppress-redundant {
            type boolean;
            description
                "Boolean flag to control suppression of redundant
                 telemetry updates to the collector platform. If this flag is
                 set to TRUE, then the collector will only send an update at
                 the configured interval if a subscribed data value has
                 changed. Otherwise, the device will not send an update to
                 the collector until expiration of the heartbeat interval.";
        }
    }

    grouping telemetry-sensor-profile-config {
        description
            "Configuration parameters relating to the sensor groups
             used in the sensor profile";
        leaf sensor-group {
            type leafref {
                path "../../../../../../../sensor-groups/sensor-group"
                + "/config/sensor-group-id";
            }
            description
                "Reference to the sensor group which is used in the profile";
        }
        uses telemetry-stream-subscription-config;
    }

    grouping telemetry-stream-subscription-config {
        description
            "Configuration used when the sensor is a stream based sensor.";

        uses telemetry-stream-frequency-config;
        uses telemetry-heartbeat-config;
        uses telemetry-suppress-redundant-config;

    }

    grouping telemetry-qos-marking-config {
        description
            "Config parameters relating to the quality of service
             marking on device generated telemetry packets";

        leaf originated-qos-marking {
            type an-inet:dscp;
            description
                "DSCP marking of packets generated by the telemetry
                 subsystem on the network device.";
        }
    }


    grouping telemetry-sensor-group-config {
        description
            "Config parameters related to the sensor groups
             on the device";
        leaf sensor-group-id {
            type string;
            description
                "Name or identifier for the sensor group itself.
                 Will be referenced by other configuration specifying a
                 sensor group";
        }
    }

    grouping telemetry-subscription-config {
        description
            "Configuration parameters relating to the telemetry
             subscription";

        leaf id {
            type uint64;
            description
                "System generated identifer of the telemetry
                 subscription.";
        }
    }

    grouping telemetry-subscription-name-config {
        description
            "Configuration parameters relating to the configured
             name of the telemetry subscription. The name is a user
             configured string value which uniquely identifies the
             subscription in the configuration database.";

         leaf name {
             type string;
             description
                "User configured identifier of the telemetry
                 subscription. This value is used primarily for
                 subscriptions configured locally on the network
                 element.";
         }
    }

    grouping telemetry-subscription-state {
        description
            "State values for the telemetry subscription";
        //TODO add values
    }

    grouping telemetry-stream-protocol-config {
        description
            "Configuration parameters relating to the
             transport protocol carrying telemetry
             data.";

        leaf protocol {
            type identityref {
                base an-telemetry-types:STREAM_PROTOCOL;
            }
            description
                "Selection of the transport protocol for the telemetry
                 stream.";
        }
    }

    grouping telemetry-stream-encoding-config {
        description
            "Configuration parameters relating to the
             encoding of telemetry data to and from the
             network element. The encoding method controls
             specifically the wire format of the telemetry
             data, and also controls which RPC framework
             may be in use to exchange telemetry data.";

         leaf encoding {
             type identityref {
                 base an-telemetry-types:DATA_ENCODING_METHOD;
             }
             description
                "Selection of the specific encoding or RPC framework
                 for telemetry messages to and from the network element.";
         }
    }

    grouping telemetry-stream-destination-config {
        description
            "Configuration parameters for the stream destinations";
            leaf destination-address {
                type an-inet:ip-address;
                description
                    "IP address of the telemetry stream destination";
            }
            leaf destination-port {
                type uint16;
                description
                    "Protocol (udp or tcp) port number for the telemetry
                     stream destination";
            }
    }

    grouping telemetry-stream-frequency-config {
        description
            "Config parameters for the frequency of updates to
             the collector";
        leaf sample-interval {
            type uint64;
            description
                " The accuracy of the collected data reported by the device
to the collector";
        }
    }

    grouping telemetry-sensor-specification {
        description
            "Config related to creating telemetry sensor groups. A sensor
             group is a related set of sensor paths and/or filters to
             exclude items. A group is assigned a reusable identifer, so
             it can be used in multiple telemetry subscriptions.";
        list telemetry-sensor-group {
            key "telemetry-sensor-group-id";
            description
                "List of telemetry sensor groups";

            leaf telemetry-sensor-group-id {
                type string;
                description
                    "The sensor group identifer is a reusable handle which
                     identifies a single sensor group. It is referenced from
                     the subscription configuration.";
            }
            uses telemetry-sensor-paths;
        }
    }

    grouping telemetry-sensor-paths {
        description
            "This grouping contains these paths to leaves or containers
             in the data model which are the sources of telemetry
             information.";

        list telemetry-sensor-paths {
            key "telemetry-sensor-path";
            description
                "A list of sensor paths and exclude filters which comprise
                 a sensor grouping";

            leaf telemetry-sensor-path {
                type string;
                description
                    "The sensor path is a path to a portion of operational
                     state of interest in the data model";
            }
        }
    }


    grouping telemetry-local-source-address-config {
        description
            "Config relating to the local source address for telemetry
             messages";
        // TODO: Make this a reference to an interface.
        leaf local-source-address {
            type an-inet:ip-address;
            description
                "The IP address which will be the source of packets from
                 the device to a telemetry collector destination.";
        }
    }

    // data definition statements

    uses telemetry-top;

    // augment statements

    // rpc statements

    // notification statements
}