Hi Kirk,
I am new to netmiko, I just write a simple script that try to ssh to a switch.
import json
from netmiko import ConnectHandler
commandList = ['vlan 222\n']
net_connection = ConnectHandler(ip='192.168.122.70', device_type='cisco_ios', username='cisco', password='cisco')
output = net_connection.send_config_set(commandList,delay_factor=4 )
connection.disconnect()
I got the error below
Traceback (most recent call last):
File "switch1.py", line 10, in
output = net_connection.send_config_set(commandList,delay_factor=4 )
File "/usr/local/lib/python3.5/dist-packages/netmiko/base_connection.py", line 1429, in send_config_set
output = self.config_mode(*cfg_mode_args)
File "/usr/local/lib/python3.5/dist-packages/netmiko/cisco_base_connection.py", line 42, in config_mode
pattern=pattern)
File "/usr/local/lib/python3.5/dist-packages/netmiko/base_connection.py", line 1347, in config_mode
raise ValueError("Failed to enter configuration mode.")
ValueError: Failed to enter configuration mode.
Did you try without /n in the command? Did you try without the delay factor?
Example here: https://pynet.twb-tech.com/blog/automation/netmiko.html
Yes, I removed /n and delay factor, but no luck.
I followed the example, but there is no difference.
Found out the problem.
I forgot to give the user privilege 15 on the device.
After configure the privilege properly, everything is working.
yixuiGit thank yoouuu man
Most helpful comment
Found out the problem.
I forgot to give the user privilege 15 on the device.
After configure the privilege properly, everything is working.