No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search


To have a better experience, please upgrade your IE browser.


Configuration Guide - Device Management

S2720, S5700, and S6720 V200R013C00

This document describes the configurations of Device Management, including device status query, hardware management, Stack, SVF, cloud-based management, PoE, monitoring interface, OPS, energy-saving management, information center, fault management, NTP, synchronous ethernet, PTP.

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Executing CLI Command

Executing CLI Command

Interface Name

Executing CLI command

Application Phase

Execution phase

API Prototype

result1_string, result2_next, result3_description = ops.cli.execute(fd, command, choice=None)






Indicates a CLI channel handle.

The value is generated through Opening CLI Channel API.


Indicates a command to be executed.

The value is in CLI format, for example, display device. Only one command can be executed each time.


Indicates the automatic response of an interactive command.

This parameter does not need to be specified for a non-interactive command.

The value contains a maximum of eight options, for example, {"Continue?": "n", "save": "n"}, which contains two options.

The default value is None, which indicates that no option is included.

Return Value

The result1_string, result2_next, and result3_description in the API prototype indicate return values.

The first return value None indicates that a command is not sent to the CLI or execution of the command times out. Other values indicate output information, and at most 32 KB data can be displayed each time.

The second return value Next:0 indicates that there will be no output later, while Next:1 indicates that there will be output later. If the next batch of data needs to be obtained, this API will be invoked again, and the command and choice parameters must be set to None.

The third return value is the failure cause when the first return value is None.

Usage Description

Using the executing CLI command API, you can enable a script to automatically execute commands. Only one command can be executed at a time. If the choice parameter is specified, interactive information will be displayed after a command is executed, implementing interaction between users and devices.


After the ftp command is executed, the device automatically responds to the user name and password for logging in to the FTP server.

result, n1, n2 = ops.cli.execute(handle, "ftp", {"User":"admin","password":"huawei"})

The device automatically runs the display device command to check the component information and status of the device.

result, n1, n2 = ops.cli.execute(handle, "display device")
Updated: 2019-04-20

Document ID: EDOC1100065674

Views: 78010

Downloads: 515

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Previous Next