Closed dmulyalin closed 3 years ago
Hey @dmulyalin
Thanks for opening this! Nope, don't think you are doing anything wrong!
Can't say I'd tested this with EOS before -- it looks like the addition of -tt
to force a pty when spawning a netconf session is to blame. This flag was added to support sending huge commands basically but has been a pain... 🥲 without this or mucking w/ stty icanon settings we would hit max line lengths of 1024 and fall over (see #46).
Good news -- should be an easy fix. Bad news -- its not the most elegant thing in the world. The fix should be adding the following argument to your driver creation: "transport_options": {"netconf_force_pty": False}
. The netconf_force_pty
-> false disables the -tt
flag that was added more recently. Until this issue I had only seen this be an issue w/ some junos boxes that decide they dont want to allocate a pty on port 830 for some reason.
If you do use this flag and you want to send a giant payload, I suspect you'll hit the line/char limit thing -- in which case you can set use_compressed_parser
-> False. Theres another whole backstory to that in an issue somewhere but TLDR some devices (juniper) started sending rpc replies at the end of the rpc-request message but before the newline and closing ##
anchor -- so since there is no point of sending "pretty" xml and to work around this the parser removes newlines which causes us to send a giant single line of xml.
Alternatively you could use ssh2/paramiko/asyncssh transports which should not have the same challenges.
I've really wanted to not have any device specific "profiles"/"drivers" in scrapli netconf but it seems more and more like it may be a good idea to just have sane defaults for devices since there seems to be enough little annoying tweaks that need to be made (esp in context of system transport due to all the extra stuff in place to make that work).
In summary.... netconf is a pita sometimes 😁 and let us know if netconf_force_pty
helps out and/or you give the other transports a shot!
Carl
PS - doubt that it should matter, but was recreating/testing this w/ 4.26.2F ceos.
Hi @carlmontanari, thank you for prompt response.
Tried both "transport_options": {"netconf_force_pty": False}
and transport: paramiko
- no luck. Calling get_config multiple times sometimes return configuration, sometimes echoes back rpc content. Have two cEOS instances running, this behaviour is the same for both of them.
Thanks for the update!
I'll try to get a deeper dive into this this coming weekend and will keep ya posted!
Carl
Sorry for the slow response -- got a little side-tracked!
Started to take a look at this this morning and realized that I had thought I mentioned (but clearly did not -- my fault!!) that the netconf_force_pty
flag will require installing the pre-release version of scrpali-netconf. This dict is basically ignored by the transports unless there is an option configured, so it just kinda silently passed before.
This pre-release version should be handily pip installable pip install scrapli-netconf==2022.01.30a1
.
With that and the netconf_force_pty
flag I'm unable to reproduce. If I revert back to 2021.07.30 I can very much reproduce the error and even break it in other ways it looks like 😁. So I think/hope that will sort us out!
Again, sorry for the slow response, and thanks again for opening this and for the great detail!
Carl
Gunna close this for now, but please defo re-open if my last comments were not accurate/there is something broken here! Appreciate you opening this and the support!!
Carl
@carlmontanari updating to scrapli-netconf==2022.01.30a1
coupled with netconf_force_pty=False
solves this problem, thank you for looking at it.
Awesome! Thanks so much for confirming!
Hi, using Scrapli-Netconf with containerized Arista EOS image running docker on CentOS7:
Everything works fine using scrapli-netconf 2021.1.30:
But same code stops working with scrapli-netconf 2021.7.30 - no configuration returned from device:
Am I missing some extra settings for NetconfDriver or doing something wrong?