Tutorial 8: Network Telemetry, YANG, gNMI, and Model‑Driven Management

COMP347 Unit 8 – Network Management and Network Operations

Table of Contents

Learning Objectives

After completing this extended tutorial, you should be able to:

Overview

Network telemetry is the practice of continuously collecting high‑frequency, structured data from network devices, enabling real‑time monitoring, analytics, and automation. Unlike the traditional SNMP polling model (pull‑based, low‑frequency, and limited data), modern telemetry uses a push model with rich data models (YANG) and efficient protocols like gRPC and gNMI. This tutorial provides a comprehensive, in‑depth exploration of network telemetry, YANG, and model‑driven management.

We begin by defining telemetry and its key drivers: the need for higher frequency, richer data, and scalability. We then delve into the YANG data modeling language, its syntax, and how it represents configuration and operational state. The gNMI (gRPC Network Management Interface) protocol is examined in detail, covering its operations (Capabilities, Get, Set, Subscribe) and its use of gRPC for efficient, bi‑directional streaming. We contrast telemetry with SNMP, highlighting the architectural and functional differences. The tutorial also covers telemetry data pipelines, the OpenConfig initiative, security considerations, and practical deployment strategies. Case studies illustrate telemetry in large‑scale networks.

Technical and Theoretical Content

1. Introduction to Network Telemetry

Network telemetry refers to the automated, high‑frequency collection of data from network devices to enable real‑time monitoring, analytics, and automation. It is driven by the need for:

Telemetry is typically push‑based: devices stream data to a collector without being polled, reducing overhead and enabling higher frequencies.

2. YANG Data Modeling Language

YANG (Yet Another Next Generation) is a data modeling language used to model configuration and state data for network devices. It was defined in RFC 6020 (updated by RFC 7950). YANG models are hierarchical and can represent:

YANG syntax uses containers, lists, leafs, and leaf‑lists. It supports data types like integer, string, enumeration, and more complex ones like union and leafref.

Example YANG snippet:

container interfaces {
    list interface {
        key "name";
        leaf name { type string; }
        leaf enabled { type boolean; }
        leaf ip-address { type inet:ipv4-address; }
        container state {
            config false;
            leaf oper-status { type enumeration { enum up; enum down; } }
            leaf in-octets { type yang:counter64; }
        }
    }
}
        

YANG modules are used by protocols like NETCONF and RESTCONF, and also form the basis for gNMI telemetry.

3. gNMI: gRPC Network Management Interface

gNMI (gRPC Network Management Interface) is a modern, protocol‑buffers‑based management protocol defined by the OpenConfig working group. It uses gRPC (high‑performance RPC framework) and provides:

gNMI messages are encoded in Protocol Buffers (protobuf) over HTTP/2, providing high efficiency, multiplexing, and flow control.

Subscription types:

Paths in gNMI are defined using XPath‑like notation (e.g., /interfaces/interface[name='eth0']/state/oper-status).

4. Model‑Driven Telemetry and Streaming

Model‑driven telemetry leverages YANG models to define the data to be streamed. Devices export data based on the model, and collectors interpret the data using the same model. This ensures consistency and reduces integration effort.

Streaming telemetry typically involves:

Advantages: lower latency, higher throughput, and richer data compared to SNMP polling.

5. Telemetry vs. SNMP: A Comparative Analysis

AspectSNMP (v2c/v3)gNMI/Telemetry
Data ModelSMI/MIB (flat, ASN.1)YANG (hierarchical, rich)
TransportUDP (mostly)gRPC/HTTP2 (TCP)
EncodingBERProtocol Buffers or JSON
CommunicationPull (polling)Push (streaming) and Pull
FrequencyTypical 1‑5 minSub‑second to minutes
Data RichnessLimited (scalars, tables)Hierarchical, complex data
SecurityCommunity strings or USMTLS + mTLS, OAuth
ConfigurationSET operation (limited)Full configuration via Set (with transactional semantics)
StandardizationIETF (mature)OpenConfig, IETF (growing)

While SNMP remains widely deployed, telemetry is increasingly favored for modern, large‑scale, and automated networks.

6. Telemetry Data Pipelines and Processing

A telemetry pipeline consists of:

Considerations: data volume, latency, retention, and the need for downsampling.

7. OpenConfig and Native YANG Models

OpenConfig is a vendor‑neutral initiative that provides standard YANG models for common network functions (interfaces, BGP, routing, etc.). Using OpenConfig models enables multi‑vendor interoperability and reduces operational complexity. Many devices support both OpenConfig and vendor‑native models.

