19.1.1 Overview
A high-performance script is a function that enables the configuration and operation of the Switch to be programmed within the Switch. This function can be applied to the following applications.
-
Automation of operations
For example, the command can be executed automatically when an operation message is output.
-
Customizing operational functions
For example, you can output user-generated operational messages.
The following figure shows the main features that make up the advanced script and their relevance.
|
- <Structure of this section>
(1) Script language execution function
Scripts are programs for the configuration and operation procedures of the Switch. The script language execution function executes the created script.
The Switch uses Python for scripting. Python has the following characteristics:
-
Be highly readable
It provides high readability by unifying the description methods, such as aligning the code blocks with indentation.
-
Easy debugging and prototyping
Scripts created with Python can be run one line at a time in the interpreter method, making debugging and prototyping easier.
-
Easy reuse of library functions
Python provides a library of frequently used functions, such as email sending and managing the Switch. The functions provided by the library can be executed simply by referencing the library from the script. This makes it easy to customize the operation.
(2) Script action function
The script action function executes actions such as executing commands to the Switch from scripts. The following actions are available:
-
A number of useful actions-e-mail and file access-using the standard libraries that are distributed with Python body
-
Actions such as command execution and operation message output using an extended library specific to the Switch
-
Your own actions using user-created libraries
The following table describes the script actions that can be executed by an extended library specific to the Switch.
Action |
Description |
---|---|
By executing a command |
Executes the command specified in the script. |
Operation message output |
Outputs the specified arbitrary character string as an operation message. |
(3) Event monitoring function
The event monitor function monitors the status of the device and network. Notifies the following scripts and applets when a monitored state change (event) occurs. The notification destination varies depending on the registration method of the monitoring event.
-
Notify the running script of an event
Use the extended library provided by the Switch to register and detect monitoring events.
-
Notify applet of events
The configuration provided by the applet function is used to register monitoring events.
The following table lists the monitoring events.
Monitoring event |
Description |
---|---|
Operational message monitoring |
Monitors the output operation messages. |
Timer monitoring |
The timer is used to monitor a predetermined time. Timers can specify the time in two formats:
|
(4) Applet function
The applet function is a function to execute a previously registered action when an event occurs in cooperation with the event monitoring function.
Monitor events and actions are registered in the configuration. Note that the only supported action is to start the script file (event startup script).
(5) How to use advanced scripts
To use a high-performance script, first create the configuration and operation of the Switch as a script. At this time, you can freely combine the script action function, event monitoring function, and applet function.
When the script is executed with the script language execution function, each process described in the script is executed. In this way, you can use advanced scripts to program and execute the configuration and operation of the Switch.