скрипт конфигурации коммутатора huawei quidway s2300

#!/usr/bin/expect
 
# initialize host, password, ...
 
if {[llength $argv] != 1} {
  puts "Вызов: config_switch_huawei <ip_address_switch>"
  exit 1
}
set hostname [lindex $argv 0]
set prompt "*$hostname*" 
set DATE [exec date "+%d%m%Y %X"]
package require Expect
 
spawn telnet $hostname
expect Username:
send admin\r
expect Password:
send ****\r
 
expect *
send "clock timezone moskow add 03:00:00\r"
expect *
send "system-view\r"
expect *
send "sysname $hostname\r"
expect $prompt
send "snmp-agent sys-info version v2c\r"
expect $prompt
send "snmp-agent community read public\r"
#expect $prompt
#send "stp enable\r"
#send "y\r"
expect $prompt
send "loopback-detect enable\r"
expect $prompt
send "ip route-static 0.0.0.0 0.0.0.0 10.98.98.1\r"
expect $prompt
send "ntp-service unicast-server 192.168.201.201\r"
expect $prompt
send "info-center loghost 192.168.201.2 facility local0 channel logbuffer\r"
sleep 1
expect $prompt
send "info-center loghost source Vlanif 1\r"
sleep 1
expect $prompt
send "igmp-snooping enable\r"
sleep 1
expect $prompt
send "icmp-reply fast\r"
sleep 1
expect $prompt
send "vlan 400\r"
sleep 1
expect $prompt
send "igmp-snooping enable\r"
sleep 1
expect $prompt
send "quit\r"
sleep 1
expect $prompt
send "quit\r"
sleep 1
expect $prompt
send "save\r"
sleep 1
send "Y\r"
sleep 10
expect $prompt
send "quit\r"