fix(driver): run netmiko off the event loop and use send_command_timing - #375
Open
WilhelmZA wants to merge 2 commits into
Open
fix(driver): run netmiko off the event loop and use send_command_timing#375WilhelmZA wants to merge 2 commits into
WilhelmZA wants to merge 2 commits into
Conversation
…mpty reads MikroTik can take a couple seconds to start emitting output for larger queries (the command executes before any bytes return). netmiko send_command_timing's default last_read (2.0s) elapses during that initial silence and returns an empty string, so hyperglass parses 0 routes even though the device would return a full table. It is latency-sensitive: it shows up for devices tens of ms away (e.g. a Cape Town router queried from a Johannesburg node) while nearby devices squeak through, and the empty-table retry cannot help since every attempt hits the same window. Set last_read=5.0 for mikrotik_routeros/switchos so the read waits for output to begin. Empirically last_read>=4.0 reliably returns the full output where 2.0 returns empty; trade-off is ~5s added per MikroTik query (last_read is also the trailing quiet-wait). send_command (prompt-based) was tried and rejected: RouterOS prompt detection truncates output through the driver, which is why send_command_timing is used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the netmiko SSH driver so blocking I/O no longer runs on the asyncio event loop, and switches to
send_command_timingfor more reliable output collection on devices with unpredictable prompts/pacing.Changes
send_command_timingto avoid prompt-detection failures and premature truncation.hyperglass/execution/drivers/ssh_netmiko.py— +26/−11.Notes
Standalone bug fix; independent of the structured-output PR series.