8. Security and Access Control in gNMI

gNMI uses TLS for encryption. Authentication can be through certificates (mTLS) or username/password over TLS. Authorization is typically handled by the device based on the authenticated user and role‑based access control (RBAC) to specific YANG paths. gNMI also supports secure channels for sensitive configuration operations.

9. Operational Considerations and Best Practices

10. Case Studies

Quiz (42 Questions)

All answers are hidden; click Show Answer to reveal.

Question 1:

Define network telemetry and list its key drivers.

Show Answer
Network telemetry is the automated, high‑frequency collection of structured data from network devices. Drivers: higher frequency, richer data, scalability, and automation.
Question 2:

What is YANG and what is its purpose?

Show Answer
YANG is a data modeling language used to model configuration and state data for network devices, enabling programmability and consistent data representation.
Question 3:

List the four main gNMI operations.

Show Answer
Capabilities, Get, Set, Subscribe.
Question 4:

What transport protocol does gNMI use?

Show Answer
gRPC over HTTP/2 (TCP).
Question 5:

What are the three subscription modes in gNMI?

Show Answer
STREAM, POLL, ONCE.
Question 6:

Explain the difference between a pull‑based and push‑based monitoring model.

Show Answer
Pull: manager requests data (polling). Push: device sends data without being asked (streaming).
Question 7:

What is the advantage of push‑based telemetry over polling?

Show Answer
Higher frequency, lower overhead, and more timely delivery.
Question 8:

What is the role of Protocol Buffers in gNMI?

Show Answer
They provide efficient, language‑agnostic serialization of gNMI messages.
Question 9:

What is a YANG container? Provide an example.

Show Answer
A container is a grouping of related YANG nodes, analogous to a directory. Example: container interfaces { ... }.
Question 10:

How does gNMI handle configuration changes?

Show Answer
Through the Set operation, which can replace, update, or delete configuration data.
Question 11:

What is the OpenConfig initiative?

Show Answer
A vendor‑neutral effort to create standard YANG models for common networking functions, enabling interoperability.
Question 12:

Compare the data models used by SNMP and gNMI.

Show Answer
SNMP uses SMI/MIB (flat, scalar/table); gNMI uses YANG (hierarchical, rich).
Question 13:

What is the purpose of the Capabilities operation in gNMI?

Show Answer
To discover the YANG models and features supported by a device.
Question 14:

How can you secure gNMI communications?

Show Answer
Using TLS with certificate‑based authentication (mTLS) and optionally username/password over TLS.
Question 15:

What is a subscription in gNMI? Give an example.

Show Answer
A subscription defines the data to be streamed (paths) and the update mode. Example: subscribe to interface state every 10 seconds.
Question 16:

Explain the concept of "on‑change" telemetry.

Show Answer
Data is sent only when a value changes, reducing bandwidth and focusing on relevant events.
Question 17:

What is a data pipeline in telemetry context?

Show Answer
A sequence of processes that ingest, transform, store, and analyse telemetry data.
Question 18:

Why might a network operator choose telemetry over SNMP?

Show Answer
For higher frequency, richer data, and better scalability.
Question 19:

What is the role of a message broker (e.g., Kafka) in a telemetry pipeline?

Show Answer
To decouple data producers from consumers, buffer data, and enable reliable processing.
Question 20:

What are the key differences between YANG and SMI (used by SNMP)?

Show Answer
YANG is hierarchical, more expressive, and supports configuration and state; SMI is flat, limited to simple tables, and primarily for monitoring.
Question 21:

How does gNMI support notifications?

Show Answer
Through the Subscribe operation, which can stream updates as notifications.
Question 22:

What is the purpose of the config false statement in YANG?

Show Answer
It indicates that the node represents operational state (read‑only), not configuration.
Question 23:

What is a "leaf‑list" in YANG?

Show Answer
A list of values (like a list of IP addresses) without a key.
Question 24:

Explain the difference between a YANG list and a container.

Show Answer
A list has multiple entries indexed by a key; a container is a single grouping.
Question 25:

How does gNMI ensure reliable delivery of telemetry data?

Show Answer
gRPC uses TCP, and the stream can include heartbeats and retransmissions.
Question 26:

What is the role of YANG modules in model‑driven management?

Show Answer
They define the structure of configuration and operational data, enabling programmatic access and consistency.
Question 27:

What are the typical output formats of gNMI?

Show Answer
Protocol Buffers (binary) or JSON.
Question 28:

Why is it beneficial to use OpenConfig models instead of vendor‑specific models?

Show Answer
For multi‑vendor interoperability, reducing complexity and operational costs.
Question 29:

