Network Change & Configuration Management

Reply
Highlighted
Accepted Solution

Upgrade IOS Image on Cisco 2960

BBarbosa
Techie
Posts: 13
20615     0

Hi...

The native script IOS Image Upgrade don't work on cisco 2960. 

What did I do to get it to work?

Create a new script and under

Adviser
Posts: 336
20616     0

Create a new script and under

Action-Commands:

archive tar /xtract /overwrite tftp://192.168.1.5/c2960-lanbasek9-tar.122-58.SE1.tar flash: \r\r

The \r is to answer the questsion like are you sure and confirm

 

 

Cisco have special command with many options for that

#archive download-sw ?
/directory Specify a directory for images
/force-reload Unconditionally reload system after successful sw upgrade
/imageonly Load only the IOS image(s)
/leave-old-sw Leave old sw installed after successful sw upgrade
/no-set-boot Don’t set BOOT — leave existing boot config alone
/no-version-check skip version check that prevents incompatible image install
/overwrite OK to overwrite an existing image
/reload Reload system (if no unsaved config changes) after
successful sw upgrade
/safe Always load before deleting old version
flash: Image file
ftp: Image file
http: Image file
https: Image file
rcp: Image file
scp: Image file
tftp: Image file

 

Some more notes on archive - http://ccie-or-null.net/2011/05/24/using-the-cli-to-install-and-ios-in-tar-format/

Follow me on LinkedIn: https://www.linkedin.com/in/sifbaksh
Twitter: https://twitter.com/sifbaksh

I have this erro on ur script

BBarbosa
Techie
Posts: 13
20616     0

I have this erro on ur script Mike Griffin

 

Export of a CCS contains complete information

MGriffin
Techie
Posts: 37
20616     0

Bruno,

This is an exported CCS from the NetMRI.

The GUI prompts you for the first few particulars of the script, and therefore those same attributes need to be removed before import of the script, otherwise a duplicate attribute is received; this is the information input via the GUI that is included in the export for compete exported script information.

Believe all of this text should be removed, and then the script will import, copy/paste, correctly:



###########################################################################
## Export of Script: IOS Image Upgrade 2960 and 3560
## Script-Level: 3
## Script-Category: Uncategorized
###########################################################################

Script:
 IOS Image Upgrade 2960 and 3560

Script-Description:
  This script may be used to help automate image updates for Cisco 2950, 2960, and 3560 series routers and terminal servers. It is designed to work with Cisco IOS based devices that use "flash:" as their boot storage device - with a single partition and have only one supervisor module. No attempt is made to handle multiple flash devices, partitions within flash devices, or loading images to multiple supervisor modules.

ok... now i have this error:

BBarbosa
Techie
Posts: 13
20616     0

ok... now i have this error:

 

Export of Script: IOS Image Upgrade 2960 and 3560

MGriffin
Techie
Posts: 37
20616     0

Here is a reworked CCS Script to upgrade 2960's and 3560's.


###########################################################################
## Export of Script: IOS Image Upgrade 2960 and 3560
## Script-Level: 3
## Script-Category: Uncategorized
###########################################################################

Script:
 IOS Image Upgrade 2960 and 3560

Script-Description:
  This script may be used to help automate image updates for Cisco 2950, 2960, and 3560 series routers and terminal servers. It is designed to work with Cisco IOS based devices that use "flash:" as their boot storage device - with a single partition and have only one supervisor module. No attempt is made to handle multiple flash devices, partitions within flash devices, or loading images to multiple supervisor modules.

Script-Filter:
# PLEASE REVIEW BEFORE USING!!!
#
# This script content is provided to the user as is and is not 
# warranted or guaranteed against specific vendor devices or user 
# scenarios. It is provided by Netcordia to the user of this platform
# as an example, and should not be executed against production network
# devices unless the user has reviewed and/or made the proper 
# modification to assure safe execution in specific network 
# configurations. Please contact your Netcordia representative or 
# Netcordia support if you have questions or concerns about how to 
# safely use the following scripted content in your network.
#
# You MUST check the "enable_changes" option for any commands to
# be executed. When NOT selected, the script will log the commands it
# would execute, but not download files or make changes to the device.
#
# You may specify addtional path information in the server field when
# using the ftp and http protocols.
# 
# If multiple protocols are selected, only one will be used. Order of
# preference is http, scp, ftp, then tftp.
#
# The clean_flash option will attempt to free space in flash by 
# deleting common files such as crash dumps and misc html files. 
# If you use this option, you may want to adjust the file pattern 
# matches in the "Delete Files" action.
#   
# Use of scp requires that the device currently be running an image
# with crypto support (a.k.a., a "k9" image). 
#
# If you use scp, the password will appear in the process log of
# the Job details viewer. Use a dedicated, restricted account for this.
# In addition, the image file must exist in the user's home directory.
#
# To use ftp transfer, you must first define ftp user, password, and
# mode settings (i.e., ip ftp username, ip ftp password, ip ftp passive)
#
# The current running image AND the new image MUST end in ".bin". 
# This means if you are currently using a running image that was not
# copied with its original filename intact, you must manually correct
# this before using this script.
#
# The script will not do a force delete of the current running image
# from flash, if it exists. This is to help prevent leaving a device
# without an image if there is a problem during the file copy.
#
# The download only option will copy the new file to flash if needed,
# but will not change the configuration or attempt to reload the device.
#
# It is not necessary to specify either of the "reload_now" or 
# "reload_cmd" options. Devices can be manually restarted later or
# perhaps reloaded by another script.

 $Vendor eq "Cisco"   and
 $sysDescr like /IOS/ and
 ( $model like /2950/ or
   $model like /2960/ or
   $model like /3560/ )

Script-Timeout:
 7000

Script-Variables:
 $use_scp  boolean
 $use_http  boolean
 $use_ftp  boolean
 $use_tftp  boolean
 $server   string  "Enter server/path info here"
 $new_image_name  string  "Enter image name here"
 $new_image_size  string  "Enter size of file in bytes" number
 $new_image_md5  string  "Enter md5 hash here"
 $scp_username  string  "Enter username if using scp"
 $scp_password  password "x"
 $download_only  boolean
 $clean_flash  boolean
 $reload_cmd  string  "Enter reload in command here"
 $reload_now  boolean
 $enable_changes  boolean

#########################################################################
Action:
 Set Variables and Download Method

Action-Description:
 Set method of download based on above variables.
 If one of these are not set the script will fail. 

Action-Commands:
 SET: $runscript = "no"
 SET: $have_current_image = "no"
 SET: $usehttp = "no"
 SET: $useftp = "no"
 SET: $usetftp = "no"
 SET: $usescp = "no"

Action-Commands: { $use_http eq "on" }
 SET: $usehttp = "yes"
 SET: $runscript = "yes"

Action-Commands: { $usehttp eq "no" and $use_scp eq "on" }
 SET: $usescp = "yes"
 SET: $runscript = "yes"

Action-Commands: { $usehttp eq "no" and $usescp eq "no" and $use_ftp eq "on" }
 SET: $useftp = "yes"
 SET: $runscript = "yes"

Action-Commands: { $usehttp eq "no" and $usescp eq "no" and $useftp eq "no" and $use_tftp eq "on" }
 SET: $usetftp = "yes"
 SET: $runscript = "yes"

#########################################################################
Action:
 Delete Files

Action-Description:
 Delete various files if selected.  This frees up space for the new file.
 This script can only handle up to a total of nine image files in flash.

 This action requires that a download protocol was selected.  If
 one of these are not set, the new file can not be downloaded.
 
 Set the terminal length to 0 so that results are not paginated.
 You may want to adjust some of the delete statements below to suit
 your site.

Action-Filter:
 $runscript ne "no"

