Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

dev.open() doesn't work

‎01-31-2017 05:34 PM

Hi,

 

I am new to PyEZ and Linux.

 

Just tried my first script using PyEZ and could not connect to the device using the dev.open().

 

Device IP is reachable from the Linux machine and the netconf is also configured in the device.

 

Please advice how to make it working.

 

>>>>>>>

>>> from jnpr.junos import Device
>>> dev = Device(host="10.10.10.10", user="test", password="test123")
>>> dev.open()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/jnpr/junos/device.py", line 899, in open
    raise EzErrors.ConnectTimeoutError(self)
jnpr.junos.exception.ConnectTimeoutError: ConnectTimeoutError(10.10.10.10)
>>>

 

5 REPLIES 5
Highlighted
Junos Automation (Scripting)
Solution
Accepted by topic author sedhuanand@gmail.com
‎01-31-2017 07:12 PM

Re: dev.open() doesn't work

‎01-31-2017 06:57 PM

Hi,

 

Can you hit tcp port 830 from the host that you are running the py script?

 

If SSH works from your client you can add port=22 to the open() command to use that port instead of 830.

 

Tim

Highlighted
Junos Automation (Scripting)

Re: dev.open() doesn't work

‎01-31-2017 07:14 PM

Thanks Tim.

 

it works after i pass port = 22. So, the dev.open() by default uses tcp port 830 and not 22.

 

Highlighted
Junos Automation (Scripting)

Re: dev.open() doesn't work

‎01-31-2017 07:51 PM

Yes that is correct.

 

Check out the API here, it details the default settings 

 

Tim

Highlighted
Junos Automation (Scripting)

Re: dev.open() doesn't work

[ Edited ]
‎02-08-2017 02:12 PM

How do you pass port 22 in the dev.open() command?

Highlighted
Junos Automation (Scripting)

Re: dev.open() doesn't work

[ Edited ]
‎02-08-2017 02:29 PM

Device(host, user, password, port=22).open()

Feedback