Nokia private config mode and prompt pattern - error when using private mode
See original GitHub issueCurrently 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:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
In Netmiko, you could probably use a pattern similar to this:
I somewhat suspect that would work, but you would need to test it.
Yes doing
send_command
for thecommit
statement did it. So configure private does work, just needs to be done “manually” through multiplesend_command
methods. Thanks for the help.