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

CX11x, CX31x, CX710 (Earlier Than V6.03), and CX91x Series Switch Modules V100R001C10 Configuration Guide 12

The documents describe the configuration of various services supported by the CX11x&CX31x&CX91x series switch modules The description covers configuration examples and function configurations.
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).
Configuring an Assistant

Configuring an Assistant

This section describes how to configure an assistant to facilitate device maintenance.

Pre-configuration Tasks

Before configuring an assistant, complete the following task:
  • Powering on the device and ensuring that the self-check is successful.

Configuration Process

The following configuration tasks can be performed at any sequence as required.

Configuring a Command Execution Assistant

Context

If you want a device to automatically run a few commands in a specific condition to implement a simple function, bind the commands to an assistant.

NOTE:
  • An assistant can execute a maximum of 10 commands, in ascending order of configured priorities. The commands bound to an assistant must have different priorities. Otherwise, a command configured later overrides a previously configured command with the same priority.

  • Ensure that the specified commands are correct and complete. The system does not provide help information or check the correctness of the commands bound to an assistant.

  • Assistants are executed on the background. Therefore, it is not recommended to bind interactive commands or jump commands such as telnet and stelnet to an assistant.

  • When executing an interactive command that requires a Y/N choice, the system automatically selects Y. When executing an interactive command that requires input of a character string, the system waits until the command times out, and then runs the subsequent command.

  • The system switches to the user view by default to run the specified commands. If a command needs to be executed in the system view, run the execute priority command system-view command first. Otherwise, the command configuration does not take effect.

  • If a command needs to be committed and the two-stage configuration mode is used in the system, run execute priority command commit after specifying this command. Otherwise, the configuration does not take effect.

Procedure

  1. Run the system-view command to enter the system view.
  2. Run the ops command to enter the OPS view.
  3. Run the assistant task-name command to create an assistant.
  4. Configure a trigger condition for the assistant.

    • Run the condition alarm level compare-operator level-name command to set an alarm severity.

    • Run the condition { alarm | event } feature feature-name name name command to specify an alarm or event name.

    • Run the condition timer cron minutes hours days-of-month months days-of-week [ years ] command to set a timer.

    Each assistant can have only one trigger condition.

  5. Run the execute priority command command-string command to specify a command that the assistant will run.

    You can run the command multiple times to specify multiple commands to run. An assistant can run a maximum of 10 commands.

  6. Run the commit command to commit the configuration.

Configuring a Batch File Execution Assistant

Context

If you want a device to automatically run some commands in a specific condition to implement a function, add these commands to a batch file (*.bat), install the batch file, and then bind it to an assistant. When the device executes the assistant, it runs the commands in the batch file associated with the assistant in the sequence at which the commands were written into the batch file.

NOTE:
  • An assistant can run only one batch file.

  • Ensure that the specified batch file is correct and complete. The system does not check correctness of the batch file.

  • Assistants are executed on the background. Therefore, it is not recommended to add interactive commands or jump commands such as telnet and stelnet to the batch file.

  • The system switches to the user view by default to run the commands in the batch file. If a command needs to be executed in the system view, run the system-view command to switch to the system view. Otherwise, the command is executed in the user view and the configuration cannot take effect.

  • If a command in the batch file needs to be committed and the two-stage configuration mode is used in the system, write the commit command in the batch file. Otherwise, the configuration does not take effect.

Procedure

  1. Upload a batch file to the device. For details on how to upload a file to the device, see File Management in the CX11x&CX31x&CX91x Series Switch Modules Configuration Guide - Basic Configuration.
  2. Run the ops install file file [ destination directory ] command in the user view to install the batch file.

    If you do not specify destination directory in the command, the batch file is installed in the default path flash:/$_user/. If this parameter is specified, the batch file is installed in the path flash:/$_user/directory/.
    NOTE:

    If the specified directory does not exist, the system automatically creates the directory. A maximum of seven levels of subdirectories can be created under flash:/$_user/.

  3. Run the system-view command to enter the system view.
  4. Run the ops command to enter the OPS view.
  5. Run the assistant task-name command to create an assistant.
  6. Configure a trigger condition for the assistant.

    • Run the condition alarm level compare-operator level-name command to set an alarm severity.

    • Run the condition { alarm | event } feature feature-name name name command to specify an alarm or event name.

    • Run the condition timer cron minutes hours days-of-month months days-of-week [ years ] command to set a timer.

    Each assistant can have only one trigger condition.

  7. Run the execute priority batch-file file-name command to bind the batch file to the assistant.

    An assistant can run only one batch file.

  8. Run the commit command to commit the configuration.

Configuring a Python Script Execution Assistant

Context

You can bind a Python script to an assistant. When the trigger condition of the assistant is met, the assistant automatically runs the Python script.

NOTE:

Before binding a Python script to an assistant, upload the Python script to the device and install the script. The size of a Python script cannot exceed 1 MB.

Procedure

  1. Upload a Python script to the device. For details on how to upload a file to the device, see File Management in the CX11x&CX31x&CX91x Series Switch Modules Configuration Guide - Basic Configuration.
  2. Run the ops install file file [ destination directory ] command in the user view to install the Python script.

    If you do not specify destination directory in the command, the Python script is loaded to the default path flash:/$_user/. If this parameter is specified, the Python script is loaded to the path flash:/$_user/directory/.
    NOTE:

    If the specified directory does not exist, the system automatically creates the directory. A maximum of seven levels of subdirectories can be created under flash:/$_user/.

  3. Run the system-view command to enter the system view.
  4. Run the ops command to enter the OPS view.
  5. Run the assistant task-name command to create an assistant.
  6. Configure a trigger condition for the assistant.

    • Run the condition alarm level compare-operator level-name command to set an alarm severity.

    • Run the condition { alarm | event } feature feature-name name name command to specify an alarm or event name.

    • Run the condition timer cron minutes hours days-of-month months days-of-week [ years ] command to set a timer.

    Each assistant can have only one trigger condition.

  7. Run the execute priority python file-name [ arguments ] command to bind a Python script to the assistant.

    An assistant can run only one Python script.

  8. Run the commit command to commit the configuration.

Checking the Configuration

Procedure

  • Run the display ops assistant { history | current | verbose } [ name task-name ] command to check information about an assistant.
  • Run the display ops script [ dir-or-file-name ] command to check the directory where a script is installed.
Translation
Download
Updated: 2019-08-09

Document ID: EDOC1000041694

Views: 59450

Downloads: 3623

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