Updates to the EOS driver based on PR comments from #365#368
Merged
itdependsnetworks merged 8 commits intonetworktocode:developfrom Apr 14, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
jeffkala
reviewed
Apr 14, 2026
jeffkala
reviewed
Apr 14, 2026
jeffkala
reviewed
Apr 14, 2026
Contributor
jeffkala
left a comment
There was a problem hiding this comment.
2 comments, but seems good for me
Fixed copy command builders to include the source file path in the URL and use `flash:` as destination, matching EOS CLI conventions. Fixed password-prompt handling to wait for transfer completion. Fixed `_uptime_to_string` integer division, and `check_file_exists` / `get_remote_checksum` to open SSH before use. Added integration tests and updated changelog fragments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ecated facts() Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Responding to @jeffkala's comments: Re: Good callout on readability, but the logic isn't quite the same — Re: half-baked typing (comment) Fair point. Adding type hints to the |
Addresses review feedback from jeffkala. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces write_channel + separate send_command_timing with a single send_command_timing(src.token) that sends the password and waits for transfer completion in one step. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Moves URL parsing into the model so it happens once instead of on every command builder call. The EOS driver now reads src.hostname, src.port, and src.path directly, eliminating urlparse calls from the copy command builders. Other drivers can adopt the new fields incrementally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
smk4664
approved these changes
Apr 14, 2026
Contributor
smk4664
left a comment
There was a problem hiding this comment.
Thanks for fixing those issues I pointed out!
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
Addresses review comments from @gsnider2195 on PR #365. Resolves 12 items across
eos_device.pyandtest_eos_device.py.Production code (
pyntc/devices/eos_device.py)open()/enable()so invalid inputs error without connecting to the device.get_remote_checksumnow validates against an EOS-specific subset (md5,sha1,sha256,sha512) and raises a clearValueErrorfor unsupported algorithms.str.split("=")for parsingverifycommand output._build_url_copy_command_simpleand_build_url_copy_command_with_credsnow include the destination filename so URL-derived names (e.g.,download) don't override the intended filename.?are rejected since EOS CLI cannot handle them.netlocfor host:port: Replaced manual hostname/port construction with computednetloc.include_usernameparameter. Routing is now based onsrc.username: ifNone, uses the simple builder; otherwise uses the creds builder. Token-only auth (no username) correctly falls through to the simple builder.clean_urlinstead ofdownload_url: Command builders usesrc.clean_urlto prevent credential leakage.verify_fileimprovements: Early return when file doesn't exist; case-insensitive checksum comparison._check_copy_output_for_errors.EOS_SUPPORTED_SCHEMESandEOS_SUPPORTED_HASHING_ALGORITHMSare now sets at module scope.Tests (
tests/unit/test_devices/test_eos_device.py)hypothesisimport block and all standalone@given/@pytest.mark.parametrizetest functions.unittest.TestCaseclasses withself.assertRaises,self.assertEqual, andself.subTest.TestRemoteFileCopyCommandExecutionclass (tests already covered byTestRemoteFileCopy).# TODO: unit test for remote_file_copy.Test plan
poetry run python -m pytest tests/unit/test_devices/test_eos_device.py— 65 passed, 19 subtests passedpoetry run ruff check— all checks passed🤖 Generated with Claude Code
The EOS device I'm testing against doesn't support the TLS version required by the server.