Action-Commands: { $enable_changes eq "on" and $clean_flash eq "on" }
 delete /force flash:*.html\r
 delete /force flash:*.TXT\r
 delete /force flash:*.gif\r
 delete /force flash:*.js\r
 delete /force flash:*.log\r
 delete /force flash:*.template\r
 delete /force flash:*.pkg\r
 delete /force flash:*.sdf\r
 delete /force flash:*.tar\r
 delete /force flash:*.shtml\r
 delete /force flash:*.cfg\r
 delete /force flash:/crash*\r
 delete /force flash:*.zup\r
 delete /force flash:*.sbin\r
 delete /force flash:*.loads\r
 delete /force flash:*.sb2\r
 delete /force flash:*.sbn\r
 delete /force flash:*.cfg\r
 delete /force flash:*.au\r
 delete /force flash:crash*\r
 delete /force flash:P00*\r
 delete /force flash:S00*\r
 delete /force flash:cmterm*\r
 delete /force /rec html\r

Action-Commands: { $enable_changes eq "off" and $clean_flash eq "on" }
 DEBUG:delete /force flash:*.html\r
 DEBUG:delete /force flash:*.TXT\r
 DEBUG:delete /force flash:*.gif\r
 DEBUG:delete /force flash:*.js\r
 DEBUG:delete /force flash:*.log\r
 DEBUG:delete /force flash:*.template\r
 DEBUG:delete /force flash:*.pkg\r
 DEBUG:delete /force flash:*.sdf\r
 DEBUG:delete /force flash:*.tar\r
 DEBUG:delete /force flash:*.shtml\r
 DEBUG:delete /force flash:*.cfg\r
 DEBUG:delete /force flash:/crash*\r
 DEBUG:delete /force flash:*.zup\r
 DEBUG:delete /force flash:*.sbin\r
 DEBUG:delete /force flash:*.loads\r
 DEBUG:delete /force flash:*.sb2\r
 DEBUG:delete /force flash:*.sbn\r
 DEBUG:delete /force flash:*.cfg\r
 DEBUG:delete /force flash:*.au\r
 DEBUG:delete /force flash:crash*\r
 DEBUG:delete /force flash:P00*\r
 DEBUG:delete /force flash:S00*\r
 DEBUG:delete /force flash:cmterm*\r
 DEBUG:delete /force /rec html\r

Action-Commands:
 terminal length 0
 show ver

Output-Triggers:
 Find Running Image
 Failed Determining Active IOS Image

########################################################################
Trigger:
 Find Running Image

Trigger-Description:
 This trigger determines the running IOS filename and calls a
 second trigger that looks for the new IOS image in flash. The
 command specifically looks only for .bin files.

Trigger-Variables:
      $currentbootimage /\w\d{4}[\w\-\.]+\.bin/

Trigger-Template:
      flash:.*\/?[[$currentbootimage]]

Trigger-Filter:
 $runscript ne "no"

Trigger-Commands:
 dir /all
 SET: $have_current_image = "yes"

Output-Triggers:
 Check Files and Delete

########################################################################
Trigger:
 Check Files and Delete

Trigger-Description:
 This trigger looks for the user-supplied new image name in the
 output of the "dir" command in the previous trigger.

 $imagename must be a string of characters ending in ".bin".

 The $file variable is used to determine each file's position in flash.
 This allows the script to keep track of the number of image files in flash.
 
 If the .bin file is not the running image or the new image delete it
 to make room.

 $dir needs to match date strings as well as  in case
 a file was uploaded to the device when the date/time was not available.
 For example, it must properly pull the file sequence and .bin file
 name from both of these:

    1  -rw-     8699556  Mar 13 2007 22:27:30 +00:00  c3660-i-mz.123-9e.bin
    3  -rw-     8477240                      c3660-i-mz.123-3i.bin

Trigger-Variables:
 $file    /\d+/
 $read  /\s*-\w+-\s*/
 $size  /\d+/ 
 $dir   /\s*[<|>]\w+\s\w+[<|>]\s+|\s*\w*\s*\d*\s*\w+\s*\d+\s*\d+\s*\d+:\d+:\d+\s*[\+|-]\d+:\d+\s*/
 $imagename    /\w\d{4}[\w\-\.]+\.bin/

Trigger-Template:
 [[$file]][[$read]][[$size]][[$dir]][[$imagename]]

Trigger-Commands: { $imagename eq $new_image_name }
 verify /md5 flash:$imagename

