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 the OPS

Configuring the OPS

This section describes how to configure the OPS.

Pre-configuration Tasks

Before configuring the OPS, 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.

Manually Running a Python Script

Context

To maintain a device using a Python script, you can bind the Python script to an assistant and configure the assistant to run the Python script in the specified condition. Another method is to manually run the Python script using a command.

You can manually run a script on the foreground or background:
  • Foreground: If the script runs on the foreground, you can see information generated during script execution and enter information in interactive mode. The information you enter is transparently transmitted to the script, and the OPS does not check whether the interaction times out.

    You can stop the script by pressing Ctrl+C. If the script is configured to ignore the Ctrl+C operation, it continues running.

  • Background: All information generated during script execution is shielded, and all information you enter is sent to the script as null strings.

NOTE:
  • Before running a Python script, upload the Python script to the device and install the Python script. The size of a Python script cannot exceed 1 MB.

  • If you close the current window while the Python script is running on the foreground, the script stops running.

  • A maximum of 10 scripts can be executed manually at the same time.

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 ops run python [ background ] file-name [ arguments ] command to run the Python script.

    If you do not specify background in the command, the Python script is executed on the foreground. If you specify background, the Python script is executed on the background.

Configuring an Assistant to Run a Python Script

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 process { history | current | verbose } command to check information about an OPS task.
  • 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: 57183

Downloads: 3617

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