|
Other /
Alcatel Switch Save ScriptOther.SaveSwitch HistoryShow minor edits - Show changes to output February 24, 2009, at 01:47 PM
by -
Changed lines 14-27 from:
(:title Alcatel Switch Save Script:) Alcatel switches (like Cisco and others) have working configs, certified configs, multiple CMM's... basically they are very complicated. However once you get them setup they are fairly nice. One feature that really got to me though was that everything you made a minor change (like adding a switch port to a specific VLAN) you need to save to config. The management utilities make may tasks simple, but the process of saving the config is not so easy and is a separate action for the rest; so it easily gets forgotten. This presents a real problem if the switch is powered down and comes back up on it's old "saved" config. I wrote a small script that performs a SSH onto each switch and runs a couple of commands: ->[@SWITCH write memory SWITCH working certified [flash-synchro]@] The flash-synchro only runs on switch stacks (groups of switches acting as one) The code is fairly simple. I needed to use [@expect@] since SSH has issues with passphrases being scripted: to:
February 24, 2009, at 01:46 PM
by -
Added lines 13-148:
(:title Alcatel Switch Save Script:) Alcatel switches (like Cisco and others) have working configs, certified configs, multiple CMM's... basically they are very complicated. However once you get them setup they are fairly nice. One feature that really got to me though was that everything you made a minor change (like adding a switch port to a specific VLAN) you need to save to config. The management utilities make may tasks simple, but the process of saving the config is not so easy and is a separate action for the rest; so it easily gets forgotten. This presents a real problem if the switch is powered down and comes back up on it's old "saved" config. I wrote a small script that performs a SSH onto each switch and runs a couple of commands: ->[@SWITCH write memory SWITCH working certified [flash-synchro]@] The flash-synchro only runs on switch stacks (groups of switches acting as one) The code is fairly simple. I needed to use [@expect@] since SSH has issues with passphrases being scripted: ->[+/opt/alcatel/saveswitches+] (:div style="border-style:ridge; border-width:2px; background-color:#ffffcc; margin-left:50px; overflow:auto; width:650px; height:300px;":) [@ #!/bin/bash if ! [ -x "/usr/bin/expect" ]; then echo "expect function is not installed" exit 1 fi function stackswitch { user="$1" pass="$2" host="$3" prompt="$4" #write memory #copy working certified flash-synchro cat > stackswitch.expect <<_EXPECT #!/usr/bin/expect -f spawn ssh -l $user $host expect { "assword" { send "$pass\n" } "(yes/no)? " { send "yes\n" expect { "assword" { send "$pass\n" } } } default { send_user "Login failed\n" exit } } expect { "$prompt" { send "write memory\n" } default { send_user "Error\n" exit } } expect { "$prompt" { send "copy working certified flash-synchro\n" } default { send_user "Error\n" exit } } expect { "Flash Synchronization process completed successfully" { send "\n" send_user "Save complete for $host\n\n" exit } } _EXPECT expect -f stackswitch.expect rm stackswitch.expect } function singleswitch { user="$1" pass="$2" host="$3" prompt="$4" #write memory #copy working certified cat > singleswitch.expect <<_EXPECT #!/usr/bin/expect -f spawn ssh -l $user $host expect { "assword" { send "$pass\n" } "(yes/no)? " { send "yes\n" expect { "assword" { send "$pass\n" } } } default { send_user "Login failed\n" exit } } expect { "$prompt" { send "write memory\n" } default { send_user "Error\n" exit } } expect { "$prompt" { send "copy working certified\n" } default { send_user "Error\n" exit } } expect { "Certify process Completed" { send "\n" send_user "Save complete for $host\n\n" exit } } _EXPECT expect -f singleswitch.expect rm singleswitch.expect } username="administrator" password="password" stackswitch "$username" "$password" "10.1.1.1" "SWITCHSTACK1" stackswitch "$username" "$password" "10.1.1.2" "SWITCHSTACK2" stackswitch "$username" "$password" "10.1.1.3" "SWITCHSTACK1" stackswitch "$username" "$password" "10.1.1.4" "SWITCHSTACK2" @] (:divend:) February 24, 2009, at 01:42 PM
by -
Added lines 3-12:
Alcatel switches (like Cisco and others) have working configs, certified configs, multiple CMM's... basically they are very complicated. However once you get them setup they are fairly nice. One feature that really got to me though was that everything you made a minor change (like adding a switch port to a specific VLAN) you need to save to config. The management utilities make may tasks simple, but the process of saving the config is not so easy and is a separate action for the rest; so it easily gets forgotten. This presents a real problem if the switch is powered down and comes back up on it's old "saved" config. I wrote a small script that performs a SSH onto each switch and runs a couple of commands: ->[@SWITCH write memory SWITCH working certified [flash-synchro]@] The flash-synchro only runs on switch stacks (groups of switches acting as one) The code is fairly simple. I needed to use [@expect@] since SSH has issues with passphrases being scripted: February 24, 2009, at 01:32 PM
by -
Added lines 1-2:
(:title Alcatel Switch Save Script:) |