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.

Nokia private config mode and prompt pattern - error when using private mode

See original GitHub issue

Currently the config_mode() method for Nokia uses “edit-config exclusive” then searches for the pattern “(ex) [” as that is the prompt when entering that mode (this is when using MD-CLI).

I’m trying to use edit-config private so I’m not stepping on any other edits. When using the “edit-config private” mode in MD-CLI, the prompt is “(pr) [”. However, even when updating the pattern to use pr, it fails to enter config mode.

Example prompt:

[] A:user@Nokia# edit-config private INFO: CLI #2070: Entering private configuration mode INFO: CLI #2061: Uncommitted changes are discarded on configuration mode exit

(pr)[] A:user@Nokia#

The line that calls it looks like this: connection.config_mode(config_command='edit-config private', pattern='\(pr\)\[')

Am I formatting the pattern properly?

The API doc is a little confusing because it shows the format as '\\(pr\\)\\[', which didn’t work either. Also in the source code it uses a literal string r'\(pr\)\['.

Here is the error:

/usr/local/lib/python3.7/site-packages/netmiko/base_connection.py in config_mode(self=<netmiko.nokia.nokia_sros_ssh.NokiaSrosSSH object>, config_command=‘edit-config private’, pattern=r’(pr)[')

1623                 output += self.read_until_pattern(pattern=pattern) 1624             if not self.check_config_mode(): => 1625                 raise ValueError(“Failed to enter configuration mode.”) 1626         return output 1627 builtin ValueError = <class ‘ValueError’>

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ktbyerscommented, May 21, 2020

In Netmiko, you could probably use a pattern similar to this:

nc.send_command("edit-config private", expect_string=r"(pr)")
nc.send_config_set(config_commands, enter_config_mode=False, exit_config_mode=False)
# then need to manually exit config mode...

I somewhat suspect that would work, but you would need to test it.

0reactions
Menotomycommented, May 21, 2020

Yes doing send_command for the commit statement did it. So configure private does work, just needs to be done “manually” through multiple send_command methods. Thanks for the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4. Configuring in the MD-CLI
The configuration mode (private, exclusive, global, or read-only) determines the interaction with other simultaneous configuration sessions.
Read more >
1. Using the MD-CLI - Nokia Documentation
When the MD-CLI session is in configuration mode, the configure command can be followed by a path to navigate or by a configuration...
Read more >
MD-CLI Command Reference Guide - Nokia Documentation
implicit configuration workflow prompt for a session in private configuration mode, with present working context of configure router bgp ...
Read more >
3. Navigating in the MD-CLI
implicit configuration workflow prompt for a session in private configuration mode, with present working context of configure router bgp with uncommitted ...
Read more >
Nokia 7450 ESS 7750 SR 7950 XRS MD-CLI Command ...
implicit configuration workflow prompt for a session in private configuration mode, with present working context of configure router bgp ...
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