New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Brocade Fastiron and Netiron Telnet Support #516
Conversation
Added Fastiron and Netiron telnet support. I had to override several methods because when connected via Telnet both Fastiron and Netiron expect a combination of '\r\n' to be sent at the end of a line. So every method that calls write_channel('\n') hardcoded had to be overridden to send '\r\n'. Might patch base_connection in the future to store the newline character in a variable to allow overriding without the duplication of all the functions. Also had to override the 3 config related methods (check_config_mode, config_mode, and exit_config_mode) to set the expected pattern to the equivalent of the prompt (I was inheriting from Cisco Base with truncates this because IOS truncates it).
Added import statements for Brocade Fastiron and Netiron telnet support.
Removed debug = True line
Nmusser brocade telnet
Formatting changes to be PEP8 compliant
Adding import for NetMikoTimeoutException
PEP8 updates
Overriding send_command because of an issue with the whole \r\n nonsense. Basically we force sending \r\n because the Brocade requires both for a newline but then the output is sanitized so we only have a \n between each line. So when we go to sanitize the output we remove the length of the command string from the beginning of the output. Because the command string has \r\n on the end of it but the actual output only has \n we were removing 1 extra character.
Overriding send_command because of an issue with the whole \r\n nonsense. Basically we force sending \r\n because the Brocade requires both for a newline but then the output is sanitized so we only have a \n between each line. So when we go to sanitize the output we remove the length of the command string from the beginning of the output. Because the command string has \r\n on the end of it but the actual output only has \n we were removing 1 extra character.
Yes, let's patch base_connection.py insteado of duplicating all of those methods (i.e. add an argument to the method for Probably Does it matter if IOS truncates the trailing prompt that it is searching for? Or asked another way why is this behavior different from the Brocade FastIron/NetIron SSH driver? |
modified: netmiko/base_connection.py modified: netmiko/brocade/__init__.py modified: netmiko/brocade/brocade_fastiron_telnet.py modified: netmiko/brocade/brocade_netiron_telnet.py modified: netmiko/cisco_base_connection.py modified: netmiko/ssh_dispatcher.py
As you requested I patched base_connection.py to add an argument for
My code before was really hacked together and sloppy. I took more time testing this time and doing it properly (as you can see I didn't make a million commits to be PEP8 compliant like before). I discovered that you don't have to send a |
@nmusser This was merged in here: https://github.com/ktbyers/netmiko/tree/netmiko_dev_1_5 Note, in Netmiko 1.5 I abstracted away the 'enter' key so I restructured your code to reflect this. It would be helpful if you could test the updated code. Thanks. |
PR #235 only added support for SSH. I've gone ahead and added Telnet support for Fastiron and Netiron.
Tested against:
Brocade FCX648S-HPOE, IronWare Version 07.4.00dT7f1
Brocade ICX6610-48-HPOE, IronWare Version 07.4.00dT7f1
Brocade CER, IronWare Version V5.6.0jT183
Brocade MLXe, IronWare Version V5.7.0eT163
I had to override several methods because when connected via Telnet both Fastiron and Netiron expect a combination of '\r\n' to be sent at the end of a line. So every method that calls write_channel('\n') had to be overridden to send '\r\n'. Might patch base_connection in the future to store the newline character in a variable to allow overriding without the duplication of all the functions.
Also had to override the 3 config related methods (check_config_mode, config_mode, and exit_config_mode) to set the expected pattern to the equivalent of the prompt (I was inheriting from Cisco Base with truncates this because IOS truncates it).