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

Reminder

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

upgrade

Configuration Guide - Device Management

S7700 and S9700 V200R013C00

This document describes the configurations of Device Management, including device status query, hardware management, CSS, SVF, PoE, OPS, OIDS, 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)

Description

Parameter

Description

Value

fd

Indicates a CLI channel handle.

The value is generated through Opening CLI Channel API.

command

Indicates a command to be executed.

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

choice

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.

Example

After the ftp 10.137.217.201 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 10.137.217.201", {"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")
Translation
Download
Updated: 2019-04-20

Document ID: EDOC1100065738

Views: 44778

Downloads: 37

Average rating:
This Document Applies to these Products
Related Version
Related Documents
Share
Previous Next