YANG data models

SR Linux supports YANG data models for configuring the network element. YANG is a standards-based, data-modelling language that supports Remote Procedure Calls (RPCs). 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, gNMI 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"
    },
    {
# 

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.

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 SSH mode

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

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 mode

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 SRL mode respectively.

[linuxadmin@dut2 srl]$ sr_cli --oc
Using configuration file(s): ['/etc/opt/srlinux/srlinux.rc']
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ oc running }--[ ]--
A:dut2# quit 
[linuxadmin@dut2 srl]$ sr_cli --srl
Using configuration file(s): ['/etc/opt/srlinux/srlinux.rc']
Welcome to the srlinux CLI.
Type 'help' (and press <ENTER>) if you need any help using this.
--{ [FACTORY] + running }--[ ]--
A:dut2# quit 
[linuxadmin@dut2 srl]$

Specifying the data model in the CLI environment

To specify the data model while working in the CLI environment, use the environment yang-models command.

A:dut2# environment yang-models oc
--{ [FACTORY] + running }--[  ]--
A:dut2# environment show
...
...
[yang-models]
value = "oc"

--{ [FACTORY] + running }--[  ]--
A:dut2#

Verifying the OpenConfig operational state

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

A:dut2# info from state system management openconfig 
system {
    management {
        openconfig {
            admin-state enable
            oper-state up
        }
    }
}
--{ [FACTORY] + running }--[ ]--
A:dut2# 

Specifying the data model mode for the gNMI server

When using the gNMI 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 gnmi-server network-instance name yang-models context. The following example shows this configuration.

Yang data model selection for gNMI server

A:dut2# enter candidate 
--{ [FACTORY] + candidate shared default }--[ ]--
A:dut2# system gnmi-server network-instance 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# 

Altternatively, 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 gNMI server network instance configuration.

Prefix origin openconfig in gNMI SetRequest

SetRequest:
prefix: <
  origin: "openconfig"
>