Concept Guide

Table Of Contents
Pre-conguration Script – BMP Mode
#! /usr/bin/expect
#/DELL-NETWORKING
# Execute F10do and Print
proc print_f10do {cmd_str} {
set str [exec f10do "$cmd_str"]
set tmp_str [string map {\n \r\n} $str ]
puts $tmp_str
}
set ftp_ip "20.0.0.1"
set ftp_username "lab"
set ftp_passwd "lab"
set config_file "s4810-10-startup-config"
set post_conf "s4810-10-post-config.exp"
puts "Executing Pre-Config Script !!!!\r\n"
exec rm -rf "$config_file"
exec rm -rf "$post_conf"
puts "Downloading Startup Config and Post-Config Script from
$ftp_ip ...\r\n"
spawn ftp "$ftp_ip"
expect "Name .*: "
send "$ftp_username\n"
expect "Password: "
send "$ftp_passwd\n"
send "cd scripts\n"
expect "ftp>"
send "ls\n"
expect "ftp>"
send "get $post_conf\n"
expect "ftp>"
send "get $config_file\n"
expect "ftp>"
send "bye\n"
expect eof
after 5000
puts "Download Complete !!!\r\n"
if {[file exists $config_file]} {
puts "Config File: $config_file downloaded successfully\r\n"
} else {
puts "ERROR: Config File: $config_file - Not Found\r\n"
}
if {[file exists $post_conf]} {
puts "Post Config Script: $post_conf downloaded
successfully\r\n"
} else {
puts "ERROR: Post Config Script: $post_conf - Not
Found\r\n"}
# Copy Config to Startup Config
print_f10do "show version"
after 5000
print_f10do "copy flash://$config_file startup-config"
print_f10do "yes"
after 5000
puts "Pre-Config Script Execution Successful !!!!!\r\n"
exit 0
Post-conguration Script – BMP Mode
The following example shows the post-conguration script for the S4810 or S4820T platform:
#! /usr/bin/expect
#/DELL-NETWORKING
# Post Config Script for S4810-10
# Execute F10do and Print
proc print_f10do {cmd_str} {
set str [exec f10do "$cmd_str"]
set tmp_str [string map {\n \r\n} $str ]
Bare Metal Provisioning
31