278
Comware 7 extended Python API
The Comware 7 extended Python API is compatible with the Python syntax.
Importing and using the Comware 7 extended
Python API
To use the Comware 7 extended Python API, you must import the API to Python.
Use either of the following methods to import and use the Comware 7 extended Python API:
•
Use
import comware
to import the entire API and use
comware.API
to execute an API.
For example, to use the extended API
Transfer
to download the
test.cfg
file from TFTP server
192.168.1.26:
<Sysname> python
Python 2.7.3 (default)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import comware
>>> comware.Transfer('tftp', '192.168.1.26', 'test.cfg', 'flash:/test.cfg', user='',
password='')
<comware.Transfer object at 0xb7eab0e0>
•
Use
from comware import
API
to import an API and use
API
to execute the API.
For example, to use the extended API
Transfer
to download the
test.cfg
file from TFTP server
192.168.1.26:
<Sysname> python
Python 2.7.3 (default)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from comware import Transfer
>>> Transfer('tftp', '192.168.1.26', 'test.cfg', 'flash:/test.cfg', user='',
password='')
<comware.Transfer object at 0xb7e5e0e0>
Comware 7 extended Python API functions
CLI class
CLI
Use
CLI
to execute Comware 7 CLI commands and create CLI objects.
Syntax
CLI
(
command
=‘’,
do_print
=True)
Parameters
command
: Specifies the commands to be executed. To enter multiple commands, use a space and a
semicolon (;) as the delimiter. To enter a command in a view other than user view, you must first enter
Содержание FlexNetwork 10500 Series
Страница 139: ...130 Sysname display version ...