Trigger-Commands: { $imagename ne $currentbootimage and $imagename ne $new_image_name and $enable_changes eq "on" }
 DEBUG: del /force $imagename\r

Trigger-Commands: { $imagename ne $currentbootimage and $imagename ne $new_image_name and $enable_changes eq "off" }
 DEBUG:del /force $imagename\r

Output-Triggers:
 Check Image MD5 Hash

########################################################################
Trigger:
 Check Image MD5 Hash

Trigger-Description:
 Test that the calculated image MD5 hash matches the user-supplied value.

Trigger-Variables:
 $imagemd5 /[[:xdigit:]]+/

Trigger-Filter:
 $imagename eq $new_image_name

Trigger-Template:
 .+Done!
 .+ = [[$imagemd5]]

Trigger-Commands: { $imagemd5 eq $new_image_md5 }
 SET: $havenewimage = "yes"
 SET: $nofireissue = "yes"

Trigger-Commands: { $imagemd5 ne $new_image_md5 }
 SET: $corruptnewimage = "yes"
 SET: $nofireissue = "yes"

Output-Triggers:
 Corrupt IOS Image File

#########################################################################
Action:
 Squeeze

Action-Description:
 Determine if deleted files are in flash, if so, try to squeeze the
 flash to make room. It is ran at this point in case a previous copy 
 failed or we need to squeeze deleted files from the first action.

 This is an action so that it is not called after each file delete.

Action-Filter:
 $runscript ne "no" and $have_current_image eq "yes"

Action-Commands:
 dir /all

Output-Triggers:
 Deleted
 Run Squeeze
 
#########################################################################
Trigger:
 Deleted

Trigger-Description:
 Determine if there are deleted files still in flash. Deleted files
 will show in between brackets [].

Trigger-Template:
 \[\S+\]

Trigger-Commands:
 SET: $deleted = "yes"

#########################################################################
Trigger:
 Run Squeeze

Trigger-Description:
 Squeeze flash if deleted files were found. Also do another dir
 command to determine free space left in flash.

Trigger-Timeout:
 1500

Trigger-Filter:
 $runscript ne "no"

Trigger-Commands: { $deleted eq "yes" and $enable_changes eq "on" }
 DEBUG:squeeze flash:\r

Trigger-Commands: { $deleted eq "yes" and $enable_changes eq "off" }
 DEBUG:squeeze flash:\r

Trigger-Commands: { $enable_changes eq "on" }
 dir /all

Trigger-Commands: { $enable_changes eq "off" }
 DEBUG:dir /all

Output-Triggers:
 Check Space

########################################################################
Trigger:
 Check Space

Trigger-Description:
 This trigger determines if there is enough space in flash to load
 the new image. The dir command output from the previous trigger is
 parsed to determine free space remaining.

 If we don't already have the new image in flash, and there is not
 enough space to download it, fire an issue.

Trigger-Variables:
  $Flash1   /\d+/ number
  $Flash2   /\d+/ number
  $FreeOrUsed  string
  $TotalOrAvail  /\w+/
  $paren  /\(/
  $paren2  /\)/

Trigger-Template:
                [[$Flash1]] bytes [[$TotalOrAvail]] [[$paren]][[$Flash2]] bytes [[$FreeOrUsed]][[$paren2]]


Trigger-Commands: {$TotalOrAvail eq "available" and $Flash1 >= $new_image_size}
  SET: $spaceavailable = "yes"

Trigger-Commands: {$FreeOrUsed eq "free" and $Flash2 >= $new_image_size}
  SET: $spaceavailable = "yes"



Output-Triggers:
 Insufficient Space for IOS Image

#########################################################################
Action:
 Download IOS

Action-Description:
 Copy the new image file to flash via SCP, TFTP, FTP or HTTP.

Action-Timeout:
 5400

Action-Filter:
 $runscript ne "no" and
 $havenewimage ne "yes" and 
 $spaceavailable eq "yes" and
 $have_current_image eq "yes"

