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).
Subscribe to Route Change Event

Subscribe to Route Change Event

  • Function Description

    The OPS ERE provides route change event subscription.

    After you subscribe to route change events and a route change event is triggered, the system executes the ops_execute() function in the Python script.

    This API can only be used in the ops_condition() function of the maintenance assistant script.

  • Command Prototype

    opsObj.routing.subscribe (tag, network, maskLen, minLen=None, maxLen=None, neLen=None, type=all, protocol=all)

  • Parameter Description
    Table 3-853  Parameters supported by route change event APIs

    Method

    Description

    opsObj

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

    tag

    Specifies a condition ID. The value is a string of 1 to 8 case-sensitive characters that starts with a letter and contains letters, digits, or underscores (_). Enter quotation marks ("") or None for the only one condition. tag cannot be set to andor, or not.

    network

    Specifies a route prefix. The value is in the IP address format, such as 10.0.0.0.

    maskLen

    Specifies a mask length. The value is an integer ranging from 0 to 32.

    minLen

    Specifies the minimum mask length. The value must be greater than or equal to maskLen.

    maxLen

    Specifies the maximum mask length. The value must be greater than or equal to minLen.

    neLen

    Specifies a length that cannot be a mask length. The value must be greater than or equal to minLen and less than or equal to maxLen.

    type

    Specifies a route change type. The value can be adddeletemodify, or allall indicates all route changes.

    protocol

    Specifies a protocol. The default value is all, indicating all attributes.

  • 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
    def ops_condition(_ops):
        ret, reason = _ops.route.subscribe("con0", "10.1.1.1",None,8,32,15,"all","all")
        ret, reason = _ops.correlate("(con0 and con1)")
        return ret
    def ops_execute(_ops): 
        a, des= _ops.context.save("test.py", 'Route event trigger')
        return 0

    When the route 10.1.1.1/24 is added or deleted, a route change event is triggered.

Translation
Download
Updated: 2019-03-21

Document ID: EDOC1000166567

Views: 21033

Downloads: 116

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