jeremyschulman / netcfgbu

Network Configuration Backup
Apache License 2.0
105 stars 15 forks source link

HP Procurve connector, ANSI escape codes in the output #93

Open antonalekseev opened 3 years ago

antonalekseev commented 3 years ago

When I was working on a connector for HP Procurve device, initially in order to handle annoying login banner asking to press a key to actually get to a CLI prompt, but despite the fact that the banner was handled properly with custom login(), read_until_prompt() hadn't matched the prompt pattern. The issue was caused by the presence of ANSI escape codes in the output. I managed to workaround it by incorporating strip_ansi_escape_codes() function from https://github.com/ktbyers/netmiko/blob/0aa11265ea962f743f0ffa97d35ed4fa9aa0837d/netmiko/base_connection.py#L1777 in custom read_until_prompt() within my connector.

Are you interested in a PR which includes connector for HP Procurve in the code base and if so maybe there is more elegant way to handle the issue with escape codes?

jeremyschulman commented 3 years ago

Hi @antonalekseev - My apologies for being MIA for a while. I am curious if you have found a "more elegant way". I've also been tracking news of netmiko of their new version; not sure how that might better/affect. Please let me know.

As a next step you are welcome to issue the PR and I will review it to see what it is doing.