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

RESTful API Reference

CloudEngine 8800, 7800, 6800, and 5800 V200R002C50

This document describes the OPS APIs supported by the device, including OPS-supported operations, request examples, elements in the requests, response examples, elements in the responses, and response status codes.
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).
Display Messages on User Terminals

Display Messages on User Terminals

  • Function Description

    The OPS provides an interface for displaying messages on the CLI terminal when the Python script is being executed on the front end or the CLI terminal waits for script execution.

  • Command Prototype

    opsObj.terminal.write(msg, vty=None)

  • Parameter Description
    Table 3-854  Parameters supported by APIs displaying messages on user terminals

    Method

    Description

    opsObj

    Specifies an OPS object. It is obtained using ops.ops() in instance mode.

    msg

    Specifies a character string to be displayed on user terminals.

    vty

    Specifies a user terminal. Currently, messages can only be displayed on user terminals that wait for script execution or execute the script on the front end.

    You can enter environment('_cli_vty') to obtain the VTY name or enter None.

  • Description of Return Values

    First return value: The value 0 indicates a success; the value 1 indicates a failure.

    Second return value: This value describes success or failure reasons, expressed in character strings.

  • Example
    test.py
    import ops
    def ops_condition(_ops):
        ret, reason = _ops.cli.subscribe("corn1","device",True,True,False,20)
        return ret
    def ops_execute(_ops):
        _ops.terminal.write("Hello world!",None)
        return 1

    When the front end executes the script, the Python script outputs "Hello World!" to the CLI terminal.

Translation
Download
Updated: 2019-03-21

Document ID: EDOC1000166567

Views: 28073

Downloads: 123

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