Pattern not found in output: #
See original GitHub issueHi,
I just started on netmiko; thanks to all of you, especially Kirk, for this.
The problem I am facing is as below: Here is the exeption I am having for a test config-change in one of the ports:
Traceback (most recent call last): File “remoteConfigurePort.py”, line 27, in <module> device.send_config_set(config_commands) File “C:\Program Files\Python38\lib\site-packages\netmiko\base_connection.py”, line 1704, in send_config_set output = self.config_mode(*cfg_mode_args) File “C:\Program Files\Python38\lib\site-packages\netmiko\cisco_base_connection.py”, line 40, in config_mode return super().config_mode(config_command=config_command, pattern=pattern) File “C:\Program Files\Python38\lib\site-packages\netmiko\base_connection.py”, line 1595, in config_mode if not self.check_config_mode(): File “C:\Program Files\Python38\lib\site-packages\netmiko\cisco\cisco_ios.py”, line 29, in check_config_mode return super().check_config_mode(check_string=check_string, pattern=pattern) File “C:\Program Files\Python38\lib\site-packages\netmiko\cisco_base_connection.py”, line 30, in check_config_mode return super().check_config_mode(check_string=check_string, pattern=pattern) File “C:\Program Files\Python38\lib\site-packages\netmiko\base_connection.py”, line 1582, in check_config_mode output = self.read_until_pattern(pattern=pattern) File “C:\Program Files\Python38\lib\site-packages\netmiko\base_connection.py”, line 618, in read_until_pattern return self._read_channel_expect(*args, **kwargs) File “C:\Program Files\Python38\lib\site-packages\netmiko\base_connection.py”, line 563, in _read_channel_expect raise NetmikoTimeoutException( netmiko.ssh_exception.NetmikoTimeoutException: Timed-out reading channel, pattern not found in output: #
The source code is given below:
config_commands = ['interface gigabitEthernet 1/0/35','switchport access vlan 20']
start = time.time()
for i in ipdb:
for cmd in commands:
device = ConnectHandler(device_type='cisco_ios_telnet', ip=i, username='***', password='***')
device.send_config_set(config_commands)
print ("Done!")
device.disconnect()
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
Top GitHub Comments
Hi @m6461 ,
In a telnet session a switch or router, first enter user mode (‘>’) where you enter the command enable to switch to privileged mode (‘#’). To use the send_config_set () method you must be previously in the privilege, this is how the code is thought.
https://www.cisco.com/E-Learning/bulk/public/tac/cim/cib/using_cisco_ios_software/02_cisco_ios_hierarchy.htm
nullbit0
Hi, try this command line
device = ConnectHandler(device_type=‘cisco_ios_telnet’, ip=i, username=‘‘, password=’’) find_prompt=device.send_command(‘\n’) if not ‘#’ in find_prompt: #–>optional device.enable()#—>optional according to your device telnet device.send_config_set(config_commands,expect_string=‘#’) print (“Done!”) device.disconnect()
good luck! nullbit0