Displaying state information in the MD-CLI

Operators can access the YANG state models in the MD-CLI by navigating the state tree from operational mode.

[/]
A:admin@node-2# ?

 admin                 + Enter the administrative context for system operations
 bof                   + Configure system boot options
 clear                 + Clear statistics or reset operational state
 configure             + Configure system configuration
 environment           + Configure the environment settings for this session
 file                  + Perform file operations
 li                    + Configure lawful intercept
 password              - Change the local user password
 show                  + Show operational information
 state                 + Show state information
 tools                 + Enter the tools context for troubleshooting and
                         debugging

Navigating the state tree

The same navigation commands used in a configuration region are available in the MD-CLI state tree. Online ? help and command completion functionality are also available. The state tree information can be displayed using the info command.

[/state]
A:admin@node-2# info ?

 info [[from] <keyword>] [[cli-path] <path>]

 [[from] <keyword>]
 <keyword>  - (candidate|running|baseline|intended)

    Source datastore

 [cli-path] <path>
 <path>  - <absolute or relative from pwc>

    Absolute or relative path from present working context

 detail                - Include default and unconfigured values
 full-context          - Show the full context on each line
 inheritance           - Include configuration inherited from configuration
                         groups
 units                 - Include unit types for applicable elements

 Choice: output-format
 flat                 :- Show the context from the pwc on each line
 json                 :- Show the output in indented JSON format
 xml                  :- Show the output in indented XML format
Note: The converted, inheritance, and model options are not supported for state elements.

Example: Output displays information from the state tree

The following output displays information from the state tree using the info command, with the time format defined in RFC 1123.

[/environment]
A:admin@node-2# time-format rfc-1123

[/environment]
A:admin@node-2# /state system

