Closed spdkils closed 2 years ago
Arguments: (b' Archive feature not enabledGRJ-SF03-34-105-CO# ', re.compile(b'(^[\w.\-]{1,63}>\s?$)|(^[\w.\-]{1,63}#\s?$)|(^[\w.\-]{1,63}\(config[\w.\-@/:\+]{0,32}\)#\s?$)|((^[\w.\-]{1,63}\-tcl#\s?$)|(^[\w.\-]{1,63}\(config\-tcl\)#\s?$)|(^>\s?$))', re.IGNORECASE|re.MULTILINE))
I added a logging.warning to show the raw output during the input parsing. As you can see, there isn't a line feed in the data, and so parsing fails.
Bonus bug. Because the output is stripped. Lines with trailing white space are transformed from their original output. Pretty much every version of Cisco has white space as a terminator on the logging discriminators... (I don't know why, it's just how Cisco does it.)
As a result the hash of what scrapli says is the startup config, vs what is copied on disk will always be different. (I use the raw_output to get around this one.)
I hate nexus
✅ for me as well 😁
I expect Cisco to send line feeds, but they don't. So sadly, we have another corner case with Nexus.
fun times! have you only noticed this with "show archive"? or is this more pervasive than just that one command? if its just this one command im inclined to do nothing here. I think anything we would do would be a net negative for other things. I wonder if sending "show archive\n" would help kick things along? I can try to fire up my n9kv later this week to poke around as well...
As a result the hash of what scrapli says is the startup config, vs what is copied on disk will always be different. (I use the raw_output to get around this one.)
^ do you feel like this is a reasonable compromise/work around? I dont think I ever noticed this and/or I always was trimming so it was never a problem. have you messed with scrapli-cfg to see if it is handling this diff output properly? ive tested w/ all the "core" platforms and cfg should behave.
thanks for opening this @spdkils !
Carl
The missing line feed.
I suspect terminal programs treat chunks of bytes as lines. Since the terminal inserts a line feed, yet paramiko/asyncssh does not show the bytes.
Putty, and every other terminal advances a line, but the raw bytes don't show a line feed. (Putty, Secure CRT, Reflections, openSSH)
All that said, I'm having a hard time tracking down another command. I stumbled across this one. show archive log config works fine, yet show archive does not.
If I disable lldp, or fex, etc... The whole group of commands are removed, so you get invalid commands, not feature not enabled.
I checked on some older nexus, and it behaves as expected. I'll just report this to Cisco high touch... Let me see what they say.
So I'm going to consider this not a python problem unless I see raw bytes in some other application that show a byte I don't see here.
raw_output
As far as the raw_output, I think it's acceptable. I wasn't expecting the result to be processed, things like banners, may contain white space, and if you're doing mass compliance (as I do) the security auditors expect exact results, nothing less.
Also, since I don't use twitter, and I don't see a way to PM you.
Testing
I run this on about 30k active network devices... Works great, only a few corner cases that are issues. (99% Cisco shop) but I have hundreds of versions of code, old/new, and a crazy amount of models represented.
I generally try and test everything across the whole matrix of models/versions. (Wrote code to make that quick.)
Thanks
So, thanks for this package! My previous package was abandon, so I switched to this, and I'm generally happier with the calling semantics, and responses. (I did monkey patch the response object, because I didn't want to go under the hood, and deal with dependency injection.)
I wanted to have custom parsing available to me, and replacing the text fsm parsers with my teams was not easy enough. So I simply patched in lan_parse() method that uses the environment variable to find the parsers net_textfsm (similar to netmiko)
Awesome, glad to hear things are working well!!
Re the ntc templates -- def down to add a env var that we look for to find the path to templates if you're up for a pr!
Carl
Describe the bug NXOS: Send command "show archive" NXOS: Response " Archive feature is not enabledGRJ-BLH-BLAH-BLAH#"
Because NXOS does not send a line feed character between the feature is not enabled and the prompt, scrapli can't pick it up by default.
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect Cisco to send line feeds, but they don't. So sadly, we have another corner case with Nexus.
Stack Trace Timeout, sorry, it's pretty clear, but I'm writing this from my home PC and the bug is on my work system.
OS (please complete the following information):
Additional context You can bypass the issue, by hacking the prompt regex to include feature not installed as an optional component. Hacky, but works.