netmiko | HP Aruba switch | Failed to enter configuration mode.
See original GitHub issueHello I am using netmiko to work in different vendors network. For Cisco netmiko script is working with no errors. However, for HP Aruba config_set is failing with the above error.
netmiko version
14:05 $ pip show netmiko
Name: netmiko
Version: 3.2.0
Summary: Multi-vendor library to simplify Paramiko SSH connections to network devices
Home-page: https://github.com/ktbyers/netmiko
Author: Kirk Byers
Author-email: ktbyers@twb-tech.com
License: MIT
Location: /home/alabarym/git/alabarym/nc_network/nc_venv/lib/python3.7/site-packages
Requires: pyserial, paramiko, scp, setuptools, textfsm
Required-by:
Here are sample of my code: function to change configuration:
def netmiko_send_config_set(device, commands):
output = ''
result = {}
try:
with ConnectHandler(**device) as ssh:
ssh.enable()
for command in commands:
print("command: ", command)
print(type(command))
output += ssh.send_config_set(command, delay_factor=2, cmd_verify=False)
print(output)
return output]
except (NetmikoTimeoutException,
NetmikoAuthenticationException) as error:
with open("errors_001.yaml", "a") as error_dst:
result[device['host']] = error
yaml.dump(result, error_dst,
default_flow_style=False, sort_keys=False)
function call:
netmiko_send_config_set(device, ['logging host 1.2.3.4 transport udp port 5054'])
python error message
command: logging 1.2.3.4 udp 5052
Failed to enter configuration mode.
Traceback (most recent call last):
File "netmiko_for_nc_001.py", line 540, in <module>
result += netmiko_send_config_set(device, ['logging 1.2.3.4 udp 5052'])
TypeError: can only concatenate str (not "NoneType") to str
error message is file:
1.2.3.4: !!python/object/apply:builtins.ValueError
- Failed to enter configuration mode.
netmiko debug logs below:
switch1-fl10-cabc9#
DEBUG:netmiko:read_channel:
switch1-fl10-cabc9#
switch1-fl10-cabc9#
DEBUG:netmiko:Clear buffer detects data in the channel
DEBUG:netmiko:read_channel:
DEBUG:netmiko:[find_prompt()]: prompt is switch1-fl10-cabc9#
DEBUG:netmiko:write_channel: b'\r'
DEBUG:netmiko:Pattern is: switch1\-fl10\-cabc9
DEBUG:netmiko:_read_channel_expect read_data:
switch1-fl10-cabc9#
DEBUG:netmiko:Pattern found: switch1\-fl10\-cabc9
switch1-fl10-cabc9#
DEBUG:netmiko:read_channel:
DEBUG:netmiko:In disable_paging
DEBUG:netmiko:Command: no paging
DEBUG:netmiko:write_channel: b'no paging\r'
DEBUG:netmiko:Pattern is: switch1\-fl10\-cabc9
DEBUG:netmiko:_read_channel_expect read_data: no paging
Invalid input: paging
switch1-fl10-cabc9#
DEBUG:netmiko:Pattern found: switch1\-fl10\-cabc9 no paging
Invalid input: paging
switch1-fl10-cabc9#
DEBUG:netmiko:no paging
Invalid input: paging
switch1-fl10-cabc9#
DEBUG:netmiko:Exiting disable_paging
DEBUG:netmiko:read_channel:
DEBUG:netmiko:write_channel: b'\r'
DEBUG:netmiko:Pattern is: switch1\-fl10\-cabc9
DEBUG:netmiko:_read_channel_expect read_data:
switch1-fl10-cabc9#
DEBUG:netmiko:Pattern found: switch1\-fl10\-cabc9
switch1-fl10-cabc9#
DEBUG:netmiko:write_channel: b'\r'
DEBUG:netmiko:Pattern is: switch1\-fl1
DEBUG:netmiko:_read_channel_expect read_data:
switch1-fl10-cabc9#
DEBUG:netmiko:Pattern found: switch1\-fl1
switch1-fl10-cabc9#
DEBUG:netmiko:write_channel: b'configure term\r'
DEBUG:netmiko:Pattern is: switch1\-fl1
DEBUG:netmiko:_read_channel_expect read_data: configure term
switch1-fl10-cabc9(config)#
DEBUG:netmiko:Pattern found: switch1\-fl1 configure term
switch1-fl10-cabc9(config)#
DEBUG:netmiko:write_channel: b'\r'
DEBUG:netmiko:Pattern is: switch1\-fl1
DEBUG:netmiko:_read_channel_expect read_data:
switch1-fl10-cabc9(config)#
DEBUG:netmiko:Pattern found: switch1\-fl1
switch1-fl10-cabc9(config)#
DEBUG:netmiko:write_channel: b'\r'
DEBUG:netmiko:Pattern is: switch1\-fl1
DEBUG:netmiko:_read_channel_expect read_data:
switch1-fl10-cabc9(config)#
DEBUG:netmiko:Pattern found: switch1\-fl1
switch1-fl10-cabc9(config)#
DEBUG:netmiko:write_channel: b'exit\r'
Why question: what am I doing wrong (just to mention same code works for cisco devices with no issues)?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Failed to enter configuration mode in Netmiko while trying to ...
I;m trying to use netmiko to login to aruba switches. while i pass on some commands using send_config_set, it is erroring out saying...
Read more >netmiko | HP Aruba switch | Failed to enter configuration mode.
I am using netmiko to work in different vendors network. For Cisco netmiko script is working with no errors. However, for HP Aruba...
Read more >netmiko.base_connection API documentation - GitHub Pages
Base connection class for netmiko. Handles SSH connection and methods that are generically applicable to different platforms (Cisco and non-Cisco).
Read more >Python and Network Automation HOW TO - Part 1 Basic Show ...
We are going to design this simple script to get a command output from a switch in our example and in my next...
Read more >Netmiko Library - Python for Network Engineers
Once again, Netmiko will do a set of things automatically—in particular, it will both enter and exit configuration mode (if necessary). You can ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a lot @ktbyers now it works like charm with hp_procurve Please close the ticket
I have been using the netmiko module for these HP switch modes: Aruba 2530 48 PoE+ 2SFP 2Gbe J9778A: Aruba 2530-8G J9777A: Aruba 2540 48G 4SFP+ JL355A:
I have used device_type: aruba_os for all of them
so, I will try switching device_type: hp_procurve