Smart Scripting | 23
Figure 3-2. Execution of a PERL, Python, and Shell Script from a UNIX Shell: Example
Using the PERL API
Use the information in this section to create a PERL script using the PERL API and
run the script on a Dell Force10 switch. For information on how to create and run a
Python script using the Python API, see Using the Python API.
Creating a PERL API Script
The Programmatic Management package provides a PERL API library containing the
supported functions (described in Table 3-2), which can be used in a PERL script to
invoke FTOS operations on a switch. The PERL API library is stored in the
F10SmartUtils.pl file at /usr/pkg/scripts/smartutils.
You code FTOS API functions in a PERL script as shown in the following example:
FTOS# start shell <---------------------------------- Log on to a UNIX shell
4.4 BSD UNIX () (ttyp0)
login: admin
Password:
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002
The NetBSD Foundation, Inc. All rights reserved.
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
The Regents of the University of California. All rights reserved.
$ cd /f10/flash/scripts
$ ls <------------------------------------------------- List the existing scripts
createVlans.pl createVlans.py createVlans.sh
$ ./createVlans.pl 12 14 <-------------------------- Execute the PERL script using either command
$ perl createVlans.pl 12 14
$ ./createVlans.py 12 14 <-------------------------- Execute the Python script using either command
$ python createVlans.py 12 14
$ ./createVlans.sh 12 14 <-------------------------- Execute the UNIX shell script