SR OS routers can be in different management interface configuration modes, which affects the management interfaces that can be used to configure the router. The following interfaces are available for configuration on SR OS:
2.1. Enabling the MD-CLI
The CLI engine refers to the CLI environment that is being used in a user session (for example, console, Telnet, or SSH) to configure and operate the router.
To enable the MD-CLI engine from the classic CLI, perform the following steps:
Set the configuration mode to model-driven and leave cli-engine unconfigured.
A:node-2>config>system>management-interface# configuration-mode model-driven
Log out and start a new CLI session to access the MD-CLI engine.
A:node-2>config>system>management-interface# logout
When a new user session begins, the MD-CLI engine is available and the MD-CLI prompt is displayed.
When the configuration mode is changed to model-driven, the following applies:
the configuration mode becomes immediately active
access to configuration in the classic CLI is read-only (no modification)
access to show configuration in the classic CLI is still available
2.2. Switching Between the Classic CLI and MD-CLI Engines
A single CLI command is available in both the classic CLI and MD-CLI engines to switch between the two engines in a user session. When authorized (cli-engine list contains both classic-cli and md-cli), the CLI engine switch command (“//”, the double forward slash) can be executed from any CLI context in both engines to switch to the other CLI engine.
A:node-2# //
INFO: CLI #2052: Switching to the MD-CLI engine
[]
A:admin@node-2# //
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2#
The context in which the CLI engine switch command is executed is saved when toggling between CLI engines and returns to the same context when toggling back.
[]
A:admin@node-2# edit-config read-only
INFO: CLI #2066: Entering read-only configuration mode
(ro)[]
A:admin@node-2# configure router
(ro)[configure router "Base"]
A:admin@node-2# //
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2# configure system management-interface
A:node-2>config>system>management-interface# //
INFO: CLI #2052: Switching to the MD-CLI engine
(ro)[configure router "Base"]
A:admin@node-2# //
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2>config>system>management-interface#
If switching engines is not authorized (when cli-engine is only [classic-cli] or [md-cli]), the command is rejected.
A:node-2# //
MINOR: CLI #2053 Switching CLI engine is not authorized
A:node-2#
2.2.1. Executing Classic CLI Commands from the MD-CLI Engine
When switching engines is authorized, all classic CLI engine commands can be executed from the MD-CLI engine. Entering a classic CLI engine command preceded by the “//” command executes the command in the classic CLI engine and returns immediately to the MD-CLI engine. The MD-CLI context is preserved before the switch to the classic CLI engine, and the context is restored when the session returns to the MD-CLI engine. In the following example, the classic CLI command is executed from the configure system context in the MD-CLI. When the session returns to the MD-CLI engine, it is returned to the same context.
(ex)[configure system]
A:admin@node-2# //file dir
INFO: CLI #2051: Switching to the classic CLI engine
A:admin@node-2# /file dir
Volume in drive cf3 on slot A is .
Volume in drive cf3 on slot A is formatted as FAT32
Directory of cf3:\
10/24/2019 01:04p <DIR> .ssh/
01/01/1980 12:00a 170 NVRAM.DAT
01/01/1980 12:00a 610 bof.cfg
10/24/2019 01:04p 317 nvsys.info
10/24/2019 01:04p 1 restcntr.txt
4 File(s) 1098 bytes.
1 Dir(s) 2048 bytes free.
INFO: CLI #2052: Switching to the MD-CLI engine
(ex)[configure system]
A:admin@node-2#
It is acceptable to include a space between “//” and the CLI command. For example, //file dir and // file dir are equivalent commands.
User interactions, such as pagination, confirmation, or control characters (for example, CTRL-c to stop an ongoing command execution), are supported during CLI command execution. The CLI engine is switched back to the MD-CLI engine just before the CLI command prompt would normally appear.
Executing MD-CLI commands from the classic CLI engine works in the same way as described for executing classic CLI commands from the MD-CLI engine.
2.2.2. MD-CLI and Classic CLI Engine Interactions
The following describes MD-CLI engine interactions with the classic CLI when using the “//” command:
uncommitted changes in the MD-CLI are kept when switching to the classic CLI
“//” appears in the history of the CLI engine where it is executed
[]
A:admin@node-2# //
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2# history
1 history
A:node-2# //
INFO: CLI #2052: Switching to the MD-CLI engine
[]
A:admin@node-2# history
1 //
[]
A:admin@node-2#
“//command” appears in the history of both CLI engines
[]
A:admin@node-2# //file dir
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2# /file dir
Volume in drive cf3 on slot A is .
Volume in drive cf3 on slot A is formatted as FAT32
Directory of cf3:\
06/26/2019 07:58p <DIR> .ssh/
01/01/1980 12:00a 170 NVRAM.DAT
01/01/1980 12:00a 610 bof.cfg
06/26/2019 07:58p 311 nvsys.info
06/26/2019 07:58p 1 restcntr.txt
4 File(s) 1092 bytes.
1 Dir(s) 2048 bytes free.
INFO: CLI #2052: Switching to the MD-CLI engine
[]
A:admin@node-2# history
1 //file dir
[]
A:admin@node-2# //
INFO: CLI #2052: Switching to the classic CLI engine
A:admin@node-2# history
1 /file dir
2 history
A:admin@node-2#
command completion, ? help, and redirection are not supported for the command following the “//”
all control characters added on the same line when entering a “//” command have an effect on the CLI engine where they are entered
[]
A:admin@node-2# //file dir Press CTRL-w # stay in the MD-CLI engine
# delete word
[]
A:admin@node-2# //file dir Press CTRL-c # stay in the MD-CLI engine
# stop current command
[]
A:admin@node-2#
CTRL-z is the equivalent of Enter and exit all. When used on a command line with “//”, CTRL-z is the equivalent of just pressing Enter. Because the originating CLI engine is no longer available, exit all can no longer be executed.
[]
A:admin@node-2# //file dir Press CTRL-z
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2# /file dir
Volume in drive cf3 on slot A is .
Volume in drive cf3 on slot A is formatted as FAT32
Directory of cf3:\
06/26/2019 07:58p <DIR> .ssh/
01/01/1980 12:00a 170 NVRAM.DAT
01/01/1980 12:00a 610 bof.cfg
06/26/2019 07:58p 311 nvsys.info
06/26/2019 07:58p 1 restcntr.txt
4 File(s) 1092 bytes.
1 Dir(s) 2048 bytes free.
INFO: CLI #2052: Switching to the MD-CLI engine
[]
A:admin@node-2# history
A command history is maintained per CLI engine. CLI commands executed in the MD-CLI do not appear in the classic CLI history. CLI commands executed in the classic CLI do not appear in the MD-CLI history.
2.2.3. Switching Explicitly to the Classic CLI Engine
The /!classic-cli command is available in both the classic CLI and MD-CLI engines to explicitly switch to the classic CLI engine in a session, as long as classic-cli is an authorized CLI engine. If switching to the classic CLI engine is not authorized, the command is rejected. Issuing the /!classic-cli command in the classic CLI engine has no effect.
The /!classic-cli switch command can be executed from any CLI context in both engines and the context is preserved for both engines. When the command is executed, the session enters the last saved working context of the classic CLI engine.
A:node-2>config>system>management-interface# //
INFO: CLI #2052: Switching to the MD-CLI engine
(ex)[configure router "Base" bgp]
A:admin@node-2# /!classic-cli
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2>config>system>management-interface#
2.2.4. Switching Explicitly to the MD-CLI Engine
The /!md-cli command is available in both the classic CLI and MD-CLI engines to explicitly switch to the MD-CLI engine in a session, as long as md-cli is an authorized CLI engine. If switching to the MD-CLI engine is not authorized, the command is rejected. Issuing the /!md-cli command in the MD-CLI engine has no effect.
The /!md-cli switch command can be executed from any CLI context in both engines and the context is preserved for both engines. When the command is executed, the session enters the last saved working context of the MD-CLI engine.
(ex)[configure router "Base" bgp]
A:admin@node-2# /!classic-cli
INFO: CLI #2051: Switching to the classic CLI engine
A:node-2>config>system>management-interface# /!md-cli
INFO: CLI #2052: Switching to the MD-CLI engine
(ex)[configure router "Base" bgp]
A:admin@node-2#
The /!md-cli and /!classic-cli commands can be useful when executing commands from a file, allowing the file to be executed in either CLI engine and ensuring the commands are run in the intended CLI engine.