Introducing SOC Insights for BloxOne Threat Defense: Boost your SOC efficiency with AI-driven insights to eliminate manual work and accelerate investigation and response times. Read the blog announcement here.

Automation Scripts

Reply

Cisco 9300 Switch automated upgrade with CCS

New Member
Posts: 1
1463     0

Hi,
Am trying to upgrade a bunch of 9300 switches.
The initial command is passed to the switch but then it needs a yes to save the config to proceed.
Part way thru the install (5-15min later) it asks to enter a yes to confirm and continue the install, then the switch will reload to finish the about 10-45min later.
How does one put this into the script?

 

Yes the Output Trigger does nothing but I could not decide what to look for & how to add it to the script.

 

Any help would be great!

 

Thanks,

Stan

 

Below is the CSS script I have tried:
##################################################
Script-Filter:
$Vendor eq "Cisco" and $Model like /9300/

Script-Variables:

$Commands_to_be_Executed text "Enter commands here, one per line"

##################################################
Action:
Copy from TFTP IOSXE to flash

Action-Description:
Executes the command to start the IOS image upgrade.

Action-Timeout:
5400

Action-Commands:
install add file flash:cat9k_iosxe.17.09.04a.SPA.bin activate commit \r\ry\ry\r

dir

Output-Triggers:
Check Download Complete

##################################################

Trigger:
Check Download Complete

Trigger-Variables:
$dir_1 string

Trigger-Template:
flash://[[$dir_1]].+

Trigger-Commands: {$dir_1 like /$dir_1/}
exit \r

 

The session output is:
STHR1L3>enable
Password:
STHR1L3#
STHR1L3#terminal no monitor
STHR1L3#terminal no editing
STHR1L3#terminal length 0
STHR1L3#install add file flash:cat9k_iosxe.17.09.04a.SPA.bin activate commit

y
y
install_add_activate_commit: START Thu Dec 14 22:59:30 EST 2023

System configuration has been modified.
Press Yes(y) to save the configuration and proceed.
Press No(n) for proceeding without saving the configuration.
Press Quit(q) to exit, you may save configuration and re-enter the command. [y/n/q]e
[y/n/q]x
[y/n/q]i
[y/n/q]t
[y/n/q]^J
[y/n/q]

*** Job Failed [1] ***

Re: Cisco 9300 Switch automated upgrade with CCS

Expert
Posts: 70
1464     0

I'm not directly answering your question but offer a few thoughts, having done this successfully for bundle mode.

 

1) As you said, each of the steps take many minutes.  The default script timeout is 5 minutes so that may be why the job errors out.

2) This script assumes that the file is already in flash.  Why not have the script download the file from your repository -- using HTTP(S)?

3) The install method is thorough in checking but can result in unexpected prompts.  And the when it succeeds, the box reboots and the script errors out.  The benefit is a slightly faster boot time -- is that worth it, compared to bundle mode?

 

I have a CCS script for 9200Ls (same logic) that uses the bundle (.bin) mode.  It frees space in flash by not touching the running image file (or packages/.SPA).  If the desired new file is not already present (and passes "verify"), it copies that file via HTTP from a respository.  And does "verifiy" on that.  If all is well, it modifies the "boot system" statements to boot the new file followed by the current file/method.  It then reports the actions taken in a custom issue.
We chose to only stage the upgrade and later trigger the reload during a maintenance window.

 

In the future, when a new baseline is declared, you change the desired image file name and do it again.

 

HTH

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You