我在使用我的 python netconf 包连接 netconf 会话时遇到问题。
self.sctrl = server.SSHUserPassController(username=self.username,
password=self.password)
print "created ctrl"
self.nc_server = server.NetconfSSHServer(server_ctl=self.sctrl,
server_methods=NetconfMethods(),
port=int(self.port),
debug=self.debug)
print "created nc_server"
self.ssh = client.NetconfSSHSession(self.host,
username="abc",
password="abc",
port=int(self.nc_server.port),
debug=NC_DEBUG)
print "created netconf session"
它涉及 paramiko 传输模块并抛出
start _client raise SSHException('Negotiation failed.') paramiko.ssh_exception.SSHException: 协商失败。
我在谷歌上搜索了很多,但无法弄清楚谈判失败的地方,非常感谢任何帮助。我将调试添加到 paramiko.transport.py 并运行,但不知道为什么协商失败。
created sctrl
created nc server
DEBUG:paramiko.transport:starting thread (client mode): 0x339be30L
DEBUG:paramiko.transport:Local version/idstring: SSH-2.0-paramiko_2.0.0
DEBUG:paramiko.transport:Remote version/idstring: SSH-2.0-libssh-0.7.1
INFO:paramiko.transport:Connected (version 2.0, client libssh-0.7.1)
DEBUG:paramiko.transport:M inside kex init ¶æ|5ùü♠8δM▓▄α╙↓ëk ~diffie-hellman-g
roup1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie
-hellman-group-exchange-sha256 Kssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2
-nistp384,ecdsa-sha2-nistp521 maes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,blo
wfish-cbc,aes192-cbc,aes256-cbc,3des-cbc,arcfour128,arcfour256 maes128-ctr,aes
192-ctr,aes256-ctr,aes128-cbc,blowfish-cbc,aes192-cbc,aes256-cbc,3des-cbc,arcfou
r128,arcfour256 Ghmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-sha1-96,hmac-md5-96
,hmac-sha1 Ghmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac
-sha1 ♦none ♦none
DEBUG:paramiko.transport:ptype 1
DEBUG:paramiko.transport:m ♂ Bye Bye
DEBUG:paramiko.transport:MSG_DISCONNECT
INFO:paramiko.transport:Disconnect (code 11): Bye Bye
Traceback (most recent call last):
File "__init__.py", line 130, in <module>
netconf.test_query()
File "__init__.py", line 58, in test_query
debug=True)
File "C:\Python27\lib\site-packages\netconf\client.py", line 167, in __init__
stream = sshutil.conn.SSHClientSession(host, port, "netconf", username, pass
word, debug)
File "C:\Python27\lib\site-packages\sshutil\conn.py", line 398, in __init__
super(SSHClientSession, self).__init__(host, port, username, password, debug
)
File "C:\Python27\lib\site-packages\sshutil\conn.py", line 76, in __init__
self.ssh = self.get_ssh_socket(host, port, username, password, debug)
File "C:\Python27\lib\site-packages\sshutil\conn.py", line 214, in get_ssh_soc
ket
sshsock.start_client(event)
File "C:\Python27\lib\site-packages\paramiko\transport.py", line 494, in start
_client
raise SSHException('Negotiation failed.')
paramiko.ssh_exception.SSHException: Negotiation failed.