简体   繁体   中英

PyEZ: jnpr.junos.exception.ConnectRefusedError: ConnectRefusedError(xx.xxx.xxx.xxx)

PyEZ Device connection returns ConnectRefusedError.

>>> dev = Device(host='xx.xxx.xx.xx', user='xxxx',password='xxxx')
>>> dev.open()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\jnpr\junos\device.py", line 459, in open
    raise EzErrors.ConnectRefusedError(self)
jnpr.junos.exception.ConnectRefusedError: ConnectRefusedError(xx.xxx.xx.xx)

It looks like netconf is not enabled on the given device. (hence PyEZ is not able to connect to netconf default 830 port).

We have 2 option

Enable netconf on device using below config command

"set system services netconf ssh"

Or pass port=22 in device class, so that PyEZ uses sh port to communicate in place of netconf 830 port.

dev = Device(host='xx.xx.xx.xxx', user='xxx', password='xxxx', port=22)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM