Reference Guide

Bare Metal Provisioning 3.0 (BMP 3.0) | 253
Pre-configuration Script - BMP Mode
#! /usr/bin/expect
#/DELL-FORCE10
# 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"
expect "ftp>"
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