You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Trying to add a community driver for Aruba (former HP) 2530 series switches (https://www.hpe.com/psnow/doc/c04111414), but I'm encountering issues with some ANSI escape codes not being stripped from the channel input, and thus pattern matching failing (authentication successful check, prompt detection, etc.).
For some reason, it seems like the switch outputs a lot of escape sequences, for example immediately after login succeeds:
read: b'\x1b[?6l\x1b[1;80r\x1b[?7h\x1b[2J\x1b[1;1H\x1b[1920;1920H\x1b[6n\x1b[1;1HYour previous successful login (as manager) was on 2024-05-24 11:29:02 \n from X.X.X.X\n\x1b[1;80r\x1b[80;1H\x1b[80;1H\x1b[2K\x1b[80;1H\x1b[?25h\x1b[80;1H\x1b[80;1HHOSTNAME# \x1b[80;1H\x1b[80;20H\x1b[80;1H\x1b[?25h\x1b[80;20H\x1b[1;0H\x1b[1M\x1b[80;1H\x1b[1L\x1b[80;20H\x1b[80;1H\x1b[2K\x1b[80;1H\x1b[?25h\x1b[80;1H\x1b[1;80r\x1b[80;1H\x1b[1;80r\x1b[80;1H\x1b[80;1H\x1b[2K\x1b[80;1H\x1b[?25h\x1b[80;1H\x1b[80;1HHOSTNAME# \x1b[80;1H\x1b[80;20H\x1b[80;1H\x1b[?25h\x1b[80;20H'
Even after BaseChannel._strip_ansi() is being called internally by scrapli, I'm still left with a few escape sequences in the output:
b'\x1b[1;80rYour previous successful login (as manager) was on 2024-05-24 11:29:02 \n from X.X.X.X\n\x1b[1;80rHOSTNAME# \x1b[1;80r\x1b[1;80rHOSTNAME# '
I assume that base_channel.ANSI_ESCAPE_PATTERN is missing patterns for these escape codes, however I can't exactly figure out what these codes do. Maybe someone can chime in on this.
I tried manually altering the regex pattern being used internally by scrapli and replacing it with one of the answers mentioned in this Stack Overflow thread, and it seems like all escape sequences get stripped (and I am left with a clean output which matches my regex patterns for prompt matching):
Your script
Can't really provide a sample script yet, since I'm still trying to piece the community driver together (and currently failing to make it work due to this issue). However, it is based on GenericDriver.
What you're connecting to (vendor, platform, version)
Aruba (HP/HPE) ProCurve 2530-24G switches, running OS version YA.16.10.0009.
Anything else relevant
-
Expected behavior
After calling BaseChannel._strip_ansi(), the output should probably be similar to this:
Your previous successful login (as manager) was on 2024-05-24 11:29:02 \n from X.X.X.X\nHOSTNAME# HOSTNAME#
ahah ansi stuff is really the gift that keeps on giving 🤣
our ol friend chat gpt seems to be handy for helping out with this at least! just made #332 to handle this. try it out and let us know if thats cool? I added a quick test case for it so I think it should be but just want to confirm there aren't other fun ones floating around in there!
Describe the bug
Trying to add a community driver for Aruba (former HP) 2530 series switches (https://www.hpe.com/psnow/doc/c04111414), but I'm encountering issues with some ANSI escape codes not being stripped from the channel input, and thus pattern matching failing (authentication successful check, prompt detection, etc.).
For some reason, it seems like the switch outputs a lot of escape sequences, for example immediately after login succeeds:
Even after
BaseChannel._strip_ansi()
is being called internally by scrapli, I'm still left with a few escape sequences in the output:I assume that
base_channel.ANSI_ESCAPE_PATTERN
is missing patterns for these escape codes, however I can't exactly figure out what these codes do. Maybe someone can chime in on this.I tried manually altering the regex pattern being used internally by scrapli and replacing it with one of the answers mentioned in this Stack Overflow thread, and it seems like all escape sequences get stripped (and I am left with a clean output which matches my regex patterns for prompt matching):
To Reproduce
Steps to reproduce the behavior:
Your script
Can't really provide a sample script yet, since I'm still trying to piece the community driver together (and currently failing to make it work due to this issue). However, it is based on
GenericDriver
.What you're connecting to (vendor, platform, version)
Aruba (HP/HPE) ProCurve 2530-24G switches, running OS version YA.16.10.0009.
Anything else relevant
-
Expected behavior
After calling
BaseChannel._strip_ansi()
, the output should probably be similar to this:Stack Trace
-
Screenshots
-
OS (please complete the following information):
python:3.11
.scrapli==2024.1.30 & scrapli-community==2024.1.30
Additional context
-
The text was updated successfully, but these errors were encountered: