Switching between the classic CLI and the MD-CLI engines
A 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 slash) can be executed from any CLI context in both engines to switch to the other CLI engine.
Switching engines
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
INFO: CLI #2050: Classic CLI modification of the configuration is not allowed - 'model-driven' management interface configuration mode active
A:node-2#
Context saved when toggling
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# configure 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
INFO: CLI #2050: Classic CLI modification of the configuration is not allowed - 'model-driven' management interface configuration mode active
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
INFO: CLI #2050: Classic CLI modification of the configuration is not allowed - 'model-driven' management interface configuration mode active
A:node-2>config>system>management-interface#
When switching is not authorized
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#
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.
[ex:/configure system]
A:admin@node-2# //show debug
INFO: CLI #2051: Switching to the classic CLI engine
INFO: CLI #2050: Classic CLI modification of the configuration is not allowed - 'model-driven' management interface configuration mode active
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, the //show debug and // show debug commands are equivalent.
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.
-
Command completion and ? help 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.
-
‟//” or ‟//command” appears in the history of the CLI engine where it is executed.
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.
Executing the /!classic-cli switch command
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
INFO: CLI #2050: Classic CLI modification of the configuration is not allowed - 'model-driven' management interface configuration mode active
A:node-2>#
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.
Executing the /!md-cli switch command
[ex:/configure router "Base" bgp]
A:admin@node-2# /!classic-cli
INFO: CLI #2051: Switching to the classic CLI engine
INFO: CLI #2050: Classic CLI modification of the configuration is not allowed - 'model-driven' management interface configuration mode active
A:node-2> /!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.