Action-Commands: { $usehttp eq "yes" and $enable_changes eq "on" }
 copy http://$server/$new_image_name flash:$new_image_name\r\rn\r
 verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: { $usehttp eq "yes" and $enable_changes eq "off"}
 DEBUG:copy http://$server/$new_image_name flash:$new_image_name\r\rn\r
 DEBUG:verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: { $usescp eq "yes" and $enable_changes eq "on" }
 copy scp://$server/$new_image_name flash:$new_image_name\r$scp_username\r\rn$scp_password\r
 verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: { $usescp eq "yes" and $enable_changes eq "off"}
 DEBUG:copy scp://$server/$new_image_name flash:$new_image_name\r$scp_username\r\rn$scp_password\r
 DEBUG:verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: { $useftp eq "yes" and $enable_changes eq "on"}
 copy ftp://$server/$new_image_name flash:$new_image_name\r\rn
 verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: {$useftp eq "yes" and $enable_changes eq "off"}
 DEBUG:copy ftp://$server/$new_image_name flash:\r\rn
 DEBUG:verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: { $usetftp eq "yes" and $enable_changes eq "on" }
 copy tftp://$server/$new_image_name flash:\r\rn\r
 verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Action-Commands: { $usetftp eq "yes" and $enable_changes eq "off"}
 DEBUG:copy tftp://$server/$new_image_name flash:\r\rn\r
 DEBUG:verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"

Output-Triggers:
 Check Image MD5 Hash
 Check Download Complete

########################################################################
Trigger:
 Check Download Complete

Trigger-Description:
 Verify download completed successfully.

Trigger-Template:
 %Error

Trigger-Commands:
 SET: $copyfail = "yes"

Output-Triggers:
 IOS Image File Copy Failed

#########################################################################
Action:
 Change Boot Image and Verify Changes

Action-Description:
 Since this is a new action we need to redetermine the running version
 and change the boot system flash: commands in the following triggers.

Action-Filter:
 $runscript ne "no" and $have_current_image eq "yes"

Action-Commands:
 show ver
 show flash

Output-Triggers:
 Update Boot Sequence
 IOS Upgrade Succeeded
 IOS Upgrade Failed
 Flash Squeeze Operation Failed
 Incorrect or Missing Boot Commands

#########################################################################
Trigger:
 Update Boot Sequence

Trigger-Description:
 Make the new file the first boot image and the current image
 the second boot image by updating the configuration and saving
 to NVRAM.

Trigger-Variables:
 $currentimageverify /[\w\-\.]+\.bin/

Trigger-Filter:
 $havenewimage eq "yes"
 and $download_only eq "off"
 and $spaceavailable eq "yes"
 and $copyfail ne "yes"

Trigger-Template:
 flash:.*\/?[[$currentimageverify]]

Trigger-Commands: { $havenewimage eq "yes" and $enable_changes eq "on"}
 config terminal
 no boot system
 boot system flash:$new_image_name
 end
 write memory
 show boot
 SET: $bootchange = "yes"

Trigger-Commands: { $havenewimage eq "yes" and $enable_changes eq "off"}
 DEBUG:config terminal
 DEBUG:no boot system
 DEBUG:boot system flash:$new_image_name
 DEBUG:end
 DEBUG:write memory
 show boot
 SET: $bootchange = "yes"

Output-Triggers:
 Verify Boot

#########################################################################
Trigger:
 Verify Boot

Trigger-Description:
 Verify that the boot statements exist for the new IOS image that
 was installed into flash. Then run another dir command.

Trigger-Template:
 BOOT path-list\s+:\s+flash:$new_image_name

Trigger-Commands:
 SET: $bootexists = "yes"
 dir /all

Output-Triggers:
 Verify Squeeze

#########################################################################
Trigger:
 Verify Squeeze

Trigger-Description:
 Verify that the squeeze command completed by checking that no deleted
 files appear in flash.

Trigger-Template:
 \[\S+\]

Trigger-Commands:
 SET: $squeezefailed = "yes"

#########################################################################
Issue:
 Insufficient Space for IOS Image

Issue-ID:
 IOSUpgradeNoSpace

Issue-Severity:
 Warning

Issue-Description:
 Insufficient storage space in flash to install the new IOS image.

