ixs / napalm-procurve

HP ProCurve Driver for NAPALM automation frontend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Read Timeout

DatalinkNetworks opened this issue · comments

Unfortunately I do not see any way of altering the read timeout. It is set to the default value of 10 seconds. This is fine for many commands, but in particular, show log on procurve can take a long time to generate all of the output.

After delving into both napalm-procurve and napalm sources, I have determined (and tested) that this can be solved by adding a single line. Inside of procurve.py, there is a dict of possible Netmiko arguments that can be provided. Unfortunately, anything not inside this list is simply ignored. So we can either nix the whole "parameter must be defined in this possible argument map" or we can add this to the code:

        # Netmiko possible arguments
        netmiko_argument_map = {
            "port": None,
            "secret": "",
            "verbose": False,
            "keepalive": 30,
            "global_delay_factor": 1,
            "use_keys": False,
            "key_file": None,
            "ssh_strict": False,
            "system_host_keys": False,
            "alt_host_keys": False,
            "alt_key_file": "",
            "ssh_config_file": None,
        }

We simply need to add the following entry into the dict:

            "read_timeout_override": None,

Then it can be passed as an optional argument:

        driver = get_network_driver(self.driver)
        device = driver(
            hostname=self.host,
            username=self.username,
            password=self.password,
            timeout=60,
            optional_args={
                "port": self.port,
                "read_timeout_override": 30.0,
            },
        )
commented

did even realize that that option was not there.
Can you PR it?

great find!

commented

Created the PR: #32