Administrator Guide

Dell Networking Python Support 1657
49
Dell Networking Python Support
Dell Networking switches support installation and execution of Python
applications. Python applications that are to be executed on the switch must
be developed and tested offline to the maximum degree possible. The switch
does not offer interactive shell access for development of Python scripts, nor
does the Dell Networking switch come with all of the normal Python
"batteries included" modules. A list of the included packages is in the example
below. Output from Python scripts is sent to the serial console, so a serial
connection is mandatory when developing scripts.
An example Python script that prints some useful information is shown
below. Explanation of Python syntax is beyond the scope of this document.
Refer to the 2.7.10 version of Python documentation available elsewhere.
#!/usr/bin/env python
import sys
print "Hello World!\n"
print (sys.version)
help('modules')
To execute this script on the switch, save the lines above in a file named
"app". Package the app script using the following commands on a Linux
system. The package MUST be a gzipped tarball with a .tgz or .tar.gz
extension. It is required that the permissions be set on the app file prior to
packaging; i.e., user read, write, and execute must be set. Group and other
permissions need not be set. Application names can be a maximum of 15
characters.
/home/jmclendo/tftpboot>chmod u+rwx app
/home/jmclendo/tftpboot>tar czf app.tgz app
Copy the resulting file to the switch using the copy command with the
application target keyword. The application file name after the application
keyword is required and must have a .tgz or .tar.gz extension or the tarball will
not be extracted into the user-apps directory.
console#copy tftp://10.27.9.99/jmclendo/app.tgz application app.tgz
Transfer Mode.................................. TFTP