cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5638
Views
5
Helpful
7
Replies

Send config over with netmiko to switch

Hello, I can not send a global configuration command to a switch, I get the typical "% Invalid input detected at '^' marker." With netmiko i can not tell exactly where the misinput is. I want to add a user to a bunch of devices. so the command I use is the username xxx privilege x secret x xxxxxxx

1 Accepted Solution

Accepted Solutions

yes but it turns out, you need to do:

connect.enable()

before writing any config, like you would in a terminal

View solution in original post

7 Replies 7

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Are you using the correct function (send_config_set):

...
commands = ['username {0} privilege {1} secret {2}'] ... result = ssh.send_config_set(commands)
...

...that said, you also have a typo in the word 'privilege'

 

cheers,

Seb.

 

yes but it turns out, you need to do:

connect.enable()

before writing any config, like you would in a terminal

Hi,

You need to ping the owner of netmiko on github. But make sure that you are
using the right device type in your code.

On a side note, if you are using IOS-XE device, you can use REST to
communicate with the device and post configs.

**** please remember to rate useful posts

balaji.bandi
Hall of Fame
Hall of Fame

you need to send confrmation - show us your example or follow the below document how you can send confirmation.

 

https://pynet.twb-tech.com/blog/automation/netmiko-what-is-done.html

 

example :

 

https://github.com/ktbyers/netmiko/blob/develop/examples/send_command_prompting_expect.py

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

config_command = ['no username ****']

connect.send_config_set(config_command)

 

thats it, i get that i should use expect_string, but its not possible with send_config_set().

this should be enable and config mode.

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

OSError: Search pattern never detected in send_command: remove

I get an error from the send_command(), it doesnt pick up on the 'remove', despite

"This operation will remove all username related configurations with same name.Do you want to continue?"

remove being in the prompt.