YANG data models

SR Linux supports YANG data models for configuring the network element. YANG is a standards-based, data-modelling language defined in several IETF RFCs. The SR Linux model-driven management interfaces are based on a common infrastructure that uses YANG models as the core definition for network element configuration, state, and operational actions. The model-driven interfaces (SR Linux CLI, gRPC server) take the underlying YANG modules and render them for the particular management interface.

SR Linux supports the following YANG data models:

  • Nokia vendor-specific data models
  • OpenConfig vendor-neutral data models

This chapter describes how SR Linux implements OpenConfig YANG data models and manages interactions with the Nokia YANG data models.

SR Linux data models

SR Linux makes extensive use of structured YANG data models to provide network operators with a single set of data models to configure and manage commonly-used network protocols, services, and devices. Each application that SR Linux supports has a Nokia vendor-specific YANG model that defines the application's configuration and state.

SR Linux exposes the YANG models to supported management APIs; for example, the CLI command tree is derived from the SR Linux YANG models loaded into the system. A gNMI client can use Set RPCs to configure an application based on the YANG model.

When you commit a configuration, the SR Linux management server validates the YANG models and translates them into protocol buffers for the impart database (IDB).

OpenConfig data models

OpenConfig is an informal working group that provides structured, vendor-neutral YANG data models to address the use requirements of networking applications and technologies by the community. OpenConfig data models support configuration and management of multivendor networks. They use standards-based, YANG data-modeling language, support Remote Procedure Calls (RPCs), and allow network operators to use a single set of data models to configure and manage commonly-used network protocols, services, and devices that support the OpenConfig initiative.

Implementation in SR Linux

SR Linux supports OpenConfig YANG data models for configuring and managing network elements. You can use the OpenConfig data models together with the SR Linux data models to configure network elements, using a CLI console or SSH connection or management-interface RPCs (gNMI) for communications between the clients and routers.

The SR Linux and OpenConfig data models are implemented through the management server binary. The SR Linux installation process installs the data models by default during the management server installation. The OpenConfig instance of the management server passes through authorization toward the native management server.

Note:

The system does not support multiple candidates within the OpenConfig instance of the management server.

See the SR Linux Software Release Notes for the supported OpenConfig modules in SR Linux releases.

Interaction with SR Linux data models

You can use the SR Linux vendor-specific and OpenConfig vendor-neutral YANG data models together to configure and manage network elements. The SR Linux data models offer a more complete representation of the capabilities of the SR Linux network elements, because they include vendor-specific features and functions that the OpenConfig data models do not describe.

The SR Linux configuration and operational statements map to path statements in the supported OpenConfig modules. The mappings are exposed in JSON files delivered with the software package. You can view the mapping files after installation, for vendor-specific deviations and augmentations.

Note: See the SR Linux Software Release Notes for information about the supported OpenConfig modules in SR Linux releases.

When using the gNMI service, the capabilities RPC can discover the capabilities of a specific gNMI server. The client sends a CapabilityRequest message to request capability information from the target. The target replies with a CapabilityResponse message that includes the gNMI service version, the supported data model versions, and the supported data encodings. Subsequent RPC messages from the client use this information to indicate the set of models used by the client and the encoding used for data.

The CapabilityResponse messages indicates each data model the target supports, based on the configuration in CLI (system management openconfig admin-state) . The advertised names include information about the model, organization, and version, for the respective YANG models, and Nokia deviations for the OpenConfig models. See gNMI Capabilities RPC for more information.

Viewing OpenConfig to SR Linux mapping files

SR Linux exposes the OpenConfig to SR Linux data model module mappings in oc-srl.json files provided with the installation. You can locate and view the module mapping files after SR Linux installation in the /opt/srlinux/mappings/openconfig directory.

See the SR Linux Software Release Notes for information about the supported OpenConfig modules in SR Linux releases.

