0

I am facing issue in connecting a netconf session using my python netconf package.

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"

It comes to paramiko transport module and throws

start _client raise SSHException('Negotiation failed.') paramiko.ssh_exception.SSHException: Negotiation failed.

I searched a lot on google but could not figure out where the negotiation is failing any help is very much appreciated. I added debug to paramiko.transport.py and ran but could not get an idea why negotiation was failing.

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.
  • It seems like the server is disconnecting the session, would it be possible for you to get a network trace( using a tool like wireshark or tshark) and check at what state of negotiation this is happening. Also check if the server is up when you create a client session using `netstat` or a similar command – cmidi Nov 23 '16 at 17:14
  • Thanks for the reply this was surprisingly caused due to wrong type casting of parameters in the code – Narendra K Dec 04 '16 at 05:49
  • @NarendraK can u elaborate please on what is "wrong type casting of parameters in the code" . I am hitting a similar issue it would help me solve my issue – manoj prashant k Sep 24 '18 at 05:03

0 Answers0