[/state system]
A:admin@node-2# info
    oper-name "node-2"
    base-mac-address aa:bb:cc:00:00:00
    platform "7750 SR-12"
    chassis-topology standalone
    crypto-module-version "SRCM 3.0"
    temperature-status ok
    fp-generation-fp2 false
    fp-generation-fp3 true
    fp-generation-fp4 false
    system-profile none
    active-cpm-slot "A"
    up-time 10351550
    current-time "Tue, 01 Sep 2020 17:40:49 UTC"
    boot-good-exec-status not-run
    boot-bad-exec-status not-run
    alarms {
    }
    grpc {
        oper-state down
        supported-services {
            gnmi-version "0.7.0"
            gnoi-cert-mgmt-version "0.1.0"
            gnoi-system-version "0.1.0"

---snip---

Example: Using the units option of the info command

The units option of the info command displays the output with unit types for applicable elements.

[/state system]
A:admin@node-2# info units
    oper-name "node-2"
    base-mac-address aa:bb:ff:00:00:00
    platform "7750 SR-12"
    chassis-topology standalone
    crypto-module-version "SRCM 3.0"
    temperature-status ok
    fp-generation-fp2 false
    fp-generation-fp3 true
    fp-generation-fp4 false
    system-profile none
    active-cpm-slot "A"
    up-time 151557100 milliseconds
    current-time "2020-07-17 17:33:43 UTC"
    boot-good-exec-status not-run
    boot-bad-exec-status not-run
    alarms {
    }
    grpc {
        oper-state down
        supported-services {
            gnmi-version "0.7.0"
            gnoi-cert-mgmt-version "0.1.0"
            gnoi-system-version "1.0.0"
            md-cli-version "0.1.0"
            rib-api-version "1.1.0"
        }
    }
    management-interface {
        configuration-oper-mode model-driven
        last-mode-switch "2020-07-15 23:27:47 UTC"
        last-mode-switch-duration 12 milliseconds

---snip---

Example: Using the json option of the info command

The json option of the info command displays the output in indented JSON IETF format.

[/state system]
A:admin@node-2# info json
{
    "nokia-state:oper-name": "node-2",
    "nokia-state:base-mac-address": "aa:bb:ff:00:00:00",
    "nokia-state:platform": "7750 SR-12",
    "nokia-state:chassis-topology": "standalone",
    "nokia-state:crypto-module-version": "SRCM 3.0",
    "nokia-state:temperature-status": "ok",
    "nokia-state:fp-generation-fp2": false,
    "nokia-state:fp-generation-fp3": true,
    "nokia-state:fp-generation-fp4": false,
    "nokia-state:system-profile": "none",
    "nokia-state:active-cpm-slot": "A",
    "nokia-state:up-time": "151894370",
    "nokia-state:current-time": "2020-07-17 17:39:20 UTC",
    "nokia-state:boot-good-exec-status": "not-run",
    "nokia-state:boot-bad-exec-status": "not-run",
    "nokia-state:alarms": {
    },
    "nokia-state:grpc": {
        "oper-state": "down",
        "supported-services": {
            "gnmi-version": "0.7.0",
            "gnoi-cert-mgmt-version": "0.1.0",
            "gnoi-system-version": "1.0.0",
            "md-cli-version": "0.1.0",
            "rib-api-version": "1.1.0"
        }
    },
    "nokia-state:management-interface": {
        "configuration-oper-mode": "model-driven",
        "last-mode-switch": "2020-07-15 23:27:47 UTC",
        "last-mode-switch-duration": 12,

---snip---

Example: Output using the time format defined in RFC 3339 (default output format)

[/]
A:admin@node-2# environment time-format rfc-3339

[/]
A:admin@node-2# state system

[/state system]
A:admin@node-2# info
    oper-name "node-2"
    base-mac-address aa:bb:cc:00:00:00
    platform "7750 SR-12"
    chassis-topology standalone
    crypto-module-version "SRCM 3.0"
    temperature-status ok
    fp-generation-fp2 false
    fp-generation-fp3 true
    fp-generation-fp4 false
    system-profile none
    active-cpm-slot "A"
    up-time 10383490
    current-time 2020-04-15T17:41:21.7+00:00
    boot-good-exec-status not-run
    boot-bad-exec-status not-run
    alarms {
    }
    grpc {
        oper-state down
        supported-services {
            gnmi-version "0.7.0"
            gnoi-cert-mgmt-version "0.1.0"
            gnoi-system-version "0.1.0"

---snip---

Example: Output using the time format defined in ISO 8601

[/]
A:admin@node-2# environment time-format iso-8601

[/]
A:admin@node-2# state system

[/state system]
A:admin@node-2# info
    oper-name "node-2"
    base-mac-address aa:bb:cc:00:00:00
    platform "7750 SR-12"
    chassis-topology standalone
    crypto-module-version "SRCM 3.0"
    temperature-status ok
    fp-generation-fp2 false
    fp-generation-fp3 true
    fp-generation-fp4 false
    system-profile none
    active-cpm-slot "A"
    up-time 88776290
    current-time "2020-04-16 15:27:54 UTC"
    boot-good-exec-status not-run
    boot-bad-exec-status not-run
    alarms {
    }
    grpc {
        oper-state down
        supported-services {
            gnmi-version "0.7.0"
            gnoi-cert-mgmt-version "0.1.0"
            gnoi-system-version "0.1.0"
            md-cli-version "0.1.0"
            rib-api-version "1.1.0"
        }
    }

---snip---

MD-CLI show commands

The information in the output of the show commands can also be found in the state and configure branches of the MD-CLI (as well as via model-driven interfaces such as NETCONF and gRPC). The show commands, however, are different from the YANG state output.

The YANG state is fully modeled and structured data that can be easily manipulated by tools and applications (including pySROS and NETCONF clients). The report-style output of the show commands contains useful combinations of configuration and state, but the information is not modeled or structured. The pySROS and command alias features can be used together to create custom show commands using the modeled data. See Command aliases for more information.