< Home

Licensing Requirements and Limitations for OPS

Involved Network Elements

Other network elements are not required.

Licensing Requirements

OPS is a basic feature of a switch and is not under license control.

Feature Support in V200R019C10

All models of S2720, S5700, and S6700 series switches support OPS.

For details about software mappings, visit Hardware Query Tool and search for the desired product model.

Feature Limitations

OPS Specifications

  • A maximum of 100 Python script assistants can be configured on a switch. On the S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI, S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5720I-SI, and S5720S-SI, a maximum of six events subscribed in Python scripts can be matched simultaneously. On other switches, a maximum of ten events subscribed in Python scripts can be matched simultaneously.

  • A maximum of 100 user-defined environment variables and 100 script variables are supported on a switch.

Required Python Versions

When editing a Python script, ensure that the used Python version matches the switch software version.

Switch Software Version

Required Python Version

V200R012

2.7.1

V200R013

2.7.15

V200R019C00

3.7.1

V200R019C10

3.7.3

Precautions in Writing a Python Script

When the command line event subscription API (ops.cli.subscribe) is used:

  • If an original command of the switch is subscribed, sync is set to True, and the return value of ops_execute is set to 0, the original command of the switch is skipped, that is, the original CLI of the switch is invalid.

  • If an original command of the switch is subscribed, and sync and async_skip are set to False and True respectively, the original command of the switch is skipped, that is, the original CLI of the switch is invalid.

  • You are advised to specify the regular expression matching the command as a complete keyword or command.

    • If an incomplete command or keyword is used, and both enter and sync are set to True, the subscription event will be mismatched. For example, if the regular expression is set to display, any command that contains display will match the event and trigger the action in the function.

    • If an incomplete command or keyword is used, for example, dis, and enter, sync, and async_skip are set to True, False, and True respectively, all commands that contain dis will become invalid.

    • If an incomplete command or keyword is used, for example, display, and enter and sync are set to False and True respectively, any registered command that contains display will match the event and trigger the action in the function.

    • If an incomplete command or keyword is used, for example, display, and enter, sync, and async_skip are set to False, False, and True respectively, all registered commands that contain display will become invalid.

  • Do not specify the regular expression matching the command as a single space character.

    • When the regular expression is a single space character and the user enters only a single space, the action in the execution function cannot be triggered.

    • If the regular expression is a single space character, and enter, sync, and async_skip are set to True, True, and True respectively, the subscription event will be mismatched if you enter any command containing spaces.

    • If the regular expression is a single space character, and enter, sync, and async_skip are set to True, False, and True respectively, any command that contains spaces will be invalid.

  • If the regular expression matching the command contains a question mark (?), for example, "shutdow?", the subscription event cannot be matched if shutdow? is entered.

  • If the regular expression matching the command contains other special characters except for a question mark (?), the switch should perform conversion for special characters twice during Python script execution. Foe example, if the regular expression matching the command is "shutdown \\a", the regular expression becomes "shutdown \a" after the first conversion and becomes "shutdown a" after the second conversion. Therefore, the subscription event is matched if shutdown a is entered. You need to ensure that special characters become visible characters after the conversion is performed twice. Otherwise, the subscription event may not be matched because invisible characters cannot be entered in the CLI.

  • To prevent failures to copy or delete Python script files, ensure that the command lines subscribed using ops.cli.subscribe are different from the names of Python script files.

When a timer event subscription API (ops.timer.cron, ops.timer.relative, ops.timer.absolute, or ops.timer.countdown) 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 switch by running the reboot fast command, the switch restarts repeatedly. In this case, you can press Ctrl+B to enter the BootLoad menu when the switch is started and modify the configuration file to restore the switch.

  • 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 cannot be used and the CPU usage of the switch increases, affecting the switch 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.

In the Python script, if the CLI channel is opened using the ops.cli.open API, use the ops.cli.close API to close the CLI channel after commands are executed.

In OPS API, the value of a character string cannot contain \0.

Other Restrictions

  • OPS cannot be configured after the working mode of the switch is switched to the NETCONF mode.

  • You can configure a Python script assistant only after the Python script is installed.

  • You need to be familiar with the Python language and correctly write Python scripts.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >