Reply
Accepted Solution

CCS: "show bootvar" output to variables

svdhimst
Techie
Posts: 2
2233     0

Hello,

 

For my job I'm currently working on a script to detect the firmware version of both the active and non active firmware image of our SF300 switches, and then update them if they are not the latest. However, this is the first time for me using CCS, and I am not known with Perl and neither are my co-workers. I have read the Trigger-Template documentation in the Infoblox CCS Scripting Guide (6.7) and I've been looking around on the forums, but have not been able to understand it yet.

 

Here is the output of the "show bootvar" from one of the SF300 switches.

 

Image  Filename   Version     Date                    Status
-----  ---------  ---------   ---------------------   -----------
1      image-1    1.3.5.58    10-Oct-2013  17:15:41   Active*
2      image-2    1.4.1.3     29-Mar-2015  16:24:16   Not active

 

Basicly, I would like to put the Version and Status of both images into variables, so I would end up with 4 variables (i.e. $img1Version, $img2Version, $img1Status and $img2Status).

 

Thanks in advance,

Sander

Re: CCS: "show bootvar" output to variables

Posts: 80
2234     0

So in your script use the action command to run the show command.  This will give you some cli output to work with.  From there have the output of the action command be a trigger comamnd.  The trigger then has what is called  a trigger variables and template which you use to grab the values.  Once you have the values use Trigger-Commands to do the stuff you want.  You can use a Trigger-Filter or a Filter on the Trigger-Command to specify which values to use and which to ignore.

 

I put a small example of how to get the values and populate the trigger template below. You'll want to test it, but it's a start.  Let me know how it goes.

 

Action:
   Run show command

Action-Commands:
SET: $UpdateMade = "no"
show bootvar

Output-Triggers:
Make me some variables

Trigger:
Make me some variables

 

##This defines the variables##
Trigger-Variables:
$img1Version word

$img2Version word

$img1Status word

$img2Status word

 

##This populate the variables##
Trigger-Template:
1 image1 [[$img1Version]]  some more stuff [[$img1Status]]

 

##This is the part where I do something##

Trigger-Commands:
Run the commands to update stuff here

 

Re: CCS: "show bootvar" output to variables

svdhimst
Techie
Posts: 2
2234     0

Yes, that was exactly what I was looking for. Thank you!

Showing results for 
Search instead for 
Do you mean 

Recommended for You