I'm currently working my way through a book called Mastering Python networking by Eric Chou (I'm a network engineer).
One of the examples provides sample code to use netconf to connect to a Cisco Nexus device but upon trying to connect I am getting the below errors in relation to:
AttributeError: '_RSAPublicKey' object has no attribute 'verify'
Could anyone advise on what may be the issue.
I have the latest version of Python3 installed on Ubuntu 16.04 LTS and as per instructions in the book downloaded and installed the latest version of ncclient.
Incidentally I am connecting to the Cisco Devnet Nexus NX-API sandbox simulator, also a manual ssh terminal connection using the credentials show in the code below works fine.
Upon running the following code:
from ncclient import manager
conn=manager.connect(
host='sbx-nxos-mgmt.cisco.com',
port=8181,
username='admin',
password='Admin_1234!',
hostkey_verify=False,
device_params={'name': 'nexus'},
look_for_keys=False
)
I get the below errors:
Unknown exception: '_RSAPublicKey' object has no attribute 'verify' Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1925, in run self.kex_engine.parse_next(ptype, m) File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 47, in parse_next return self._parse_kexecdh_reply(m) File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 107, in _parse_kexecdh_reply self.transport._verify_key(K_S, sig) File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1750, in _verify_key if not key.verify_ssh_sig(self.H, Message(sig)): File "/usr/local/lib/python3.5/dist-packages/paramiko/rsakey.py", line 127, in verify_ssh_sig key.verify( AttributeError: '_RSAPublicKey' object has no attribute 'verify'
Traceback (most recent call last): File "", line 8, in File "/usr/local/lib/python3.5/dist-packages/ncclient-0.5.3-py3.5.egg/ncclient/manager.py", line 155, in connect File "/usr/local/lib/python3.5/dist-packages/ncclient-0.5.3-py3.5.egg/ncclient/manager.py", line 120, in connect_ssh File "/usr/local/lib/python3.5/dist-packages/ncclient-0.5.3-py3.5.egg/ncclient/transport/ssh.py", line 409, in connect File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 545, in start_client raise e File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1925, in run self.kex_engine.parse_next(ptype, m) File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 47, in parse_next return self._parse_kexecdh_reply(m) File "/usr/local/lib/python3.5/dist-packages/paramiko/kex_ecdh_nist.py", line 107, in _parse_kexecdh_reply self.transport._verify_key(K_S, sig) File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 1750, in _verify_key if not key.verify_ssh_sig(self.H, Message(sig)): File "/usr/local/lib/python3.5/dist-packages/paramiko/rsakey.py", line 127, in verify_ssh_sig key.verify( AttributeError: '_RSAPublicKey' object has no attribute 'verify'