Smart Scripting | 31
Using UNIX Shell Scripting
Use the information in this section to create a UNIX script using the UNIX API and
run the script on a Dell Force10 switch. For information on how to create and run a
PERL or Python script using the PERL or Python API, see Supported UNIX Utilities
and Using the Python API.
Creating a UNIX API Script
Use the information in this section to create a UNIX shell script to be run on a Dell
Force10 switch.
The F10SmartScriptUtils.py file is the main API library file that contains the
functions that you can include in a UNIX shell script. The F10SmartScriptUtils.py
file is downloaded with the Programmatic Management package and is stored at /usr/
pkg/scripts/smartutils. Table 3-5 describes the FTOS operations that you can invoke
from a UNIX shell script, including the supported functions and required arguments.
Figure 3-5 shows an example of how to write a script in the UNIX shell scripting
language. You can store a UNIX shell script anywhere on the switch.
Figure 3-5. Script Written in the UNIX Shell Scripting Language: Example
#!/bin/sh
i=$1
while [ $i -le $2 ]
do
echo $i
/usr/pkg/bin/python /usr/pkg/scripts/smartutils/F10SmartScriptUtils.py createvlanid $i
(( i++ ))
done
Table 3-5. Supported API Functions in UNIX Shell Scripts
Function Arguments Description
addlaginttovlan lagId, vlanId, tagFlag Adds a port channel (LAG) to a VLAN.
tagFlag values: 1 (tagged) or 0 (untagged).
addphyinttovlan stackunitNum, portId
vlanId, tagFlag
Adds an interface to a VLAN.
tagFlag values: 1 (tagged) or 0 (untagged).
createvlanid vlanId Creates a VLAN with a specified VLAN ID.
deletevlanid vlanId Deletes a VLAN with a specified VLAN ID
makelagintnoshutdown lagId Enables the specified port channel.
makelagintshutdown lagId Disables the specified port channel.
makelagintswitch lagId Configures the specified port channel (LAG) as a Layer 2
switchport.