OPS Implementation
The OPS module monitors key events of a device through the event
subscriber and the action execution module takes the action corresponding
to the monitored events. Using the event subscription, you can define
events that need to be monitored, for example, entered commands, and
route changes on the network, as well as logs and traps generated
on the device. Once an event is monitored, the OPS module executes
the corresponding action to implement customized functions.
The OPS function is implemented based on OPS APIs. You can define
events to be monitored and actions to be executed using a Python script
based on OPS APIs Supported
by a Device.
Figure 1 shows the OPS implementation
process.
Figure 1 OPS implementation process
Event Subscription
The event subscription
function is used to monitor events on a device and associate the events
with action execution modules. This function is implemented through
event monitors. Different event monitors are mutually independent.
The following are the different types of event monitors:
- Command line monitor: monitors commands that users enter on a
device.
- Timer monitor: monitors the time or time segment defined by the
timer and triggers the corresponding action when the specified time
is reached. The following are the four types of timers:
- CRON timer: is defined based on CRON standards of the UNIX operating
system and specifies time in the s m h d M D Y format, in which, s
indicates second, m indicates minute, h indicates hour, d indicates
a day in a month, M indicate month, D indicates a day in a week (Monday
is the first day in a week), and Y indicates year.
- Cyclic timer: starts after a Python script is installed and a
script assistant is configured on a device and specifies an interval
for cyclic timing.
- Absolute timer: is the absolute time since 00:00 on January 1,
1970. For example, to set a timer to be started at 12:00:00 on December
22, 2017, use the absolute timer. The timer value is number of seconds
calculated from 00:00 on January 1, 1970 to 12:00:00 on December 22,
2017.
- Timer triggered only once: starts after a Python script is installed
and a script assistant is configured on the device. The timer stops
when the timer counts down to 0.
- Route change monitor: monitors route changes on a device, for
example, a route is added or deleted, or an original route is changed.
You can specify routing protocols and network segments to be monitored.
- Log monitor: monitors logs generated on a device. Logs can be
matched based on the log module name, alias, content, or severity.
- Trap monitor: monitors traps generated on a device. Traps can
be matched based on the trap module name, alias, content, OID, or
severity.
- LLDP neighbor change monitor: monitors LLDP neighbor changes on
an interface, for example, an LLDP neighbor is added or deleted.
- Stack status change monitor: monitor events related to the member switch with
a specified stack ID in the stack, including registration, adding,
exiting, and reset of the member switch.
- Interface statistics monitor: monitors packet statistics collected
on a specified interface within a sampling period.
Action Execution
After monitoring an event,
the OPS module responds by triggering the corresponding action. You
can define the action to be taken using a Python script as required.
The action can be:
- Command line action: automatically executes commands, after which
exchange information can be generated to implement exchange between
users and a device.
- SNMP action: provides device information using SNMP, including
details about a leaf node with the specified OID and the next leaf
node.
- Log action: records user logs.
- Terminal action: obtains user-entered content and applies the
content in a script, or displays the user-defined content on the device
to generate a prompt.