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 12800 and 12800E V200R003C00

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

Open a CLI Channel

  • Function Description

    The OPS allows the system to use the Python script to open a CLI channel and execute commands.

  • Command Prototype

  • Parameter Description
    Table 3-913  Parameters supported by APIs for opening CLI channels




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

  • Description of Return Values

    First return value: If None is displayed, an error has occurred. Otherwise, command handles are returned.

    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.

    After the CLI channel is opened using the script, commands can be delivered to the device only when the CLI terminal displays the user view.

    The CLI channel authorities are the user authorities of the maintenance assistant created.

    A script can be used to create only one CLI channel. If an attempt is made to create a second CLI channel using this script, the system returns a failure.

    A VTY resource is consumed for every channel opened. The display users command shows that a VTY resource is consumed by an assistant (Assistant: Name). If not more than 3 VTYs are available, opening a CLI channel fails.

Updated: 2019-05-05

Document ID: EDOC1100004147

Views: 59822

Downloads: 28

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Previous Next