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

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).
Support Resident Scripts

Support Resident Scripts

  • Function Description

    The OPS ERE supports resident scripts. When a resident script is executed, ops.result() returns the execution result, and ops.wait() suspends the script. After the script is triggered again, ops.wait() is returned, and script execution continues.

  • Command Prototype

    opsObj.result(status)

    opsObj.wait()

  • Parameter Description
    Table 31-11 Parameters supported by resident script APIs

    Method

    Description

    opsObj

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

    status

    Specifies a return value, indicating the script processing result sent to the OPS. The value 0 indicates a success (The original command is skipped.). Other values are error codes.

  • Description of Return Values

    None

  • Example
    test.py
    
    import ops
    
    def ops_condition(_ops):
    _ops.cli.subscribe("con11","this",True,True,False,5)
    _ops.correlate("con11")
    return ret
    
    def ops_execute(_ops):
    a, des= _ops.context.save("wait1", 'ac1')
    _ops.result(1)
    _ops.wait()
    a, des= _ops.context.save("wait2", 'ac2')
    return 0
    NOTE:

    The opsObj.result() function returns the script processing result to the OPS. The result can also be returned using return. If neither opsObj.result() nor return is used, the default value 1 is returned. If both opsObj.result() and return are used, the result returned by opsObj.result() takes effect. If opsObj.result() is called consecutively, the first result takes effect.

    opsObj.wait() indicates that script execution continues after the next event occurs. The opsObj.result() function returns the script processing result and suspends the script until the next event occurs. This implements resident script processing.

Translation
Download
Updated: 2019-04-03

Document ID: EDOC1100075372

Views: 12942

Downloads: 18

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