question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

one-liner config fails; two lines, ok

See original GitHub issue

Hi!

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:

  1. 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
DEBUG:netmiko:_read_channel_expect read_data: "test5" 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'
  1. 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"test5" 
*A:myRouter>config>router>if# 
DEBUG:netmiko:Pattern found: /configure\ router\ interface\ test5 /configure router interface test5"test5" 
*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:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
laimarettocommented, Sep 15, 2021

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!

0reactions
ktbyerscommented, Sep 16, 2021

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).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found