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.


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).
Close a CLI Channel

Close a CLI Channel

  • Function Description

    The OPS allows the system to use the Python script to open a CLI channel, execute commands, and close the CLI channel after command execution.

  • Command Prototype


  • Parameter Description
    Table 3-858  Parameters supported by APIs for closing a CLI channel




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


    Specifies a command handle. It is generated by

  • Description of Return Values

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

    Second return value: result description expressed in character strings

  • Example
    import ops
    import igpcomm
    def ops_condition(_ops):
        return ret
    def ops_execute(_ops):
        handle, err_desp=
        choice = {"Continue": "y", "save": "n"}
        _ops.cli.execute(handle,"undo statistics-task a",choice)
        ret = _ops.cli.close(handle)
        print 'test2 =',ret
        return 0
    1. When the front end executes the script, the CLI channel is opened, and the CLI terminal displays the user view.
    2. Run the system-view command to enter the system view.
    3. Run the pm command to enter the PM view.
    4. Run the undo statistics-task a command so the system operates based on the choice variable value. This command is an interactive command.
    5. Run the commit command to commit the configuration.
    6. Close the CLI channel.
Updated: 2019-03-21

Document ID: EDOC1000166567

Views: 30381

Downloads: 127

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