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:
#!/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"