Unable to get config from HPE Aruba 2530 switch with firmware 16.02.0016
I tried to add new 2530 switch to Oxidized today and noticed that it fails to fetch config from the switch. The switch has quite a new fw and older similar switches that I have are working fine. Also found a way to get some debug printing from here but didn't managed to solve this problem. Here the problem and sample debug output from one of the older switches.
New switch which does not work
D, [2017-02-16T17:32:28.563799 #14218] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at switch-new
D, [2017-02-16T17:32:28.563920 #14218] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "no page", block: nil at switch-new
D, [2017-02-16T17:32:28.563957 #14218] DEBUG -- : lib/oxidized/input/ssh.rb no page @ switch-new with expect: /^\r?([\w -]+\eE)?([\w.-]+# )$/
D, [2017-02-16T17:32:28.564110 #14218] DEBUG -- : lib/oxidized/input/ssh.rb: expecting [/^\r?([\w -]+\eE)?([\w.-]+# )$/] at switch-new
D, [2017-02-16T17:32:28.865361 #14218] DEBUG -- : shell_open: "\e[24;16Hno page\e[24;16H\e[?25h\e[24;23H\e[1;0H\e[1M\e[24;1H\e[1L\e[24;23H\e[24;1H\e[2K\e[24;1H\e[?25h\e[24;1H\e[1;24r\e[24;1H\e[1;24r\e[24;1H\e[24;1H\e[2K\e[24;1H\e[?25h\e[24;1H\e[24;1Hswitch-new# \e[24;1H\e[24;16H\e[24;1H\e[?25h\e[24;16H"
D, [2017-02-16T17:32:28.997173 #14218] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2017-02-16T17:32:29.997443 #14218] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2017-02-16T17:32:30.997666 #14218] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
...
...
...
D, [2017-02-16T17:32:47.001637 #14218] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
D, [2017-02-16T17:32:48.001967 #14218] DEBUG -- : lib/oxidized/worker.rb: 1 jobs running in parallel
W, [2017-02-16T17:32:48.564676 #14218] WARN -- : 10.10.10.10 raised Timeout::Error with msg "execution expired"
D, [2017-02-16T17:32:48.564767 #14218] DEBUG -- : lib/oxidized/node.rb: Oxidized::SSH failed for switch-new
Older one that is working
D, [2017-02-16T17:32:22.391569 #14218] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login commands at switch-old
D, [2017-02-16T17:32:22.391713 #14218] DEBUG -- : lib/oxidized/input/cli.rb: Running post_login command: "no page", block: nil at switch-old
D, [2017-02-16T17:32:22.391789 #14218] DEBUG -- : lib/oxidized/input/ssh.rb no page @ switch-old with expect: /^\r?([\w -]+\eE)?([\w.-]+# )$/
D, [2017-02-16T17:32:22.392054 #14218] DEBUG -- : lib/oxidized/input/ssh.rb: expecting [/^\r?([\w -]+\eE)?([\w.-]+# )$/] at switch-old
D, [2017-02-16T17:32:22.693345 #14218] DEBUG -- : shell_open: "\e[24;29Hno page\e[24;29H\e[?25h\e[24;36H\e[24;0H\eE\e[24;1H\e[24;36H\e[24;1H\e[2K\e[24;1H\e[?25h\e[24;1H\e[1;24r\e[24;1H\e[1;24r\e[24;1H\e[24;1H\e[2K\e[24;1H\e[?25h\e[24;1H\e[24;1Hswitch-old# \e[24;1H\e[24;29H\e[24;1H\e[?25h\e[24;29H"
D, [2017-02-16T17:32:22.793848 #14218] DEBUG -- : lib/oxidized/model/model.rb Collecting commands' outputs
D, [2017-02-16T17:32:22.793972 #14218] DEBUG -- : lib/oxidized/model/model.rb Executing show version
After trying to solve this, I managed to find out what is the reason:
After expects the output from the old switch is "no page\nswitch-old# " and from the new switch "no pageswitch-new# ". The difference between these two original outputs is that the switch running newer firmware version doesn't print "\eE" indicating line change after the "no page" and because of that, the current prompt regexp doesn't match. Instead of "\eE" there is still another sequence of control characters which probably could be used, "\e[1M\e[24;1H\e[1L". I have couple of questions and and a suggestion how this could be fixed.
Is there some known order for every different expect block in which they will be executed? If we know that the "new line expect" is executed before the "replace all used vt100 control sequences" expect, maybe it can be changed to form
# replace next line control sequence with a new line
expect /(\e\[1M\e\[\??\d+(;\d+)*[A-Za-z]\e\[1L)|(\eE)/ do |data, re|
data.gsub re, "\n"
end
Another question regarding the last commit. Now when this "next line expect" is handling the issue with previous command before the promt, could the prompt regexp be a bit more simple like
prompt /^\r?([\w.-]+# )$/
Just made a pull request to solve this. At least all procurve switches in our environment are now working fine.
FYI, we didn't need this patch on 16.03.0003, but we did when we went to 16.03.0004. In case it helps anyone else. Thank you for the fix!
This appears to have been fixed in #746.