279
the commands used to enter the view. For example, you must enter
’system-view ;local-user test
class manage’
to execute the
local-user test class manage
command.
do_print
: Specifies whether to output the execution result:
•
True
—Outputs the execution result. This value is the default.
•
False
—Does not output the execution result.
Usage guidelines
This API supports only Comware commands. It does not support Linux, Python, or Tcl commands.
Returns
CLI objects
Examples
# Add a local user named
test
.
<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.CLI('system-view ;local-user test class manage')
Sample output
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] local-user test class manage
New local user added.
<comware.CLI object at 0xb7f680a0>
get_output
Use
get_output
to get the output from executed commands.
Syntax
CLI.get_output()
Returns
Output from executed commands
Examples
# Add a local user and get the output from the command.
<Sysname> python
Python 2.7.3 (default)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import comware
>>> c = comware.CLI('system-view ;local-user test class manage', False)
>>> c.get_output()
Sample output
['<Sysname>system-view', 'System View: return to User View with Ctrl+Z.',
'[Sysname]local-user test class manage', 'New local user added.']
Содержание FlexNetwork 10500 Series
Страница 139: ...130 Sysname display version ...