This chapter describes how to use Configuration Scripting to generate a text-formatted script file that shows the current configuration of the system. You can generate multiple scripts, and upload and apply them to more than one switch.
This chapter contains the following topics:
Understanding Configuration Scripting
- Provides scripts that can be uploaded and downloaded to the system.
- Provides flexibility to create command configuration scripts.
- Can be applied to several switches.
- Can save up to ten scripts or 500K of memory.
- Provides List, Delete, Apply, Upload, Download.
- Provides script format of one CLI command per line.
The following limitations exist:
- Total number of scripts stored on the system is limited by NVRAM/FLASH size.
- Application of scripts is partial if script fails. For example, if the script executes five of ten commands and the script fails, the script stops at five.
- Scripts cannot be modified or deleted while being applied.
- Validation of scripts checks for syntax errors only. It does not validate that the script will run.
Configuring Scripting
The following are examples of the CLI commands used for the Configuration Scripting feature.
Example 1: script
CODE EXAMPLE 30-1 script Command
(DTI SWITCH) # script ?
apply Applies configuration script to the switch.
delete Deletes a configuration script file from the switch.
list Lists all configuration script files present on the switch.
show Displays the contents of configuration script.
validate Validate the commands of configuration script.
|
Example 2: script list and script delete
CODE EXAMPLE 30-2 script list and script delete Commands
(DTI SWITCH) # script list
Configuration Script Name Size(Bytes)
------------------------- -----------
basic.scr 93
running-config.scr 3201
2 configuration script(s) found.
1020706 bytes free.
(DTI SWITCH) # script delete basic.scr
Are you sure you want to delete the configuration script(s)? (y/n) y
1 configuration script(s) deleted.
|
Example 3: script apply running-config.scr
CODE EXAMPLE 30-3 script apply running-config.scr Command
(DTI SWITCH) # script apply running-config.scr
Are you sure you want to apply the configuration script? (y/n) y
The systems has unsaved changes.
Would you like to save them now? (y/n) y
Configuration Saved!
|
Example 4: show running-config
Use this command to capture the running configuration into a script.
CODE EXAMPLE 30-4 show running-config Command
(DTI SWITCH) # show running-config running-config.scr
Config script created successfully.
(DTI SWITCH) #script list
Configuration Script Name Size(Bytes)
------------------------- ----------
running-config.scr 3201
1 configuration script(s) found.
1020799 bytes free.
|
Example 5: copy nvram: script
Use this command to upload a configuration script.
CODE EXAMPLE 30-5 copy nvram: script Command
(DTI SWITCH) # copy nvram: script running-config.scr
tftp://192.168.77.52/running-config.scr
Mode......................... TFTP
Set TFTP Server IP........... 192.168.77.52
TFTP Path.................... ./
TFTP Filename................ running-config.scr
Data Type.................... Config Script
Source Filename.............. running-config.scr
Are you sure you want to start? (y/n) y
File transfer operation completed successfully.
|
Example 6: script validate running-config.scr
CODE EXAMPLE 30-6 script validate running-config.scr Command
(DTI SWITCH) # script validate running-config.scr
serviceport protocol none
network protocol dhcp
no network javamode
vlan database
exit
configure
logging buffered
logging host 192.168.77.151
Configuration script ‘running-config.scr’ validated.
(DTI SWITCH) # script apply running-config.scr
Are you sure you want to apply the configuration script? (y/n) y
The system has unsaved changes.
Would you like to save them now? (y/n) y
Configuration Saved!
|
Example 7: Validate Another Configuration Script
CODE EXAMPLE 30-7 script validate default.scr Command
(DTI SWITCH) # script validate default.scrnetwork parms 172.30.4.2 255.255.255.0 0.0.0.0vlan databaseexitconfigurelineconfigexitspanning-tree configuration name 00-18-00-00-00-10interface 0/1exitinterface 0/2exitinterface 0/3exit... continues through interface 0/26 ...exitexitConfiguration script 'default.scr' validation succeeded.
|
Sun Netra CP3240 Switch User’s Guide
|
820-3252-11
|
|
© 2007 Diversified Technology, Inc. All Rights Reserved. © 2009 Sun Microsystems, Inc. All rights reserved.