YANG Data Models for NetFlow and sFlow

In this section, you'll learn to use the YANG data models to configure and retrieve the operational status of NetFlow and sFlow on Cisco 8000 Series Routers.

What You'll Find in This Section

Cisco IOS XR supports configuring NetFlow and sFlow using both traditional Command Line Interface (CLI) using commands as well as programmatically using YANG data models. In this section, you'll find references to supported YANG data models and an understanding about accessing and using these data models.

To get started with using these data models, see:

List of YANG Data Models for NetFlow and sFlow

Here is a list of YANG data models that you can use to configure and manage NetFlow and sFlow on the router:

Table 1. NetFlow and sFlow YANG Data Models

Cisco IOS XR Native Data Model

Unified Data Model

OpenConfig Data Model

Cisco-IOS-XR-traffmon-netflow-cfg

Cisco-IOS-XR-um-8000-hw-

module-profile-netflow-cfg

openconfig-sampling-sflow.yang

Cisco-IOS-XR-ofa-netflow-oper

Cisco-IOS-XR-um-flow-cfg


Note


We recommend using Unified Data Models over Native Data Models


You can access the data models using one of these following options:

Access Data Models

You can access the data models using one of these following options:

Access Data Models From Router

To access data models directly from the router, you can follow these steps:

Procedure


Step 1

Enter the global configuration mode.

Example:

Router#configure

Step 2

Configure the NETCONF network management protocol to remotely configure and manage the router using YANG data models.

Example:

Router(config)#netconf-yang agent ssh

Step 3

Commit the configuration.

Example:

Router(config)#commit

Step 4

Establish a NETCONF session with the device and retrieve the capabilities information.

Example:

Router#show netconf-yang capabilities
Tue Sep 19 22:03:26.305 UTC
[Netconf capabilities]

   D: Has deviations

 Capability                                                                       | Revision |D
----------------------------------------------------------------------------------+----------+-
urn:ietf:params:netconf:base:1.1                                                  | -        | 
urn:ietf:params:netconf:capability:candidate:1.0                                  | -        | 
urn:ietf:params:netconf:capability:confirmed-commit:1.1                           | -        | 
urn:ietf:params:netconf:capability:interleave:1.0                                 | -        | 
urn:ietf:params:netconf:capability:notification:1.0                               | -        | 
urn:ietf:params:netconf:capability:rollback-on-error:1.0                          | -        | 
urn:ietf:params:netconf:capability:validate:1.1                                   | -        | 
http://cisco.com/ns/yang/Cisco-IOS-XR-8000-fib-platform-cfg                       |2019-04-05| 
http://cisco.com/ns/yang/Cisco-IOS-XR-8000-lpts-oper                              |2022-05-05| 
http://cisco.com/ns/yang/Cisco-IOS-XR-8000-platforms-npu-resources-oper           |2020-10-07| 
http://cisco.com/ns/yang/Cisco-IOS-XR-8000-qos-oper                               |2021-06-28| 
http://cisco.com/ns/yang/Cisco-IOS-XR-Ethernet-SPAN-act                           |2021-03-22| 
http://cisco.com/ns/yang/Cisco-IOS-XR-Ethernet-SPAN-cfg                           |2022-07-13| 
http://cisco.com/ns/yang/Cisco-IOS-XR-Ethernet-SPAN-datatypes                     |2021-10-06| 
http://cisco.com/ns/yang/Cisco-IOS-XR-Ethernet-SPAN-oper                          |2022-09-05| 
http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-aaacore-cfg                             |2019-04-05| 
http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-ldapd-cfg                               |2022-06-22| 
http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-ldapd-oper                              |2022-05-20| 
http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-lib-cfg                                 |2020-10-22| 
http://cisco.com/ns/yang/Cisco-IOS-XR-aaa-lib-datatypes 
----------------------------------   Truncated for brevity  --------------------------------------

By examining the capabilities, you can view the available data models for the software version installed on the router.


Access Data Models From Cisco Feature Navigator

To access data models from Cisco Feature Navigator, you can follow these steps:

Procedure


Step 1

Go to Cisco Feature Navigator.

Step 2

If you have a Cisco.com account, click on the Login button and enter your credentials. If you don't have an account, you can click Continue as Guest .

You will be directed to the Cisco Feature Navigator main page.

Step 3

Click YANG Data Models .

Step 4

Select the Product and Cisco IOS XR Release based on your requirement.

The data models are listed based on type—Cisco XR native models, Unified models and OpenConfig models.

You can use the search field to search for specific data model of interest.

Step 5

Click the specific data model of interest to view more details.

The data model is displayed in a hierarchical tree structure making it easier to navigate and understand the relationships between different YANG modules, containers, leaves and leaf lists. You can apply filters to further narrow down the data model definitions for the selected platform and release based on status such as deprecated, obsolete and unsupported nodes.

You can also click the Download icon to export the data model information in Excel format.

This visual tree form helps you get insights into the nodes that you can use to automate your network.

The data models on Cisco Feature Navigator is regularly updated based on IOS XR release. If you encounter any problem or have suggestions for improvements, share your experience using Send us your feedback link.


Access Data Models From GitHub

To access the data models from GitHub repository, you can follow these steps:

Procedure


Step 1

Go to the GitHub repository for data models.

On the repository page, you will find a list of folders based on IOS XR releases.

Step 2

Navigate to the release folder of interest to view the list of supported data models and their definitions. For example, if you want to access the data models for IOS XR release 7.10.1, click on the folder named 7.10.1.

Inside the folder, you will find a list of YANG files representing different data models.

Step 3

Click on the YANG file you want to access to view its contents.

You can also click on the Raw button to see the raw code or use the Download button to download the file to your computer.

Each data model defines a complete and cohesive model, or augments an existing data model with additional XPaths. To view a comprehensive list of the data models supported in a release, navigate to the Available-Content.md file in the repository. The unsupported sensor paths are documented as deviations. For example, openconfig-acl.yang provides details about the supported sensor paths, whereas cisco-xr-openconfig-acl-deviations.yang shows the unsupported sensor paths for openconfig-acl.yang model.

Step 4

Repeat the above steps for other versions or data models of interest.

The GitHub repository for IOS XR data models is regularly updated based on release. You can also contribute to the repository by submitting pull requests, opening issues if you encounter any problems or have suggestions for improvements.


Get Started With IOS XR YANG Data Models

Here is a generic outline of the steps involved in programmatically configuring your router using YANG data models:

  1. Enable network management protocol—Manage the router remotely using the protocols such as NETCONF or gRPC.

  2. Install the necessary libraries and tools—Depending on the programming language you are using, you may need to install libraries or tools to programatically interact with the router. For example, if you are using Python, you might need to install the ncclient library.

  3. Establish a session with the router—Use the programming language of your choice to establish a connection to the router using NETCONF or gRPC protocols. This involves providing connection parameters such as device IP address, username, password, and port number.

  4. Retrieve the router capabilities—View the supported features and functionalities available on the router.

  5. Create or modify configurations—Use YANG data models to create or modify the configuration on the router.

  6. Apply the configuration—Push the updated configuration via the NETCONF or gRPC protocol to modify the router's running configuration to reflect the desired changes.

  7. Validate the configuration—Verify that the changes are successfully applied. You can retrieve the running configuration or specific configuration parameters to ensure that the device is configured as intended.

For detailed instructions about using the data models, refer the Programmability Configuration Guide for Cisco 8000 Series Routers.