Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shivintwrk opened this issue Mar 6, 2020 · 0 comments

Comments

@shivintwrk
Copy link

shivintwrk commented Mar 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant