ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.59k stars 1.31k forks source link

what is netmiko doing? #1333

Closed NosIreland closed 5 years ago

NosIreland commented 5 years ago

using Netmiko 2.4.1 Connecting to HPE Comware switch. I'm trying to run a command that will send file from switch to FTP server but with debugging enabled I see that just on connect netmiko is interogating the switch. Why is it doing this? Also why it sends '\n' multiple times?

Connection code: net_connect = ConnectHandler(device_type='hp_comware', host=device[1], username=device[2], password=device[3]) net_connect.disconnect()

Debug:

<HPE_SW>
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
<HPE_SW>
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
<HPE_SW>
DEBUG:netmiko:read_channel:
<HPE_SW>
DEBUG:netmiko:read_channel:
DEBUG:netmiko:In disable_paging
DEBUG:netmiko:Command:
screen-length disable

DEBUG:netmiko:write_channel: b'\nscreen-length disable\n'
DEBUG:netmiko:Pattern is: 
DEBUG:netmiko:_read_channel_expect read_data:
DEBUG:netmiko:_read_channel_expect read_data:
<HPE_SW>screen-length disable
<HPE_SW>
DEBUG:netmiko:Pattern found: 
<HPE_SW>screen-length disable
<HPE_SW>
DEBUG:netmiko:
<HPE_SW>screen-length disable
<HPE_SW>
DEBUG:netmiko:Exiting disable_paging
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\n'
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
<HPE_SW>
DEBUG:netmiko:read_channel:
DEBUG:netmiko:read_channel:
DEBUG:netmiko:exit_config_mode:
DEBUG:netmiko:write_channel: b'exit\n'
DEBUG:paramiko.transport:EOF in transport thread
carlmontanari commented 5 years ago

Netmiko needs to try to find prompts to know when things are "done" (when session is established/setup (disable paging, etc.), when a command is completed, etc.). Take a look at this post from Kirk it should help explain things. Closing as this is not an issue/bug.