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#
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# //show debug
INFO: CLI #2051: Switching to the classic CLI engine
A:admin-node-2# /show debug
debug
router "Base"
bgp
open
exit
exit
exit
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, //show debug and // show debug 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.
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
(ex)[/configure system]
A:admin@node-2# //show debug
INFO: CLI #2051: Switching to the classic CLI engine
A:admin-node-2# /show debug
debug
router "Base"
bgp
open
exit
exit
exit
INFO: CLI #2052: Switching to the MD-CLI engine
[/]
A:admin@node-2# history
1 //show debug
[/]
A:admin@node-2# //
INFO: CLI #2052: Switching to the classic CLI engine
A:admin@node-2# history
1 /show debug
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# //show debug Press CTRL-w # stay in the MD-CLI engine
# delete word
[/]
A:admin@node-2# //show debug 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.
(ex)[/configure system]
A:admin@node-2# //show debug Press CTRL-z
INFO: CLI #2051: Switching to the classic CLI engine
A:admin-node-2# /show debug
debug
router "Base"
bgp
open
exit
exit
exit
INFO: CLI #2052: Switching to the MD-CLI engine
(ex)[/configure system]
A:admin@node-2#
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.
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#
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.