cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1768
Views
5
Helpful
1
Replies

tcl script to get file from ftp server fails when executed by eem applet

jonasstenling
Level 1
Level 1

Hi!


I'm loading a network-confg file with ZTP that contains the following:

event manager applet LoadIOS
 event timer countdown time 1
 action 1 cli command "enable"
 action 2 cli command "configure terminal"
 action 3 cli command "file prompt quiet"
 action 4 cli command "end"
 action 5 cli command "copy tftp://192.168.101.3/load_ios.tcl bootflash:/load_ios.tcl"
 action 6 cli command "tclsh bootflash:/load_ios.tcl"
 exit
end

That is executing load_ios.tcl:

set ftp_server "192.168.101.3"
set ios_image "asr920-universalk9_npe.03.14.00.S.155-1.S-std.bin"
set wanted_version "asr920-universalk9_npe.03.14.00.S.155-1.S-std.bin"
set show_version [exec "show version"]
set check_version [regexp -line -all -inline ${wanted_version} ${show_version}]
if { ! [string equal ${wanted_version} ${check_version}] } {
puts [ exec "copy ftp://${ftp_server}/${ios_image} bootflash:/${ios_image}" ]
}
set serial [regexp -line -all -inline {CAT[a-zA-Z0-9]+} $show_version}]
puts [ exec "copy tftp://${ftp_server}/${serial}.conf startup-config" ]
typeahead "\r"
exec "reload"
 
When load_ios.tcl is executed by the LoadIOS applet everything works except the copy from ftp and the final reload. However, when I execute the script directly from the command line, everything works flawlessly.
 
When executing from the applet I can see in the log on the ftp server that the router is starting the transfer of the file, but after a couple of seconds it fails with "broken pipe".
 
Help!
1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Change your applet's event line to:

 

event timer countdown time 1 maxrun 900

 

But you should have a read of https://supportforums.cisco.com/blog/12218591/automating-cisco-live-2014-san-francisco .  I did something similar for Cisco Live US last year, and I feel that using a pure EEM solution offers better overall reliability.

View solution in original post

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

Change your applet's event line to:

 

event timer countdown time 1 maxrun 900

 

But you should have a read of https://supportforums.cisco.com/blog/12218591/automating-cisco-live-2014-san-francisco .  I did something similar for Cisco Live US last year, and I feel that using a pure EEM solution offers better overall reliability.