Use Digidevice.cli To Execute Cli Commands - Digi TX54 User Manual

Hide thumbs Also See for TX54:
Table of Contents

Advertisement

Applications

Use digidevice.cli to execute CLI commands

Use the digidevice.cli Python module to issue CLI commands from Python to retrieve status and
statistical information about the device.
For example, to display the system status and statistics by using an interactive Python session, use
the
show system
1. Log into the TX54 command line as a user with shell access.
Depending on your device configuration, you may be presented with an Access selection
menu. Type shell to access the device shell.
2. At the shell prompt, use the python command with no parameters to enter an interactive
Python session:
# python
Python 3.6.10 (default, Jan 31 2020, 08:45:19)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
3. Import the cli submodule:
>>> from digidevice import cli
>>>
4. Execute a CLI command using the cli.execute(command) function. For example, to print the
system status and statistics to stdout using the show system command:
>>> response = cli.execute("show system")
>>>
>>> print (response)
Model
Serial Number
Hostname
MAC
Hardware Version
Firmware Version
Bootloader Version
Current Time
CPU
Uptime
Temperature
Contact
>>>
5. Use Ctrl-D to exit the Python session. You can also exit the session using exit() or quit().
TX54 User Guide
command with the cli module:
: Digi TX54
: TX54-000000
: TX54
: 00:40:D0:13:35:36
: 50001947-01 1P
: 19.11.72.58
: 1
: 19-12-06-09.25.36 +0000
: 0.9
: 3 days, 0 hours, 49 minutes, 8 seconds (262148s)
: 39C
: Techpubs
Digidevice module
485

Advertisement

Table of Contents
loading

Table of Contents