Service Manual

Sample script for dellsyslog in Python for S3100 Series
#! /f10/flash/pkg/usr/pkg/bin/python
import sys
import os
print sys.argv[1]
os.system("dellsyslog -s %s 'The Syslog is generated by python'" %(sys.argv[1]))
Sample script for dellsyslog in Perl
#! /usr/pkg/bin/perl
#system("dellsyslog" , "-s $ARGV[0] 'The Syslog is generated by Perl script'")
`dellsyslog -s $ARGV[0] "The Syslog is generated by Perl script"`
Sample script for dellsyslog in Perl for S3100 Series
#! /f10/flash/pkg/usr/pkg/bin/perl
#system("dellsyslog" , "-s $ARGV[0] 'The Syslog is generated by Perl script'")
`dellsyslog -s $ARGV[0] "The Syslog is generated by Perl script"`
Dell SmartScript Utilities
Dell SmartScript utility is an easy API handler for scripting. When you install the Smart Scripting package, sample Perl, Python, and Ruby
scripts install in the
/usr/pkg/scripts/sample_scripts directory. For S3100 series, the directory path is /f10/
flash/pkg/usr/pkg/scripts/sample_scripts. You can also create your own customized scripts and store them anywhere on
the switch, such as in a
/f10/flash or /usr/pkg/ss-scriptsdirectory.
In addition, Dell SmartScript Utils uses the Perl, Python, and Ruby APIs to create scripts that invoke function calls directly in the Dell
Networking OS commands.
Following are the Dell Networking OS APIs:
DellExec — If you need to execute the script inside another script, you can make use of this API.
Syntax: DellExec (scriptName, [args])
DellCliConfig — If you need to congure the list of Dell Networking OS commands, you can make use of this API.
Syntax: DellCliConfig (CLI_list)
where CLI_list can be dened as (”interface vlan 10”, “no shutdown”)
DellCli — If you need to execute a EXEC mode Dell Networking OS command, you can make use of this API
Syntax: Dellcli (“<exec command>”)
Sample script for Perl using DellExec, DellCli, and DellConfig
#! /usr/pkg/bin/perl
#importing DellSSUtils
require "/usr/pkg/scripts/DellSSUtils/DellSmartUtils.pl";
#Assigning Value to the vairable which is used as an argument to the
#dell library functions
$cli = "show version";
$script = "/usr/pkg/scripts/sample_scripts/sum.py";
$args = "1 2 3";
$ExtraArgs = "10";
@list = ("interface vlan $ARGV[0]", "no shutdown", "ip address $ARGV[0].$ARGV[0].$ARGV[0].
$ARGV[0]/24", "exit");
open (MYFILE, '>>/f10/flash/dellcliop.txt');
print MYFILE DellCli($cli);
print MYFILE "\n";
print MYFILE DellExec($script, $args);
print MYFILE "\n";
print DellCliConfig(@list);
72
Smart Scripting