Issue-Filter:
 $spaceavailable ne "yes" and
 $nofireissue ne "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name
 SpaceNeeded $new_image_size
 SpaceAvailable $freespace
 InstalledFlash $flash

#########################################################################
Issue:
 IOS Image File Copy Failed

Issue-ID:
 IOSUpgradeCopyFailed

Issue-Severity:
 Error

Issue-Description:
 There was an error during the IOS image copy.

Issue-Filter:
 $copyfail eq "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name

#########################################################################
Issue:
 IOS Upgrade Succeeded

Issue-ID:
 IOSUpgradeComplete

Issue-Severity:
 Info

Issue-Description:
 The IOS upgrade completed successfully.

Issue-Filter:
 $bootexists eq "yes" and
 $havenewimage eq "yes" and
 $squeezefailed ne "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name

#########################################################################
Issue:
 IOS Upgrade Failed

Issue-ID:
 IOSUpgradeFailed

Issue-Severity:
 Error

Issue-Description:
 The IOS upgrade failed.  The boot commands are not in the configuration,
 the new image doesn't exist in flash, or deleted files are still present 
 (squeeze operation failed).

Issue-Filter:
 ($bootexists ne "yes" and
  $download_only eq "off") or
 $havenewimage ne "yes"    or
 $squeezefailed eq "yes"   or
 $spaceavailable ne "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name

#########################################################################
Issue:
 Flash Squeeze Operation Failed

Issue-ID:
 IOSUpgradeSqueezeFailed

Issue-Severity:
 Warning

Issue-Description:
 Squeeze operation failed.  Deleted files still appear in flash.

Issue-Filter:
 $squeezefailed eq "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name

#########################################################################
Issue:
 Incorrect or Missing Boot Commands

Issue-ID:
 IOSUpgradeBootIncorrect

Issue-Severity:
 Error

Issue-Description:
 Boot commands are incorrect or missing from the configuration.

Issue-Filter:
 $bootexists ne "yes"    and
 $download_only eq "off" and
 $nofireissue ne "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name

#########################################################################
Issue:
 Corrupt IOS Image File

Issue-ID:
 IOSUpgradeCorruptImage

Issue-Severity:
 Error

Issue-Description:
 The new image file was found in flash, but the MD5 checksum didn't match.

Issue-Filter:
 $corruptnewimage eq "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name
 imagename $new_image_name
 BadMD5  $imagemd5

#########################################################################
Issue:
 Failed Determining Active IOS Image

Issue-ID:
 IOSUpgradeCurrentImage

Issue-Severity:
 Error

Issue-Description:
 Unable to determine the name of the currently active image.

Issue-Filter:
 $have_current_image ne "yes"

Issue-Details:
 Host  $IPAddress
 Name  $Name

#########################################################################
Action:
 Reload Now

Action-Description:
 Reload the device one minute after a successful upgrade. This delay 
 is necessary since NetMRI expects a response when a command is entered.

Action-Filter:
 $reload_now eq "on"      and
 $have_current_image eq "yes"  and
 $bootexists eq "yes"     and
 $havenewimage eq "yes"   and
 $squeezefailed ne "yes"

Action-Commands: { $enable_changes eq "on" }
 reload in 1\r

Action-Commands: { $enable_changes eq "off" }
 DEBUG:reload in 1\r

#########################################################################
Action:
 Reload Later

Action-Description:
 Reload the device at a scheduled time or a specific interval
 after a successful upgrade.

 The reload command entered at startup is directly executed.

 For example, "reload at 02:00" can be used to defer restart until
 early in the morning. Other options are available to the reload
 command.

Action-Filter:
 $reload_cmd not like /Enter reload in command here/ and
 $have_current_image eq "yes" and
 $bootexists eq "yes"     and
 $havenewimage eq "yes"   and
 $squeezefailed ne "yes"

Action-Commands: { $enable_changes eq "on" }
 $reload_cmd\r

Action-Commands: { $enable_changes eq "off" }
 DEBUG:$reload_cmd\r

#########################################################################
##                            End of Script                            ##
#########################################################################

An extra 'or' was transposed

