mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 00:43:17 +08:00
Disable target paging after hop login and keep CLI echo on timeouts.
LLDP discover and config collect were timing out on --More--; send vendor paging-off after nested/bastion auth, and attach session-log tails so failures show where the CLI stuck. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
3adf8d8b75
commit
fbf73cbaaf
12 changed files with 334 additions and 40 deletions
41
tests/test_paging_disable.py
Normal file
41
tests/test_paging_disable.py
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
"""Tests for vendor paging-disable helpers used by LLDP / collect / hop."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from netx_api.ne_netmiko import disable_target_paging, paging_disable_commands
|
||||
|
||||
|
||||
class PagingDisableTests(unittest.TestCase):
|
||||
def test_commands_by_vendor(self) -> None:
|
||||
self.assertEqual(
|
||||
paging_disable_commands(vendor="Huawei", device_type="huawei"),
|
||||
["screen-length 0 temporary"],
|
||||
)
|
||||
self.assertEqual(
|
||||
paging_disable_commands(vendor="ZTE", device_type="zte_zxros"),
|
||||
["terminal length 0"],
|
||||
)
|
||||
self.assertEqual(
|
||||
paging_disable_commands(vendor="Cisco", device_type="cisco_ios"),
|
||||
["terminal length 0"],
|
||||
)
|
||||
self.assertEqual(
|
||||
paging_disable_commands(vendor="H3C", device_type="hp_comware"),
|
||||
["screen-length disable"],
|
||||
)
|
||||
|
||||
def test_disable_target_paging_uses_timing(self) -> None:
|
||||
conn = MagicMock()
|
||||
conn.send_command_timing.return_value = "ok\n<HUAWEI>"
|
||||
out = disable_target_paging(conn, vendor="Huawei", device_type="huawei")
|
||||
conn.send_command_timing.assert_called_once_with(
|
||||
"screen-length 0 temporary", read_timeout=15
|
||||
)
|
||||
self.assertIn("ok", out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue