< Home

script-assistant python

Function

The script-assistant python command configures a Python script assistant.

The undo script-assistant python command deletes a Python script assistant.

By default, no Python script assistant is configured.

Format

script-assistant python script-name

undo script-assistant python script-name

Parameters

Parameter

Description

Value

script-name

Specifies the name of a Python script assistant, namely, a Python script name for a script assistant.

The value must be the name of a script file that has been installed.

NOTE:

script-name cannot be set to the file name of a built-in Python script, including ConfigParser.py, copy_reg.py, locale.py, sre.py, Queue.py, decimal.py, macurl2path.py, sre_compile.py, StringIO.py, dis.py, modulefinder.py, sre_constants.py, UserDict.py, dummy_thread.py, ntpath.py, sre_parse.py, UserList.py, dummy_threading.py, nturl2path.py, stat.py, UserString.py, filecmp.py, numbers.py, string.py, __future__.py, fileinput.py, opcode.py, stringold.py, _abcoll.py, fnmatch.py, os.py, struct.py, _pyio.py, formatter.py, os2emxpath.py, subprocess.py, _strptime.py, fractions.py, pickle.py, sysconfig.py, _threading_local.py, functools.py, pkgutil.py, textwrap.py, _weakrefset.py, genericpath.py, platform.py, threading.py, abc.py, getopt.py, posixpath.py, token.py, argparse.py, getpass.py, pprint.py, tokenize.py, atexit.py, gettext.py, re.py, trace.py, base64.py, glob.py, repr.py, traceback.py, bisect.py, heapq.py, runpy.py, types.py, calendar.py, imputil.py, sched.py, user.py, codecs.py, inspect.py, sets.py, warnings.py, collections.py, io.py, shutil.py, weakref.py, contextlib.py, keyword.py, site.py, xmllib.py, copy.py, linecache.py, socket.py, _cli.py, _device.py, _frame.py, _route.py, _timer.py, _common.py, _environment.py, _iclog.py, _snmp.py, _trap.py, _context.py, _farg.py, _lldp.py, _terminal.py, and ops.py.

Views

OPS view

Default Level

3: Management level

Usage Guidelines

Usage Scenario

As networks are developing rapidly, existing network devices provide only limited functions and predefined services, failing to meet the requirements for diversified services. You can run the script using OPS to implement customized functions.

The device supports a built-in Python script interpreter. You can run the script-assistant python command to run a Python script and register the events defined in the script.

Prerequisites

The script has been uploaded to the device and installed using the ops install file command in the user view.

Precautions

Only one assistant can be configured for a Python script. A maximum of 100 Python script assistants can be configured on the device.

The system does not check correctness of the Python script.

If you run the undo script-assistant python command to uninstall the script assistant, the corresponding Python script will be terminated.

Example

# Configure a script assistant for the script config.py.

<HUAWEI> ops install file config.py
<HUAWEI> system-view
[HUAWEI] ops
[HUAWEI-ops] script-assistant python config.py
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >