Skip to content
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

EOFerror on HP Procurve intermittently #3490

Open
giacomotontini opened this issue Aug 27, 2024 · 0 comments
Open

EOFerror on HP Procurve intermittently #3490

giacomotontini opened this issue Aug 27, 2024 · 0 comments

Comments

@giacomotontini
Copy link

giacomotontini commented Aug 27, 2024

Description of Issue/Question

I wrote a python script to parse via TextFsm the output of cli command on a HP Procurve 2810 switch.
The odd thing is that it runs fine the first time and then the second one throws an EOFerror, the third one work, the fourth one not works and so on.

Inspecting the logs, netmiko is able to connect via ssh to the switch, skip the initial key pressure prompt, write down the credential and log into the switch (both in working and not working scenario)
"Thread-1 paramiko.transport INFO: Authentication (password) successful!"

I've also tried to manually connect and execute the same cli command on the switch to verify the behavior of the device but cli output is always the same. This is not caused by a parsing error. The EOF happens way before parsing stage. In fact, the error happens even without sending any command ("show arp" in the example below).

Playing with timeout values in device_config didn't affect this behavior.

Setup

other than netmiko, ensure ntc_templates is installed

Netmiko version

4.4.0

Netmiko device_type

hp_procurve

Steps to Reproduce the Issue

Execute the script multiple times. The first one works, the second not, the third one works, the fourth not and so on.

Error Traceback

see attachments (working.txt and eof-error.txt)
eof-error.txt
working.txt

Python code

from ntc_templates.parse import parse_output
from netmiko.hp.hp_procurve import HPProcurveSSH
from pprint import pprint
import logging

logging.basicConfig(
    format='%(threadName)s %(name)s %(levelname)s: %(message)s',
    level=logging.DEBUG,
)

device_config = {
    'device_type': 'hp_procurve',
    'host': '10.255.12.7',
    'username': 'admin', 
    'password': [retracted],
    "verbose": True,
    #"global_delay_factor": 5,
    #"conn_timeout": 20,
    #"auth_timeout": 5,
    #"session_timeout": 5,
    #"banner_timeout": 5,
    #"read_timeout_override": 5
}

def get_arp_table(connection):
    command = 'show arp'
    output = connection.send_command(command)
    return parse_output(platform="hp_procurve", command=command, data=output)


def main(*args, **kwargs):
    # Connessione allo switch HP ProCurve
    try: 
        connection = HPProcurveSSH(**device_config)
        with connection:
            #connection.session_preparation()
            arp_table = get_arp_table(connection)
            pprint(arp_table)
        
    except EOFError as e:
        logging.error(f"Damn EOF")

if __name__ == "__main__":
    main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant