Mass-upgrade 6450, how to SSH-login?

Post Reply
Konstigt
Member
Posts: 3
Joined: 09 Feb 2011 17:30

Mass-upgrade 6450, how to SSH-login?

Post by Konstigt »

I am going to upgrade hundreds of 6450. We do not have OmniVista.

During this work we will also do some minor config changes.

Since there is only SSH access enabled to the switches, how can I do a login automatically to enter my commands? Because the program 'sshpass' which I have used on OmniSwitch 6900 does not work on 6450.

Code: Select all

$ sshpass -p 'MyPassword' ssh admin@10.10.0.21 'show system'
System:
  Description:  Alcatel-Lucent OS6900-X40 7.3.2.433.R01 Service Release, January 18, 2014.,
  Object ID:    1.3.6.1.4.1.6486.801.1.1.2.1.10.1.2,
  Up Time:      50 days 7 hours 40 minutes and 29 seconds,
  Contact:      Alcatel-Lucent, http://alcatel-lucent.com/wps/portal/enterprise,
  Name:         XXX
  Location:     Unknown,
  Services:     78,
  Date & Time:  THU MAR 20 2014 13:41:24 (CET)
Flash Space:
    Primary CMM:
      Available (bytes):  1660207104,
      Comments         :  None

$ sshpass -p 'MyPassword' ssh admin@10.20.51.1 'show system'
cygate's password for keyboard-interactive method: 

<hangs here, waiting for input>
The only workaround I can think of is to temporarily enable telnet via SNMP before the upgrade, do the upgrade & changes, reboot from working, certify, disable telnet, write memory, disable telnet and logout.
Konstigt
Member
Posts: 3
Joined: 09 Feb 2011 17:30

Re: Mass-upgrade 6450, how to SSH-login?

Post by Konstigt »

It actually worked just using expect. I have read in a number of posts that this would not work but it did :)

One example below that logs into the switch, runs show switch and then logs out. The output from the command will be on the console.
#!/usr/bin/expect

set host [lindex $argv 0]
set username admin
set password switch
set timeout 10
set verbose 0

#check if all were provided
if { $host == "" } {
puts "Usage: script <hostname/IP>\n"
exit 1
}

spawn ssh -o StrictHostKeyChecking=no $username\@$host
expect "*method:"
send -- "$password\r"
expect -- "-"
send "show system\r"
expect -- "-"
send "exit\r"
expect eof
devnull
Alcatel Unleashed Certified Guru
Alcatel Unleashed Certified Guru
Posts: 976
Joined: 07 Sep 2010 10:16
Location: Germany

Re: Mass-upgrade 6450, how to SSH-login?

Post by devnull »

I have not tried it myself but you could use cssh (Cluster SSH) oder pssh (parallel ssh).

I have an Omnivista for that, otherwise you could probably code something by yourself using perl & expect.

I never had a ssh failing on a 6450. so maybe it is worth to debug your sshpass to find out why it hangs?
eugene
Member
Posts: 24
Joined: 17 Dec 2018 19:24

Re: Mass-upgrade 6450, how to SSH-login?

Post by eugene »

This is old thread but I'd like to update that this method to run SSH "background" jobs on the switch still works. I say "background" because "expect" creates a tty session and pretends to be a user to send the command.

I use the expect script to automate the printing of switch users as a routine task. This "expect" script is in turn executed via an Ansible script. Ansible has an "expect" module but this module requires Python in the switch.

Code: Select all

#!/usr/bin/expect

set hostname [lindex $argv 0]

spawn ssh -o StrictHostKeyChecking=no $hostname
expect -- "-"
send "show user\r"
expect -- "-"
send "exit\r"
expect eof
Post Reply

Return to “OmniSwitch 6450”