The following example shows partial content from the oc-srl-lldp.json mapping file.

  "mapping": [
    {
      "oc": "/lldp",
      "srlinux": "/system/srl_nokia-lldp:lldp"
    },
    {
      "oc": "/lldp/{config,state}",
      "srlinux": ""
    },
    {
      "oc": "/lldp/{config,state}/enabled",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:admin-state",
      "transform":"bool-to-admin-state"
    },
    {
      "oc": "/lldp/{config,state}/hello-timer",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:hello-timer"
    },
    {
      "oc": "/lldp/{config,state}/suppress-tlv-advertisement",
      "supported": false
    },
    {
      "oc": "/lldp/config/system-name",
      "supported": false
    },
    {
      "oc": "/lldp/state/system-name",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:system-name"
    },
    {
      "oc": "/lldp/config/system-description",
      "supported": false
    },
    {
      "oc": "/lldp/state/system-description",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:system-description"
    },
    {
      "oc": "/lldp/config/chassis-id",
      "supported": false
    },
    {
      "oc": "/lldp/state/chassis-id",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:chassis-id"
    },
    {
      "oc": "/lldp/config/chassis-id-type",
      "supported": false
    },
    {
      "oc": "/lldp/state/chassis-id-type",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:chassis-id-type"
    },
    {
      "oc": "/lldp/state/counters",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:statistics"
    },
    {
      "oc": "/lldp/state/counters/frame-in",
      "srlinux": "/system/srl_nokia-lldp:lldp/srl_nokia-lldp:statistics/srl_nokia-lldp:frame-in"
    },
    {
# 

Viewing the nosimage OpenConfig capability file

Introduction

SR Linux supports a machine-readable description of OpenConfig YANG paths and the gNMI and gRPC operations that apply to each path. The description is delivered as a textual protobuf file called nosimage.textproto. You can use this file offline to design automation, validate client requests, and plan telemetry subscriptions without connecting to a router.

This topic describes how to obtain nosimage.textproto, how paths are represented, and how to read gNMI get, set, and subscribe capabilities, subscription modes, stream modes, and supported OpenConfig gRPC services.

About nosimage.textproto

nosimage.textproto is a human-readable instance of data defined by the nosimage.proto schema. The file references ocpaths.proto for OpenConfig path entries and ocrpcs.proto for supported gRPC services. Each release builds the file from the OpenConfig YANG models supported on SR Linux, including openconfig-srl-augments.yang and openconfig-srl-deviations.yang.

The file lists OpenConfig paths only. It does not describe Nokia native (srl_nokia) YANG. YANG action paths and action or RPC input and output containers are not included.

Note: nosimage.textproto documents capabilities for a release and platform. It does not change router behavior. Runtime access still requires OpenConfig to be enabled and appropriate gNMI or gRPC configuration on the device.

Platforms and delivery

Nokia provides a platform-specific nosimage.textproto file with the SR Linux software delivery for each supported chassis type. Per-platform files are available for the following platform variants.

  • 7250 IXR-10e
  • 7250 IXR-18e

Download the SR Linux release package for your platform from the Nokia software delivery portal and locate nosimage.textproto with the other release deliverables. Content can differ between platforms because supported OpenConfig paths depend on platform capabilities.

OpenConfig path format

Each path in nosimage.textproto is an absolute path from the OpenConfig data tree root. Paths are written without list key values. For example, a list may appear as /interfaces/interface/state/oper-status and not including a specific interface name.

The path list includes every supported OpenConfig node where gNMI get, set, or subscribe can apply. Container and list paths that support subscription are included when applicable.

gNMI capabilities per path

Path entries can include a gnmi_rpc block that indicates which gNMI RPCs are supported for that path. The following fields are used.

Table 1. gnmi_rpc fields per OpenConfig path
Field Meaning
get The path can be read with the gNMI Get RPC. All YANG paths except YANG-modeled actions support Get, including both config true and config false nodes.
set The path can be written with the gNMI Set RPC. Set is true for YANG config true nodes.
subscribe The path can be used with the gNMI Subscribe RPC when the OpenConfig YANG model marks the node with the telemetry-capability extension (sample, on_change, or target_defined).

Subscription modes

When subscribe is true, nosimage.textproto lists one or more sub_mode values that describe how the target can deliver updates for that path, as defined in the gNMI specification:

  • STREAM — the target streams values for the subscription.
  • ONCE — the target sends values once and closes the subscription.
  • POLL — the target sends updates when the client sends a poll request.

On SR Linux, Subscribe-capable paths typically list STREAM, ONCE, and POLL together.

Stream modes and sample interval

When sub_mode includes STREAM, stream_mode indicates how streamed updates are produced for that path. Values are derived from the telemetry-capability extension on the YANG node:

Table 2. Telemetry-capability to stream_mode mapping
Telemetry-capability in YANG stream_mode in nosimage.textproto
target_defined TARGET_DEFINED
on_change ON_CHANGE
sample=<n> SAMPLE

When stream_mode includes SAMPLE, sample_interval_nanoseconds gives the interval associated with sample=<n> in YANG. The extension uses seconds; nosimage.textproto stores nanoseconds (seconds × 10^9).

Supported gRPC services

The ocrpcs section of nosimage.textproto lists OpenConfig-related gRPC services, supported method names, and service version strings. Use this section together with per-path gnmi_rpc data when you implement client capability checks.

Example ocrpcs structure is as follows.

ocrpcs: {
  oc_protocols: {
    key: "gnmi"
    value: {
      method_name: "gnmi.gNMI.Get"
      method_name: "gnmi.gNMI.Set"
      method_name: "gnmi.gNMI.Subscribe"
      version: "0.10.0"
    }
  }
}

Method names use fully qualified gRPC identifiers (for example, gnoi.healthz.Healthz.Get).

Example path entry

The following example shows a path entry with gNMI capability and subscription information. Path and field values are illustrative.

ocpaths: {
  path: "/interfaces/interface/state/oper-status"
  gnmi_rpc: {
    get: true
    set: false
    subscribe: true
    sub_mode: STREAM
    sub_mode: ONCE
    sub_mode: POLL
    stream_mode: ON_CHANGE
  }
}

Using nosimage with management on the router

nosimage.textproto complements but does not replace on-device discovery and mapping artifacts.

  • Enable OpenConfig with system management openconfig admin-state enable before using OpenConfig paths through gNMI.
  • Set the gNMI origin to openconfig in request path prefixes, or configure system grpc-server yang-models openconfig on the gRPC server.
  • Use the gNMI Capabilities RPC on a live device to learn gNMI service version, supported YANG models, and encodings. Capabilities does not provide per-path Subscribe or stream mode detail; use nosimage.textproto for that level of detail.
  • After installation, OpenConfig-to-native path mappings remain in /opt/srlinux/mappings/openconfig as oc-srl.json files.

Enabling access to OpenConfig data models

You can enable access to the OpenConfig data model using the admin-state in the system management openconfig admin-state context. When you validate and commit a configuration, the system verifies if openconfig is set to true and determines if there is access to OpenConfig data models. If the candidate contains OpenConfig configuration statements and openconfig is not enabled (false), the action fails with an error.

Note: The system does not support multiple candidates within the OpenConfig instance of the management server.

The following example shows the basic configuration required to enable the OpenConfig configuration modules and obtain state information.

--{ [FACTORY] candidate shared default }--[ ]--
A:dut2# system management openconfig admin-state enable 
--{ [FACTORY] * candidate shared default }--[ ]--
A:dut2# commit stay 
All changes have been committed. Starting new transaction.
--{ [FACTORY] + candidate shared default }--[ ]--
A:dut2#

Specifying the data model mode

The SR Linux YANG data model is the default mode. The system supports different methods for switching between the default SR Linux data model and the OpenConfig data model.

Specifying the data model in the CLI

To specify the data model when accessing the CLI, use the enter oc or enter srl command. A special OpenConfig banner appears in OpenConfig mode.

Specifying the data model
A:dut2# enter oc 
--{ oc candidate shared default }--[ ]--
A:dut2# enter srl 
--{ [FACTORY] + candidate shared default }--[ ]--
A:dut2#

Specifying the data model in Linux Bash

To specify the data model when logging in to the Linux Bash, start the CLI using sr_cli --oc or sr_cli --srl. This enters directly into OpenConfig or SR Linux models respectively.

Specifying the data model in Linux Bash
$ sr_cli --oc
Loading environment configuration file(s): []
Welcome to the Nokia SR Linux CLI.

--{ oc running }--[ ]--
A:srl1# quit
Connection to srl1 closed.
$ sr_cli --srl

Loading environment configuration file(s): []
Welcome to the Nokia SR Linux CLI.

--{ [FACTORY] + running }--[ ]--
A:srl1# quit Connection to srl1 closed.

Specifying the data model mode for the gRPC server

When using the gRPC server to send and accept edits, requests, and responses for the SR Linux or OpenConfig data models, you can specify the corresponding data model schema (openconfig or native) for the target in the system grpc-server name yang-models context. The following example shows this configuration.
Yang data model selection for gRPC server
A:dut2# enter candidate 
--{ [FACTORY] + candidate shared default }--[ ]--
A:dut2# system grpc-server mgmt yang-models openconfig 
--{ [FACTORY] +* candidate shared default }--[ ]--
A:dut2# commit stay 
All changes have been committed. Starting new transaction.
--{ [FACTORY] + candidate shared default }--[ ]--
A:dut2# 

Alternatively, you can send a gNMI SetRequest with the origin prefix openconfig embedded in the request. This informs the system to use the OpenConfig data model, regardless of the value specified for yang-models under the gRPC server configuration.

Prefix origin openconfig in gNMI SetRequest
SetRequest:
prefix: <
  origin: "openconfig"
>

Verifying the OpenConfig operational state

You can verify the OpenConfig operational state using the command info from state system management openconfig oper-state. The following example shows the operational state of the OpenConfig data model.

A:dut2# info with-context from state system management openconfig 
system {
    management {
        openconfig {
            admin-state enable
            oper-state up
        }
    }
}