Advertisement
tarrac

Untitled

Mar 10th, 2023 (edited)
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.23 KB | None | 0 0
  1. from netmiko import ConnectHandler
  2. tplink_switch = {
  3.     'device_type': 'tplink_jetstream',
  4.     'host': '172.16.41.58',
  5.     'username': 'x',
  6.     'password': 'x',
  7.     'secret': 'x'
  8. }
  9. ch =  ConnectHandler(**tplink_switch)
  10. ch.enable()
  11. Traceback (most recent call last):
  12.   File "C:\Python3\Lib\code.py", line 90, in runcode
  13.     exec(code, self.locals)
  14.   File "<input>", line 1, in <module>
  15.   File "D:\python\switch\Lib\site-packages\netmiko\ssh_dispatcher.py", line 365, in ConnectHandler
  16.     return ConnectionClass(*args, **kwargs)
  17.            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  18.   File "D:\python\switch\Lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 149, in __init__
  19.     return super().__init__(**kwargs)
  20.            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  21.   File "D:\python\switch\Lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 21, in __init__
  22.     return super().__init__(**kwargs)
  23.            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  24.   File "D:\python\switch\Lib\site-packages\netmiko\base_connection.py", line 439, in __init__
  25.     self._open()
  26.   File "D:\python\switch\Lib\site-packages\netmiko\base_connection.py", line 445, in _open
  27.     self._try_session_preparation()
  28.   File "D:\python\switch\Lib\site-packages\netmiko\base_connection.py", line 904, in _try_session_preparation
  29.     self.session_preparation()
  30.   File "D:\python\switch\Lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 30, in session_preparation
  31.     self._test_channel_read(pattern=r"[>#]")
  32.   File "D:\python\switch\Lib\site-packages\netmiko\base_connection.py", line 1144, in _test_channel_read
  33.     return self.read_until_pattern(pattern=pattern, read_timeout=20)
  34.            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  35.   File "D:\python\switch\Lib\site-packages\netmiko\base_connection.py", line 672, in read_until_pattern
  36.     raise ReadTimeout(msg)
  37. netmiko.exceptions.ReadTimeout:
  38. Pattern not detected: '[>#]' in output.
  39. Things you might try to fix this:
  40. 1. Adjust the regex pattern to better identify the terminating string. Note, in
  41. many situations the pattern is automatically based on the network device's prompt.
  42. 2. Increase the read_timeout to a larger value.
  43. You can also look at the Netmiko session_log or debug log for more information.
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement