Administrator Guide

19 Python Scripting for Dell Networking N-Series | Version 1.0.1
console#application start <filename>
Opening telnet session to the device
Creating 1000 VLANs on the switch
Verifying the VLAN database
VLANs are created on the switch
Closing the telnet session
Run the appropriate show commands to verify the results.
console#show vlan
VLAN Name Ports Type
----- --------------- ----------- ------------
1 default Po1-128, Default
Gi1/0/1-48,
Te1/0/1-2
2 VLAN0002 Static
3 VLAN0003 Static
4 VLAN0004 Static
.
.
.
1001 VLAN1001 Static
1002 VLAN1002
Static
3.4 Testing offline (Best Practice)
Administrators can test Python scripts without having to compress and then copy the compressed Python
script to the switch each time between edits. The recommended method is to use a Linux system to run the
Python scripts, while establishing a telnet connection to the Dell N-Series switch under test. For instance, Dell
EMC tested the script shown in 3.3Examples of Python scripting on Dell N-Series
several times from a remote
Ubuntu system until the script was fully validated and working. Doing this prior to performing the tftp copy onto
the switch can save valuable time, drastically cutting down on compression (tar.gz and tgz) and copying (tftp)
tasks between debugging sessions.
Dell EMC validated the Example 3 script using Ubuntu v. 14.04, with Python v. 2.7.6 installed (default). As
written, this script requires no changes since the ”hostname = 'xx.xx.xx.xx'line uses the actual
OOB IP address of the switch. The loopback IP address would also work but only after being copied to the
switch. If using the loopback address in the script, it will need to be temporarily changed to the OOB/
management IP address for remote testing in order to access the switch over the network.
From the Ubuntu terminal command line, go to the folder where the script resides, or set the path accordingly,
in order to execute the script. Run the script by typing python <script.py> and Enter. The script will create
1000 VLANs on the switch just as if running it directly from the switch.