MGriffin
Techie
Posts: 37
20616     0

An extra 'or' was transposed into the script when I copied to this forum.

I'm not sure how that was added, I verified that it does not exist within the script-text that I copied it from.

I have modified the post that contains the script to edit out the unneeded "or" at the end of the "Script-Filter" directive.

 

This is what was modified: ORIGINAL:



 $Vendor eq "Cisco"   and
 $sysDescr like /IOS/ and
 ( $model like /2950/ or
   $model like /2960/ or
   $model like /3560/ or)

CORRECTED:



 $Vendor eq "Cisco"   and
 $sysDescr like /IOS/ and
 ( $model like /2950/ or
   $model like /2960/ or
   $model like /3560/ )

Thx.... im test it now!

BBarbosa
Techie
Posts: 13
20616     0

Thx.... im test it now!

The download od image working

BBarbosa
Techie
Posts: 13
20616     0

The download od image working fine...

 

But later have this error:

 

Please note the DEBUG Statements

MGriffin
Techie
Posts: 37
20616     0

Bruno,

Since you are copy/pasting the above script, please note the DEBUG statements left within the two sections of the script which removes items, even on the item with filter {$enable_changes eq "on"}

 


Trigger: "Check Files and Delete"


Trigger-Commands: { $imagename ne $currentbootimage and $imagename ne $new_image_name and $enable_changes eq "on" }
 DEBUG: del /force $imagename\r

Trigger-Commands: { $imagename ne $currentbootimage and $imagename ne $new_image_name and $enable_changes eq "off" }
 DEBUG:del /force $imagename\r

 

 


Trigger: "Run Squeeze"


Trigger-Commands: { $deleted eq "yes" and $enable_changes eq "on" }
 DEBUG:squeeze flash:\r

Trigger-Commands: { $deleted eq "yes" and $enable_changes eq "off" }
 DEBUG:squeeze flash:\r

 

 

Log review is needed

MGriffin
Techie
Posts: 37
20616     0

Bruno,

Would need to see the logs for further evaluation of where the failure occurred; all.zip {preferred} or Process log, Status log, and the Session log is always very helpful.

i still have the problem...

BBarbosa
Techie
Posts: 13
20616     0

i still have the problem...

 

could you please, send me a txt file?

Bruno,

MGriffin
Techie
Posts: 37
20616     0

Bruno,

The post with the additional DEBUG statements was a mere "FYI" post.  It was not intended to be related to your problem posted.

Could you please clarify what exactly it is that you requesting? 

As next step for the issue that you reported, I would need the log files to further assess why/where the script error occured.

How can I send you logs ?

BBarbosa
Techie
Posts: 13
20616     0
How can I send you logs ?

Bruno,

MGriffin
Techie
Posts: 37
20616     0

Bruno,

You could either copy/paste the relevant section of the log file{s} here, which clearly shows the failure, or, if you're more comfortable, you could open a Support case.

 

Hi Mike...

BBarbosa
Techie
Posts: 13
20616     0

Hi Mike...

I Will open a Support Case, but is this error.

 

 

 

Extraneous "n" in the copy command?

Expert
Posts: 214
20616     0
The script sends this for the copy command.  Note that the second newline is followed by a "n" character.  I don't know what the author was anticipating, but your session output shows that's what the CLI complains about.
     copy http://$server/$new_image_name flash:$new_image_name\r\rn\r

Marty,

MGriffin
Techie
Posts: 37
20616     0

Marty,

A prompt is expected after the copy command is invoked, one that we want to say 'no' to and simply sending 'n' is sufficient.

 

Bruno,

Since this does not seem to be needed in your environment, please modify the script to remove that "\rn\" from the end line; I would just remove it from the FTP copy command, as the other methods may still cause the prompt to occur.

 

Here is what you will want to modify that section to:

 


Action-Commands: { $useftp eq "yes" and $enable_changes eq "on"}
 copy ftp://$server/$new_image_name flash:$new_image_name\r
 verify /md5 flash:$new_image_name
 SET: $havenewimage = "yes"
Showing results for 
Search instead for 
Do you mean 

Recommended for You