What is a "path" in gNMI?

Show Answer
An XPath‑like identifier that references a specific YANG node (e.g., /interfaces/interface[name='eth0']/state/oper-status).
Question 30:

What is the purpose of the Get operation in gNMI?

Show Answer
To retrieve configuration or state data for a given path.
Question 31:

Explain the difference between "periodic" and "on‑change" streaming.

Show Answer
Periodic: data sent at fixed intervals. On‑change: data sent only when a value changes.
Question 32:

What is the significance of the "sample interval" in telemetry subscriptions?

Show Answer
It determines how often data is sampled and sent, affecting granularity and bandwidth.
Question 33:

How does telemetry help in capacity planning?

Show Answer
By providing high‑frequency data on utilisation, enabling accurate trend analysis and forecasting.
Question 34:

What is the role of a "collector" in a telemetry system?

Show Answer
A collector receives telemetry streams, decodes them, and forwards them for storage or analysis.
Question 35:

How does gNMI support batch updates?

Show Answer
Through the Set operation with multiple updates or replace operations in one RPC.
Question 36:

What is the difference between a YANG "choice" and "case"?

Show Answer
Choice allows selection among multiple alternatives; case groups the nodes for a given alternative.
Question 37:

Why is it important to standardize on a few YANG models in an organization?

Show Answer
To simplify integration, reduce training, and avoid fragmentation.
Question 38:

What is the role of the gNMI "heartbeat" mechanism?

Show Answer
To keep the gRPC stream alive and detect disconnections.
Question 39:

How can you test a gNMI connection to a device?

Show Answer
Use the gnmic CLI tool to perform a Capabilities or Get request.
Question 40:

What is the relationship between gNMI and NETCONF?

Show Answer
Both use YANG models, but gNMI uses gRPC (HTTP/2) and is designed for telemetry, while NETCONF uses SSH and is focused on configuration.
Question 41:

Explain the concept of "model‑driven" telemetry.

Show Answer
Data is structured according to YANG models, ensuring consistent interpretation and enabling automation.
Question 42:

What are the common challenges in deploying telemetry at scale?

Show Answer
Device CPU/bandwidth capacity, collector scalability, data storage volume, and managing subscriptions.

Exercises (20 Applied Problems)

Sample solutions are hidden – click to reveal.

Exercise 1:

Write a YANG module snippet that models a network interface with the following: name (string), enabled (boolean), speed (integer), and operational status (enum: up/down).

Show Sample Solution
container interface {
    leaf name { type string; }
    leaf enabled { type boolean; }
    leaf speed { type uint64; }
    leaf oper-status {
        type enumeration { enum up; enum down; }
    }
}
            
Exercise 2:

Using gNMI, how would you subscribe to the operational status of all interfaces on a router, with updates every 10 seconds?

Show Sample Solution
Create a subscription with path /interfaces/interface/state/oper-status, mode STREAM, sample interval 10 seconds.
Exercise 3:

Compare the data retrieval mechanisms: SNMP GET vs. gNMI Get. What are the key differences in the response format and data richness?

Show Sample Solution
SNMP returns BER‑encoded values with limited metadata; gNMI returns structured data (GPB/JSON) with full path and model context, richer hierarchy.
Exercise 4:

You want to collect interface counters (in/out octets) every 5 seconds from 1000 routers. Which approach would you choose: SNMP polling or gNMI streaming? Justify.

Show Sample Solution
gNMI streaming is better because it reduces polling overhead (push) and supports higher frequency with less device load.
Exercise 5:

Design a telemetry data pipeline for a service provider with 5000 devices. Include ingestion, buffering, processing, storage, and visualization components.

Show Sample Solution
Collectors (gnmi clients) → Kafka (buffering) → Flink (real‑time aggregation) → Prometheus/InfluxDB (storage) → Grafana (visualization). Also include alerting.
Exercise 6:

What are the trade‑offs between using periodic telemetry and on‑change telemetry for monitoring BGP state?

Show Sample Solution
Periodic: constant updates, simpler; on‑change: event‑driven, reduces bandwidth, but may miss changes if not triggered. For BGP, on‑change is often preferred to catch changes quickly.
Exercise 7:

Explain how gNMI's Subscribe operation can be used for both telemetry and event notifications.

Show Sample Solution
Subscribe with mode STREAM and on‑change updates; the device sends notifications when data changes, serving as event notifications.
Exercise 8:

You have a device that supports OpenConfig and native YANG models. Which would you prefer for your management system and why?

