Reputation: 33
I just start using netmiko and have a problem with one script. The script should delete a user and create another one. The problem that I have is with confirmation in configuration mode I don`t know how to handle it.
R1(config)#no username admin
This operation will remove all username related configurations with same name.Do you want to continue? [confirm]
Thank you.
Upvotes: 1
Views: 2225
Reputation: 1
Use ssh.send_command_timing()'
like this:
ssh.send_command_timing(f'no username {user}')
Upvotes: 0
Reputation: 1435
you would a use an expect string.
output = net_connect.send_command(
command_string=command,
expect_string=r"Delete filename",
strip_prompt=False,
strip_command=False
)
output += net_connect.send_command(
command_string="\n",
expect_string=r"confirm",
strip_prompt=False,
strip_command=False
Upvotes: 2