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.


S600-E V200R013C00 Configuration Guide - Device Management

This document describes the configurations of Device Management, including device status query, hardware management, Stack, SVF, cloud-based management, PoE, OPS, energy-saving management, information center, fault management, NTP.
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).
Reading User Input from a Terminal

Reading User Input from a Terminal

Interface Name

Reading user input from a terminal

Application Phase

Execution phase and CLI event synchronization waiting mode

API Prototype

result1_value, result2_description =, timeout=30, vty=None)






Indicates the maximum length of the entered character string.

The value is an integer that ranges from 1 to 512. The default value is 512.


Indicates the timeout interval.

The value is an integer that ranges from 0 to 60, in seconds. The default value is 30 seconds.


Indicates a user terminal.

The value is None or the VTY channel name obtained using ops.environment.get("_cli_vty").

Return Value

The result1_value and result2_description in the API prototype indicate return values.

The first return value is as follows:
  • None: indicates that waiting process times out or a user presses Ctrl+C.

  • Empty string: indicates that a user presses Enter directly.

  • 1: indicates that an error is returned. The reason of the error is described by the second return value.

  • Other string: indicates user input (only when the second return value is success).

The second return value is as follows:

  • success: indicates that user input from a terminal is read successfully.

  • Other string: indicates the reason why user input from a terminal failed to be read.

Usage Description

The command line event must be subscribed, and you must wait until the script execution is complete after the command is executed. That is, the subscribed event must be defined through ops.cli.subscribe, and sync must be set to True.

This API enables you to obtain the information entered by users from a terminal and use it in scripts. A maximum of 10 APIs are supported in one script.


When a subscription event is matched, you can read user input from the terminal.

value, descri_str =, timeout=30, vty=None)
Updated: 2019-04-20

Document ID: EDOC1100066159

Views: 26584

Downloads: 3

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