Using Cli Variables In Scripts - Cisco nexus 5000 series Cli Configuration Manual

Hide thumbs Also See for nexus 5000 series:
Table of Contents

Advertisement

Command Scripts
S e n d f e e d b a c k t o n x 5 0 0 0 - d o c f e e d b a c k @ c i s c o . c o m

Using CLI Variables in Scripts

You can use CLI variables defined by the cli var command (see the
page
The following example shows how to use CLI session variables in a script file used by the run-script
command:
switch# cli var name testinterface fc 1/1
switch# show file bootflash:test1.vsh
show interface $(testvar)
switch# run-script bootflash:test1.vsh
`show interface $(testvar)`
fc2/1 is down (SFP not present)
Hardware is Fibre Channel
Port WWN is 20:01:00:05:30:00:8e:1e
Admin port mode is auto, trunk mode is on
Port vsan is 1
Receive data field Size is 2112
Beacon is turned off
5 minutes input rate 0 bits/sec, 0 bytes/sec, 0 frames/sec
5 minutes output rate 0 bits/sec, 0 bytes/sec, 0 frames/sec
1 frames input, 128 bytes
0 discards, 0 errors
0 CRC, 0 unknown class
0 too long, 0 too short
1 frames output, 128 bytes
0 discards, 0 errors
0 input OLS, 0 LRR, 0 NOS, 0 loop inits
0 output OLS, 0 LRR, 0 NOS, 0 loop inits
0 receive B2B credit remaining
0 transmit B2B credit remaining
The following example shows how you can pass CLI session variable as arguments to a child run-script
command process:
switch# show file bootflash:test1.vsh
show interface $(var1) $(var2)
switch# run bootflash:test2.vsh var1="fc2/1" var2="brief"
`show interface $(var1) $(var2)`
Cisco Nexus 5000 Series Switch CLI Software Configuration Guide
1-12
Transmit B2B Credit is 255
Receive B2B Credit is 16
Receive data field Size is 2112
Beacon is turned off
Trunk vsans (admin allowed and active) (1)
Trunk vsans (up)
Trunk vsans (isolated)
Trunk vsans (initializing)
5 minutes input rate 96 bits/sec, 12 bytes/sec, 0 frames/sec
5 minutes output rate 64 bits/sec, 8 bytes/sec, 0 frames/sec
77423 frames input, 6708868 bytes
0 discards, 0 errors
0 CRC,
0 unknown class
0 too long, 0 too short
77302 frames output, 4184976 bytes
0 discards, 0 errors
1 input OLS, 2 LRR, 0 NOS, 0 loop inits
1 output OLS, 0 LRR, 1 NOS, 0 loop inits
16 receive B2B credit remaining
255 transmit B2B credit remaining
1-9) or passed as arguments in the run-script command.
Chapter 1
Using the Command-Line Interface
(1)
()
()
"Using CLI Variables" section on
OL-16597-01

Advertisement

Table of Contents
loading

Table of Contents