Show Sample Solution
Prefer OpenConfig for vendor neutrality and interoperability, unless native models expose unique features.
Exercise 9:

Describe the steps to secure a gNMI connection between a collector and a network device.

Show Sample Solution
Use TLS (certificate validation), configure mTLS with client and server certificates, and implement role‑based access control on the device to limit paths.
Exercise 10:

What is the impact of increasing the sampling frequency in a telemetry subscription on device resources and network bandwidth?

Show Sample Solution
Higher frequency increases CPU usage (data gathering) and network bandwidth, but provides finer granularity; requires monitoring to avoid overloading.
Exercise 11:

Write a gNMI Set request (in JSON format) to update the hostname of a device to "router-core-01".

Show Sample Solution
{
    "update": [
        {
            "path": "/system/config/hostname",
            "val": "router-core-01"
        }
    ]
}
            
Exercise 12:

How would you use gNMI's Get operation to retrieve the current operational status of a specific interface?

Show Sample Solution
Send a Get request with path /interfaces/interface[name='eth0']/state/oper-status.
Exercise 13:

Explain the role of a YANG "leafref" and provide an example.

Show Sample Solution
A leafref references a leaf value elsewhere in the model, ensuring consistency. Example: leaf interface-name { type leafref { path "/interfaces/interface/name"; } }.
Exercise 14:

You are migrating from SNMP to gNMI. What are the main challenges you might face?

Show Sample Solution
Device support for gNMI, model differences (YANG vs. MIB), tooling integration, and operator retraining.
Exercise 15:

What is the difference between a YANG list and a YANG container? Provide a use case for each.

Show Sample Solution
List: multiple entries with keys (e.g., interfaces). Container: single grouping (e.g., system parameters).
Exercise 16:

Explain the concept of "model‑driven" telemetry and its benefits for automation.

Show Sample Solution
Data is structured according to models, enabling consistent parsing and allowing automated workflows to interpret and act on data without custom parsing.
Exercise 17:

How can you validate that a gNMI subscription is working correctly?

Show Sample Solution
Use a collector to subscribe and log the received data; check for updates at the expected frequency or on changes.
Exercise 18:

What are the considerations when storing telemetry data in a time‑series database?

Show Sample Solution
Schema design (tag vs. field), retention policies, downsampling, and indexing for fast queries.
Exercise 19:

Describe a scenario where you would use the POLL subscription mode in gNMI instead of STREAM.

Show Sample Solution
When you need on‑demand data (e.g., during troubleshooting) and don't want continuous updates.
Exercise 20:

How can gNMI support configuration rollback if a Set operation fails?

Show Sample Solution
gNMI Set does not inherently support rollback; but you can implement a candidate configuration model or use NETCONF for transactional semantics.

Homework (16 In‑Depth Assignments)

Sample answers are hidden; use them to guide your study.

Homework 1:

Write a detailed analysis of the YANG data modeling language, including its structure, data types, and the differences between configuration and state data. Compare it with ASN.1/SMI used in SNMP.

Show Sample Answer

YANG is hierarchical, with containers, lists, leafs. It supports types like int64, string, enumeration, and complex constraints. Configuration is writable, state is read‑only. ASN.1/SMI is flat, less expressive, and primarily for monitoring. YANG also supports RPCs and notifications.

Homework 2:

Design a comprehensive telemetry collection strategy for a large data center network with 2000 switches and routers. Include subscription definition, collector architecture, and data processing.

Show Sample Solution

Use OpenConfig models for common data. Set up a cluster of gNMI collectors, each handling a subset of devices. Stream data via gRPC to Kafka. Use Flink for real‑time analytics. Store metrics in Prometheus and logs in Elasticsearch. Implement dashboards with Grafana.

Homework 3:

Explain the role of gRPC and Protocol Buffers in gNMI. How do they contribute to performance and interoperability?

Show Sample Answer

gRPC provides efficient, multiplexed RPC over HTTP/2, enabling bi‑directional streaming. Protocol Buffers offer compact, language‑agnostic serialization, reducing bandwidth and ensuring cross‑platform support.

Homework 4:

Compare and contrast the security models of SNMPv3 and gNMI. Which one is more suitable for modern cloud environments?

Show Sample Answer

SNMPv3 uses USM (keys) and VACM, while gNMI uses TLS/mTLS and RBAC. gNMI is more aligned with modern security practices (certificates, OAuth) and integrates better with cloud IAM.

Homework 5:

Research the OpenConfig YANG models and select three common models (e.g., interfaces, BGP, routing). Describe their structure and key data nodes.

Show Sample Answer

