Network OS Administration Guide

Supporting Network OS 6.0.1a

Part Number: 53-1003768-04

Guidelines for writing Python scripts

The guidelines for writing Python scripts to run under Network OS are as follows:

  • Although previous experience programming in Python is helpful, experience in other high-level languages is enough to get you started with simple Python scripts.
  • The Python developer either needs experience with Network OS CLI or access to a resource with such experience.
  • To help decide which editor or integrated development environment (IDE) to use, refer to http://www.python.org.
  • Make sure that the appropriate version of the Python interpreter is installed on your development computer. For Network OS 6.0.1, install Python 3.3.2.
  • Make sure that in the Network OS Command Reference you are familiar with the python and the CLI( ) topics.
  • One of the first statements in the script should be from CLI import CLI. This enables the CLI( ) command, by which Python can interact with Network OS.
  • Write the Python script and save it, with a .py suffix. Valid filenames range from 4 through 32 characters (including the suffix). The first character must be alphabetic.
NOTE
For additional sample scripts, refer to Python scripts and run-logs.