[rancid] Re: [PATCH] Add support for the Cisco WLC
Ryan West
rwest at zyedge.com
Tue Apr 27 23:46:53 UTC 2010
Michael,
> -----Original Message-----
> From: rancid-discuss-bounces at shrubbery.net [mailto:rancid-discuss-
> bounces at shrubbery.net] On Behalf Of Michael Stefaniuc
> Sent: Tuesday, April 27, 2010 4:04 PM
> To: rancid-discuss at shrubbery.net
> Subject: [rancid] [PATCH] Add support for the Cisco WLC
>
> Hello guys,
>
> I hoped that somebody would beat me to add the Cisco WLC upstream...
> Though there was a lot of interest in testing such a patch so here it is.
> Especially testing on versions 4.x is needed as I could test it only on 5.2.x
> and 6.0.x.
It's much cleaner with this version, but it's still failing on the pager or an expect loop. I would move over to version 6 assurewave but I think I would hit some of the bugs, so I'm holding on to 4.2.207 for a bit longer.
Here is what's happening:
rancid at netman:~/bin$ rancid-run -V
rancid 2.3.3
rancid at netman:~/bin$ expect -v
expect version 5.43.0 - debian Lenny 5.43.0-17 build
rancid at netman:~/bin$ wlclogin -c 'show run-config commands' cisco-wlc4
cisco-wlc4
spawn ssh -c 3des -x -l adminuser1234 cisco-wlc4
(Cisco Controller)
User: adminuser1234
Password:********
(Cisco Controller) >
(Cisco Controller) >term length 0
Incorrect usage. Use the '?' or <TAB> key to list commands.
(Cisco Controller) >show run-config commands
System Inventory
NAME: "Chassis" , DESCR: "4400 Series WLAN Controller:12 APs"
PID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111
Burned-in MAC Address............................ xx:xx:xx:xx:xx:xx
Crypto Accelerator 1............................. Absent
Crypto Accelerator 2............................. Absent
Power Supply 1................................... Absent
Power Supply 2................................... Present, OK
Error: TIMEOUT reached
============ same command with debug level set =========================
(Cisco Controller) >
expect: does "term length 0\r\n\r\nIncorrect usage. Use the '?' or <TAB> key to list commands.\r\n\r\n(Cisco Controller) >" (spawn_id exp6) match regular expression "\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? yes
expect: set expect_out(0,string) "(Cisco Controller) >"
expect: set expect_out(1,string) "troller) "
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "term length 0\r\n\r\nIncorrect usage. Use the '?' or <TAB> key to list commands.\r\n\r\n(Cisco Controller) >"
send: sending "show run-config commands\r" to { exp6 }
expect: does "" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? no
"[^\r\n]*Press <SPACE> to cont[^\r\n]*"? no
"^ *--More--[^\n\r]*"? no
"^<-+ More -+>[^\n\r]*"? no
"^Press Enter to continue or <Ctrl-Z> to abort[^\n\r]*"? no
expect: does "s" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? no
"[^\r\n]*Press <SPACE> to cont[^\r\n]*"? no
"^ *--More--[^\n\r]*"? no
"^<-+ More -+>[^\n\r]*"? no
"^Press Enter to continue or <Ctrl-Z> to abort[^\n\r]*"? no
expect: does "show run-config commands\r\nSystem Inventory\n\rNAME: "Chassis" , DESCR: "4400 Series WLAN Controller:12 APs"\n\rPID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111\r\n\r\nBurned-in MAC Address............................ xx:xx:xx:xx:xx:xx\r\nCrypto Accelerator 1............................. Absent\r\nCrypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "show run-config commands\r\n"
show run-config commands
expect: continuing expect
expect: does "System Inventory\n\rNAME: "Chassis" , DESCR: "4400 Series WLAN Controller:12 APs"\n\rPID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111\r\n\r\nBurned-in MAC Address............................ xx:xx:xx:xx:xx:xx\r\nCrypto Accelerator 1............................. Absent\r\nCrypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\n\r"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "System Inventory\n\r"
System Inventory
expect: continuing expect
expect: does "NAME: "Chassis" , DESCR: "4400 Series WLAN Controller:12 APs"\n\rPID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111\r\n\r\nBurned-in MAC Address............................ xx:xx:xx:xx:xx:xx\r\nCrypto Accelerator 1............................. Absent\r\nCrypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\n\r"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "NAME: "Chassis" , DESCR: "4400 Series WLAN Controller:12 APs"\n\r"
NAME: "Chassis" , DESCR: "4400 Series WLAN Controller:12 APs"
expect: continuing expect
expect: does "PID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111\r\n\r\nBurned-in MAC Address............................ xx:xx:xx:xx:xx:xx\r\nCrypto Accelerator 1............................. Absent\r\nCrypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "PID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111\r\n\r\n"
PID: AIR-WLC4402-12-K9, VID: V02, SN: FOC11111111
expect: continuing expect
expect: does "Burned-in MAC Address............................ xx:xx:xx:xx:xx:xx\r\nCrypto Accelerator 1............................. Absent\r\nCrypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Burned-in MAC Address............................ xx:xx:xx:xx:xx:xx\r\n"
Burned-in MAC Address............................ xx:xx:xx:xx:xx:xx
expect: continuing expect
expect: does "Crypto Accelerator 1............................. Absent\r\nCrypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Crypto Accelerator 1............................. Absent\r\n"
Crypto Accelerator 1............................. Absent
expect: continuing expect
expect: does "Crypto Accelerator 2............................. Absent\r\nPower Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Crypto Accelerator 2............................. Absent\r\n"
Crypto Accelerator 2............................. Absent
expect: continuing expect
expect: does "Power Supply 1................................... Absent\r\nPower Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Power Supply 1................................... Absent\r\n"
Power Supply 1................................... Absent
expect: continuing expect
expect: does "Power Supply 2................................... Present, OK\r\n\r\nPress Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? yes
expect: set expect_out(0,string) "\r\n\r\n"
expect: set expect_out(spawn_id) "exp6"
expect: set expect_out(buffer) "Power Supply 2................................... Present, OK\r\n\r\n"
Power Supply 2................................... Present, OK
expect: continuing expect
expect: does "Press Enter to continue Or <Ctl Z> to abort" (spawn_id exp6) match regular expression "\u0008+"? no
"^[^\n\r *]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?"? no
"^[^\n\r]*\(Cisco Con([^#>\r\n]+)?[#>](\([^)\r\n]+\))?."? no
"^--More--\r\n"? no
"[\n\r]+"? no
"[^\r\n]*Press <SPACE> to cont[^\r\n]*"? no
"^ *--More--[^\n\r]*"? no
"^<-+ More -+>[^\n\r]*"? no
"^Press Enter to continue or <Ctrl-Z> to abort[^\n\r]*"? no
expect: timed out
Error: TIMEOUT reached
write() failed to write anything - will sleep(1) and retry...
When the 'show run-config commands' is run from CLI, I am able to page properly through the file. Can anyone shed any light on what might be causing what appears to be an expect loop?
Thanks,
-ryan
More information about the Rancid-discuss
mailing list