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).
Save and Restore Script Variables

Save and Restore Script Variables

  • Function Description

    The OPS ERE allows script variables to be saved and restored.

  • Command Prototype, value)


  • Parameter Description
    Table 3-916  Parameters supported by APIs for saving and restoring script variables




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


    Specifies the name of a variable. The value is a string of a maximum of 16 characters.


    Specifies the value of a variable. The value can be a string of a maximum of 1024 characters or an integer ranging from –2147483648 to 2147483647.

  • Example
    import ops
    test = ops.ops()
    print 'test context save'
    a, des="varInt1", 111)
    print 'save varInt1 return' , a
    a, des="varStr2", 'testString')
    print 'save varStr2 return' , a
    print 'test context save over'
    import ops
    test = ops.ops()
    print 'test context retrieve'
    a, des = test.context.retrieve("varInt1")
    print 'retrieve varInt1 = ', a
    a, des = test.context.retrieve("varStr2")
    print 'retrieve varStr2 = ', a
    print 'test context retrieve over'
  • Description of Return Values

    A maximum of 100 script variables can be stored. A variable with the same name as one that has been stored will replace this one.

    • Return value of

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

      Second return value: result description expressed in character strings.

    • Return value of opsObj.context.retrieve

      First return value: If None is returned, restoring a specified variable fails. Otherwise, specified variable values are returned.

      Second return value: result description expressed in character strings.

Updated: 2019-05-05

Document ID: EDOC1100004147

Views: 60687

Downloads: 28

Average rating:
This Document Applies to these Products

Related Version

Related Documents

Previous Next