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

Configuration Guide - Device Management

S7700 and S9700 V200R013C00

This document describes the configurations of Device Management, including device status query, hardware management, CSS, SVF, PoE, OPS, OIDS, energy-saving management, information center, fault management, NTP, synchronous ethernet, PTP.
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).
Timer Event Subscription

Timer Event Subscription

Interface Name

Timer event subscription

Application Phase

Subscription phase

API Prototype

result1_value, result2_description = ops.timer.cron(tag, crontime)

result1_value, result2_description = ops.timer.relative(tag, timelength)

result1_value, result2_description = ops.timer.absolute(tag, timelength)

result1_value, result2_description = ops.timer.countdown(tag, timelength)

Description

Parameter

Description

Value

tag

Indicates conditions.

The value is a string of 1 to 12 case-insensitive characters, consists of letters, digits, and underscores (_), and starts with a letter. The value cannot be one of the following: "", None, and, or, andnot. The value cannot contain \0.

crontime

Indicates the cron timer time.

The value is a character string in m h d M D Y format.

  • m: indicates minute. The value is an integer that ranges from 0 to 59.

  • h: indicates hour. The value is an integer that ranges from 0 to 23.

  • d: indicates a day in a month. The value is an integer that ranges from 1 to 31.

  • M: indicates month. The value is an integer that ranges from 1 to 12.

  • D: indicates a day in a week. The value is an integer that ranges from 0 and 7. The value 0 or 7 indicates Sunday, and the values 1 through 6 represent from Monday through Saturday.

  • Y: indicates year. The value is an integer that ranges from 2000 to 2099. If Y is not specified, it indicates the current year.

timelength

Indicates the timer value.

The value is an integer that ranges from 0 to 2147483647, in seconds.

Return Value

The result1_value and result2_description in the API prototype indicate return values.

The result1_value is the first return value, 0 indicates success, and 1 indicates failure.

The result2_description is the second return value, indicating the failure cause. It is returned only when the first return value is 1.

Usage Description

If multiple simple events are defined using the same timer in the subscription phase, but the simple events are not combined through the Multi-Condition Combination API, the Python script assistant cannot be configured.

The timer event subscription API provides four timers:

  • cron is a timer defined based on CRON standards of the UNIX operating system and the cron timer time is in the m h d M D Y format.

    • If m is *, the action in the execution phase is executed every minute. If h is *, the action in the execution phase is executed every hour. The same rule applies to d, M, D, and Y. If Y is * or is not specified, the action in the execution phase is executed every year.

    • If m is a-b, the action in the execution phase is executed from the ath minute to bth minute. If h is a-b, the action in the execution phase is executed from the ath hour to bth hour. The same rule applies to d, M, D, and Y.

    • If m is */n, the action in the execution phase is executed every n minutes. If h is */n, the action in the execution phase is executed every n hours. The same rule applies to d, M, D, and Y.

    • If m is "a, b, c,... ", the action in the execution phase is executed in the ath, bth, cth minutes and so on. If h is "a, b, c,... ", the action in the execution phase is executed in the ath, bth, cth hours and so on. The same rule applies to d, M, D, and Y.

    For example, "15 16 1 * *" indicates that the action in the execution phase is executed at 16:15 on the first day of each month, and "12 * * 1-5" indicates that the action in the execution phase is executed at 12:00 from Monday to Friday in each week.

  • relative indicates a cyclic timer, and the action in the execution phase is executed every timelength value seconds.

  • absolute indicates an absolute timer, timelength indicates the number of seconds calculated since 00:00 on January 1, 1970, and the action in the execution phase is executed when the timer expires.

  • countdown indicates a timer triggered only once, and the action in the execution phase is executed after the timelength value counts down to 0.

When a timer event subscription API is used and the timer is set improperly, for example, a short cycle is set when the ops.timer.relative API is used to set the cyclic timer.

  • If the action triggered by the timer is to restart the device by running the reboot fast command, the device restarts repeatedly. In this case, you can press Ctrl+B to enter the BootLoad menu when the device is started and modify the configuration file to restore the device.

  • If the action triggered by the timer is to restart the interface by running the restart (interface view) command, or shut down or restart the interface repeatedly by running the shutdown and undo shutdown commands, the interface may not be used and the CPU usage of the device increases, affecting the device performance.

  • If the action triggered by the timer is to record logs, the logs of other service modules will be deleted as the flash memory space becomes smaller, affecting fault analysis and location.

Example

Example 1: The corresponding action is triggered at 20:00 on the 1st day of each month.

value, time1 = ops.timer.cron("timer1", "0 20 1 * *")

Example 2: The corresponding action is triggered after 3600 seconds (1 hour).

value, time2 = ops.timer.countdown("timer2", 3600)
Translation
Download
Updated: 2019-04-20

Document ID: EDOC1100065738

Views: 40594

Downloads: 37

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