Nokia SR OS MD-CLI: Commit Model and Workflow - 夜莺博客

Nokia SR OS MD-CLI: Commit Model and Workflow

Engineers arriving at Nokia SR OS from Junos or IOS XR usually adapt quickly to the syntax and then get caught by the session model. The Model-Driven CLI (MD-CLI), introduced with SR OS 16.0, is built on YANG data models and works on a candidate datastore that must be committed - but it also has an exclusive/private/global session concept that determines what happens when two people configure the same router. This is the operational walkthrough, not the syntax reference.

Prompt, modes and the datastore

[ex:/configure router "Base"] A:router#

ex = exclusive   (you hold the datastore; nobody else can edit)
pr = private     (your own copy; commit reconciles into the shared state)
gl = global      (shared candidate, everyone edits the same one)

The bracket shows the current configuration path, so the prompt doubles as a location indicator. The core workflow is five commands:

candidate     # enter the candidate configuration mode
compare       # show the diff between candidate and running
validate      # check the candidate without committing
commit        # validate and apply to the running datastore
discard       # throw away all pending changes

validate before commit is the habit worth building: MD-CLI commits are atomic, so a validation error leaves the running configuration untouched - but with commit alone you find out only that something failed, not which of a dozen changes was wrong.

Working efficiently in the hierarchy

info                  # show configuration at the current level
info detail           # include attributes set to their default values
info flat             # flat listing of the whole subtree
pwd                   # current path
back                  # up one level
top                   # to the top of the configuration hierarchy
/configure            # jump to a path directly from anywhere
/configure router "Base" ospf 0

Path jumping replaces a lot of ceremonial typing: /configure router "Base" ospf 0 puts you directly in the OSPF context regardless of where the session started. Tab completion and ? work at each level, and the details returned by info flat are what you paste into a change review.

Annotations, replace and rollback

annotate "ticket CHG-4471: add prefix-list for new peer"
delete router "Base" static-routes
replace "10.0.0.1" with "10.0.0.2"
rollback 3
commit comment "CHG-4471"
commit confirmed 10
commit confirmed accept
commit confirmed cancel

Annotations attach a comment to the next configuration element you enter, which is how the configuration carries its own change history. rollback <number> restores a previous commit from the commit history. commit confirmed applies the change for a default of ten minutes and reverts automatically unless you accept it - the single most useful feature when changing something that could cut your management access.

Translation table for Junos and IOS XR engineers

Task Nokia SR OS Junos IOS XR
Enter a context router bgp 65551 edit protocols bgp router bgp 65551
Delete an element delete context delete context no context
Annotate annotate "string" annotate "string" ! comment before the line
Match and replace replace "a" with "b" replace pattern "a" with "b" replace pattern 'a' with 'b'
Validate only validate commit check -
Commit commit commit commit
Commit confirmed commit confirmed [mins] commit confirmed [mins] commit confirmed [mins]
Roll back rollback <n> rollback <n> rollback configuration to commit-id
Run an operational command /show ... or command run show ... do show ...

Classic CLI versus MD-CLI

Most operational (show) commands are shared between Classic CLI and MD-CLI, but the configuration syntax is substantially different. Before automating against a router, confirm which CLI it runs: a script written for Classic CLI will not configure an MD-CLI device, and the session-mode semantics differ as well. New deployments should standardise on MD-CLI, because the YANG models underneath are what make model-driven telemetry and configuration automation possible.

Operational notes

  • A left ex: session on a production router blocks other administrators. Use private or global sessions for normal work and keep exclusive sessions short.
  • Always compare before commit. It costs a second and is the difference between a reviewed change and an incident.
  • Use commit confirmed for anything that touches management reachability, routing towards the management network, or AAA.
  • Keep annotations in the ticket system's format so that info flat output can be traced back to an approved change.

Related: Junos commit confirmed and rollback, IOS XR commit and rollback configuration, and Huawei CE configuration rollback and commit.

原文链接:https://documentation.nokia.com/sr/24-3/7x50-shared/md-cli-quick-reference/configuration-workflow-commands.html