Skip to content

Using 'serial' mode does not let make config changes without opening a connection #3

@shivintwrk

Description

@shivintwrk

from jnpr.junos import Device
from jnpr.junos.utils.config import Config
import logging

......
logging.basicConfig(level=logging.INFO)
dev = Device(user='root', passwd='*****', mode='serial', port='COM4', gather_facts=True)
print(dev.facts)
cu = Config(dev)
cu.load('set system host-name test', format='set', ignore_warning=True)
cu.commit()
.....

Connecting to SRX300 with serially and trying to push a config change throws the following errors:

INFO:jnpr.junos.tty:TTY: connecting to TTY:COM4 ...
INFO:jnpr.junos.tty:TTY: logging in......
INFO:jnpr.junos.tty:TTY: OK.....starting NETCONF
ERROR:jnpr.junos.console:Exception occurred: login:fileno

Traceback (most recent call last):
File "c:/Users/################", line 208, in
main()
File "c:/Users/################", line 178, in main
with Device(user='root', passwd='*******', mode='serial', port='COM4', gather_facts=True, console_has_banner=True) as dev:
File "C:\Python37\lib\site-packages\jnpr\junos\console.py", line 336, in enter
self._conn = self.open()
File "C:\Python37\lib\site-packages\jnpr\junos\console.py", line 222, in open
raise ex
File "C:\Python37\lib\site-packages\jnpr\junos\console.py", line 212, in open
self._tty_login()
File "C:\Python37\lib\site-packages\jnpr\junos\console.py", line 319, in _tty_login
self._tty.login()
File "C:\Python37\lib\site-packages\jnpr\junos\transport\tty.py", line 116, in login
self.nc.open(at_shell=self.at_shell)
File "C:\Python37\lib\site-packages\jnpr\junos\transport\tty_netconf.py", line 68, in open
self.hello = self._receive()
File "C:\Python37\lib\site-packages\jnpr\junos\transport\tty_netconf.py", line 142, in _receive
raise err
File "C:\Python37\lib\site-packages\jnpr\junos\transport\tty_netconf.py", line 140, in _receive
rd, wt, err = select.select([self._tty._rx], [], [], 0.1)
io.UnsupportedOperation: fileno

Using open() with the above mentioned code gives the same errors. Running a similar code with SSH connection works fine. Running it in WSL gives the same errors.
P.S.: Running it on Windows 10 with Python3.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions