one-liner config fails; two lines, ok
See original GitHub issueHi!
I have experienced that (sometimes) the onliner config failes. If I change that to a more specific two-line config, it passes ok. Let me show:
- This fails:
"/configure router interface test5 address 99.99.98.8/32\n"
This is what I see in the debug:
DEBUG:netmiko:Pattern is: \#\ SCRIPT_NONO_START
DEBUG:netmiko:_read_channel_expect read_data: # SCRIPT_NONO_START
*A:myRouter#
DEBUG:netmiko:Pattern found: \#\ SCRIPT_NONO_START # SCRIPT_NONO_START
*A:myRouter#
DEBUG:netmiko:write_channel: b'/environment no more\n'
DEBUG:netmiko:Pattern is: /environment\ no\ more
DEBUG:netmiko:_read_channel_expect read_data: /envi
DEBUG:netmiko:_read_channel_expect read_data: ronment no more
*A:myRouter#
DEBUG:netmiko:Pattern found: /environment\ no\ more /environment no more
*A:myRouter#
DEBUG:netmiko:write_channel: b'/configure router interface test5 address 99.99.98.8/32\n'
DEBUG:netmiko:Pattern is: /configure\ router\ interface\ test5\ address\ 99\.99\.98\.8/32
DEBUG:netmiko:_read_channel_expect read_data: /configure router interface test5[5D
DEBUG:netmiko:_read_channel_expect read_data: "test5[5D[5C" address 99.99.98.8/32
DEBUG:netmiko:_read_channel_expect read_data: *A:
DEBUG:netmiko:_read_channel_expect read_data: myRouter#
DEBUG:paramiko.transport:Sending global request "keepalive@lag.net"
DEBUG:paramiko.transport:Sending global request "keepalive@lag.net"
DEBUG:paramiko.transport:Sending global request "keepalive@lag.net"
DEBUG:paramiko.transport:Sending global request "keepalive@lag.net"
DEBUG:netmiko:write_channel: b'logout\n'
- This works:
"/configure router interface test5\naddress 99.99.98.8/32\n"
(notice the\n
in the middle to make it a two-line config). This is what I see in the debug:
DEBUG:netmiko:Pattern found: \#\ SCRIPT_NONO_START # SCRIPT_NONO_START
*A:myRouter#
DEBUG:netmiko:write_channel: b'/environment no more\n'
DEBUG:netmiko:Pattern is: /environment\ no\ more
DEBUG:netmiko:_read_channel_expect read_data: /enviro
DEBUG:netmiko:_read_channel_expect read_data: nment no more
DEBUG:netmiko:Pattern found: /environment\ no\ more /environment no more
DEBUG:netmiko:Pattern is: (?:\*A:myRouter|#)
DEBUG:netmiko:_read_channel_expect read_data: *A:
DEBUG:netmiko:_read_channel_expect read_data: myRouter#
DEBUG:netmiko:Pattern found: (?:\*A:myRouter|#) *A:myRouter#
DEBUG:netmiko:write_channel: b'/configure router interface test5\n'
DEBUG:netmiko:Pattern is: /configure\ router\ interface\ test5
DEBUG:netmiko:_read_channel_expect read_data: /co
DEBUG:netmiko:_read_channel_expect read_data: nfigure router interface test5[5D"test5[5D[5C"
*A:myRouter>config>router>if#
DEBUG:netmiko:Pattern found: /configure\ router\ interface\ test5 /configure router interface test5[5D"test5[5D[5C"
*A:myRouter>config>router>if#
DEBUG:netmiko:write_channel: b'address 99.99.98.8/32\n'
DEBUG:netmiko:Pattern is: address\ 99\.99\.98\.8/32
DEBUG:netmiko:_read_channel_expect read_data: address 99.99.98
DEBUG:netmiko:_read_channel_expect read_data: .8/32
*A:myRouter>config>router>if#
DEBUG:netmiko:Pattern found: address\ 99\.99\.98\.8/32 address 99.99.98.8/32
For some reason, if I send the command as two lines, it works.
I’m using:
- netmiko 3.4.0
- send_config_set()
- cmd_verify= True.
- device_type = nokia_sros
Thanks! Lucas
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Styling multi-line conditions in 'if' statements? [closed]
): It shaves a few characters and makes it clear that there's no subtlety to the condition. It's ok if you don't care...
Read more >error getting ip during provisioning: IPs output should only be ...
Will this suggestion work: IPs output should only be one line, got %d lines. Please fix your ~/.docker/config file and restart minikube.
Read more >UDL: /* block comment in one line, error - Community
Hello, I've been working to get UDL set up for DSM4COM.cfg (pavgmbh.de) files. ;line comment, ok name = "test" ;inline comment, ok /*...
Read more >One liner to check for file exists - bash - Unix Stack Exchange
Objective: Check for presence of backup .tgz file containing today's date; output 1 for OK, 0 for no file. I'm a sucker for...
Read more >Configuration · Scalafmt - Scalameta
Configuration for scalafmt is defined in a plain text file `.scalafmt.conf` ... expression spans multiple lines, it will introduce its own indentation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Good, no worries then. Having that in mind at least gives us a chance to modify the scripts, or disabling
cmd_verify
in order to make it work. Thanks!Yeah, I think that is…that you should always use the canonical form of the configuration command or else Nokia SR-OS will re-write it to the canonical form.
So in the case without the quotes, Nokia SR-OS is re-writing the echoed command to be the canonical form (which is not what Netmiko is expecting since Netmiko is expecting an exact echo).