Interfaces model: container interfaces with list interface, leafs for name, config, and state. BGP model: container bgp with global, neighbors. Routing model: lists for routes. Each provides standardized representation.

Homework 6:

Explain the concept of "model‑driven" telemetry and how it improves operational efficiency compared to ad‑hoc telemetry.

Show Sample Answer

Model‑driven telemetry uses predefined YANG models, ensuring consistency across devices. It reduces integration effort, enables automated analytics, and supports multi‑vendor environments.

Homework 7:

Write a guide on setting up a gNMI subscription for a Cisco IOS‑XE device using the OpenConfig models. Include configuration steps and verification commands.

Show Sample Solution

Enable gRPC/gNMI on device. Configure subscriptions via CLI or YANG. Use gnmic to subscribe. Verify with show commands for telemetry statistics.

Homework 8:

Discuss the challenges of processing high‑volume telemetry data in real time. How can you design a scalable pipeline?

Show Sample Solution

Challenges: data volume, latency, and state management. Use distributed stream processing (Flink, Kafka Streams), partition data by device, and use windowing for aggregations. Use auto‑scaling.

Homework 9:

Explain how gNMI supports both configuration and telemetry operations in a single protocol. Why is this beneficial?

Show Sample Solution

gNMI provides Get/Set for config and Subscribe for telemetry, unifying management. This reduces the number of protocols and tools needed, and allows correlation between configuration changes and resulting state.

Homework 10:

Compare the performance of SNMP polling vs. gNMI streaming for collecting interface counters from 100 devices. Quantify the differences in network load and latency.

Show Sample Solution

SNMP polling with 100 devices and 10 OIDs each at 1 min interval generates hundreds of requests/sec. gNMI streaming sends batched updates at configurable intervals, reducing overhead. Latency is lower because data is pushed immediately.

Homework 11:

Discuss the role of YANG in automating network operations. How does it enable intent‑based networking?

Show Sample Solution

YANG provides a structured data model for configuration and state. Automation tools can use YANG‑defined APIs to push configurations and verify compliance, enabling intent‑based systems to translate policies into device configurations.

Homework 12:

Design a telemetry alerting rule to detect interface flapping (operational status toggling) using streaming data. Specify the detection logic and the actions.

Show Sample Solution

Monitor oper‑status changes; if toggles more than 3 times within 5 minutes, trigger alert. Action: send notification to network team with interface details.

Homework 13:

Research the differences between gNMI and RESTCONF for configuration management. When would you choose one over the other?

Show Sample Solution

gNMI uses gRPC (binary, streaming) for high performance; RESTCONF uses HTTP/JSON and is simpler for web‑based integrations. Choose gNMI for telemetry and large‑scale config; RESTCONF for lightweight, RESTful use cases.

Homework 14:

Explain the concept of a "candidate" configuration in YANG and how it relates to gNMI Set operations.

Show Sample Answer

A candidate configuration is a proposed set of changes that can be validated before applying. gNMI Set does not explicitly support candidate, but devices may implement their own candidate models; NETCONF is more traditionally used for this.

Homework 15:

Write a research paper on the evolution of network management from SNMP to gNMI and YANG, highlighting the drivers, benefits, and challenges.

Show Sample Answer

Cover: scalability, speed, automation needs. gNMI and YANG address limitations of SNMP (polling, data modeling, security). Challenges: adoption, vendor support, migration costs.

Homework 16:

Analyze a case study of a large cloud provider that uses telemetry for network management. What metrics do they collect, and how do they use the data for automation?

Show Sample Solution

Example: Google's network uses telemetry for real‑time congestion control, predictive maintenance, and capacity planning. They collect flow data, interface counters, and routing changes to drive automated rerouting.

Summary

This extended tutorial has provided a comprehensive exploration of network telemetry, YANG, gNMI, and model‑driven management. We covered the foundational concepts of telemetry, the YANG data modeling language, and the gNMI protocol with its operations and subscription models. A detailed comparison with SNMP highlighted the advantages of telemetry in terms of frequency, data richness, and scalability. We also examined telemetry data pipelines, OpenConfig models, security considerations, and operational best practices.

The quiz, exercises, and homework assignments are designed to reinforce understanding and develop practical skills for deploying and managing telemetry systems. As networks evolve towards automation and intent‑based operations, telemetry and YANG play a pivotal role in providing the high‑quality data needed for closed‑loop control and predictive analytics. The next tutorial will explore Configuration Management and Change Control, focusing on maintaining consistent device configurations.

COMP347 Unit 8 – Extended Tutorial 8 • TrustOpen University • Last updated: August 2026