Discussion:
[rancid] [PATCH] Add support for the Cisco WLC
Michael Stefaniuc
2010-04-27 20:04:03 UTC
Permalink
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.

The attached patch is heavily based on the scripts posted by Ryan West
here on rancid-discuss
(http://www.shrubbery.net/pipermail/rancid-discuss/2010-February/004652.html).

The patch applies on top of 2.3.3 and the license of the portions done
by me is as always "whatever it takes to get the patch accepted upstream".


My modifications:
-----------------
- Rename ciscowlc5 to wlcrancid.
- Rename wlogin to wlclogin.
- Merge support for version 4.x into wlcrancid (*untested*).
- Add -V command line arg to wlclogin/wlcrancid.
- Remove the "!--WLC Begin Config Data--" markers.
- Cleanups in wlcrancid (indentation, whitespace).
- Added the needed configure/Makefile changes.

Todo:
-----
I might work on this items, when I get the time for it is a totally
different story.
- Add man pages for wlclogin/wlcrancid
Ryan West
2010-04-27 23:46:53 UTC
Permalink
Michael,
-----Original Message-----
Sent: Tuesday, April 27, 2010 4:04 PM
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:

***@netman:~/bin$ rancid-run -V
rancid 2.3.3
***@netman:~/bin$ expect -v
expect version 5.43.0 - debian Lenny 5.43.0-17 build


***@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 b
john heasley
2010-04-28 08:44:05 UTC
Permalink
Post by Ryan West
Michael,
-----Original Message-----
Sent: Tuesday, April 27, 2010 4:04 PM
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.
rancid 2.3.3
expect version 5.43.0 - debian Lenny 5.43.0-17 build
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.
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?
the pager is waiting.
Michael Stefaniuc
2010-04-28 22:11:17 UTC
Permalink
On 04/28/2010 01:46 AM, Ryan West wrote:
Hello Ryan,
Post by Ryan West
-----Original Message-----
Sent: Tuesday, April 27, 2010 4:04 PM
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.
thanks for the detailed report; it made it easy to figure out what goes
wrong. The 4.x versions seem to use this pager prompt too:
Press Enter to continue Or<Ctl Z> to abort

The fix was easy aka accept both "or" and "Or" and don't send a
CTRL-Z but an ENTER. It still worked just fine on my 6.0.x boxes but the
5.2.x box begged to differ... There is one place in the "show
running-config" where the pager "--More-- or (q)uit" clobbers a previous
line.

Can you please give the attached patch a whirl? It applies on top of my
previous patch. I have added also an unrelated change for wlcrancid
where the "External Temperature" is filtered out too.

thanks
bye
michael
--
Michael Stefaniuc Tel.: +49-711-96437-199
Consulting Communications Engineer Fax.: +49-711-96437-111
--------------------------------------------------------------------
Reg. Adresse: Red Hat GmbH, Otto-Hahn-Strasse 20, 85609 Dornach
Handelsregister: Amtsgericht Muenchen HRB 153243
GeschÀftsfÌhrer: Brendan Lane, Charlie Peters, Michael Cunningham,
Charles Cachera
Ryan West
2010-04-29 03:12:28 UTC
Permalink
Michael,
-----Original Message-----
Sent: Wednesday, April 28, 2010 6:11 PM
To: Ryan West
Subject: Re: [rancid] [PATCH] Add support for the Cisco WLC
Hello Ryan,
Post by Ryan West
-----Original Message-----
Sent: Tuesday, April 27, 2010 4:04 PM
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.
thanks for the detailed report; it made it easy to figure out what goes wrong.
Press Enter to continue Or<Ctl Z> to abort
The fix was easy aka accept both "or" and "Or" and don't send a CTRL-Z but an
ENTER. It still worked just fine on my 6.0.x boxes but the 5.2.x box begged to
differ... There is one place in the "show running-config" where the pager "--
More-- or (q)uit" clobbers a previous line.
Can you please give the attached patch a whirl? It applies on top of my
previous patch. I have added also an unrelated change for wlcrancid where the
"External Temperature" is filtered out too.
I worked through the pager issues earlier as well, I used ^.*--More--.* to match on the unclean line. The problem still exists though, the output from 'show run-config commands' is very detailed and will change a lot over time. Some logic would need to be added to determine the major code version before issuing the commandtable.

Here's some output:

Radio Type..................................... RADIO_TYPE_80211b/g
Noise Information
Noise Profile................................ PASSED
Channel 1.................................... -103 dBm
Channel 2.................................... -98 dBm
Channel 3.................................... -93 dBm
Channel 4.................................... -97 dBm
Channel 5.................................... -100 dBm
Channel 6.................................... -102 dBm
Channel 7.................................... -99 dBm
Channel 8.................................... -95 dBm
Channel 9.................................... -94 dBm
Channel 10................................... -102 dBm
Channel 11................................... -101 dBm
Interference Information
Interference Profile......................... PASSED
Channel 1.................................... -80 dBm @ 5 % busy
Channel 2.................................... -128 dBm @ 0 % busy
............................. -128 dBm @ 0 % busy
Channel 4.................................... -128 dBm @ 0 % busy
Channel 5.................................... -128 dBm @ 0 % busy
Channel 6.................................... -78 dBm @ 5 % busy
Channel 7.................................... -128 dBm @ 0 % busy
Channel 8.................................... -128 dBm @ 0 % busy
Channel 9.................................... -128 dBm @ 0 % busy
Channel 10................................... -86 dBm @ 1 % busy
Channel 11................................... -75 dBm @ 4 % busy

Thanks,

-ryan
john heasley
2010-04-29 05:20:12 UTC
Permalink
Post by Ryan West
Michael,
-----Original Message-----
Sent: Wednesday, April 28, 2010 6:11 PM
To: Ryan West
Subject: Re: [rancid] [PATCH] Add support for the Cisco WLC
Hello Ryan,
Post by Ryan West
-----Original Message-----
Sent: Tuesday, April 27, 2010 4:04 PM
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.
thanks for the detailed report; it made it easy to figure out what goes wrong.
Press Enter to continue Or<Ctl Z> to abort
The fix was easy aka accept both "or" and "Or" and don't send a CTRL-Z but an
ENTER. It still worked just fine on my 6.0.x boxes but the 5.2.x box begged to
differ... There is one place in the "show running-config" where the pager "--
More-- or (q)uit" clobbers a previous line.
Can you please give the attached patch a whirl? It applies on top of my
previous patch. I have added also an unrelated change for wlcrancid where the
"External Temperature" is filtered out too.
I worked through the pager issues earlier as well, I used ^.*--More--.* to match on the unclean line. The problem still exists though, the output from 'show run-config commands' is very detailed and will change a lot over time. Some logic would need to be added to determine the major code version before issuing the commandtable.
you want to turn off the pager if at all possible. if 4.x cant do it but
could be upgraded, i'd just ignore 4.x - its that much of a pita.
Post by Ryan West
Radio Type..................................... RADIO_TYPE_80211b/g
Noise Information
Noise Profile................................ PASSED
Channel 1.................................... -103 dBm
Channel 2.................................... -98 dBm
Channel 3.................................... -93 dBm
Channel 4.................................... -97 dBm
Channel 5.................................... -100 dBm
Channel 6.................................... -102 dBm
Channel 7.................................... -99 dBm
Channel 8.................................... -95 dBm
Channel 9.................................... -94 dBm
Channel 10................................... -102 dBm
Channel 11................................... -101 dBm
Interference Information
Interference Profile......................... PASSED
Thanks,
-ryan
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
Loading...