Testing Python-script statements
While developing a Python script, you can test Network OS calls by entering them in the switch Python command shell. After the script is stable, you copy it to the switch and then test it further by running it from the command line.
In privileged EXEC mode, enter the
python command to access the Python shell.
Python 3.3.2 (default, Jun 5 2013, 11:04:06) [GCC 4.3.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>>Note that the device# prompt changed to a >>> Python prompt:
Enter the script statements one at a time, verifying that they run as expected.
>>> cmd_config_vlans = CLI('configure \n interface vlan 101-103 \n exit') !Command: configure \n interface vlan 101-103 \n exit !Time: Tue Jan 6 00:24:17 2015 >>>
- Make corrections as needed.