Closed SusethiraRam closed 4 years ago
Are you using a redispatch
?
On quick glance, it looks like you are using the terminal_server device_type? Once you get connected to your end-device, you need to be using the proper device_type for that device (i.e. cisco_nxos
in this case).
Yes you are correct. I missed redispatch part in my code.
redispatch(net_connect, device_type='cisco_nxos')
Thanks for correcting it. Now send_config_set command is working fine.
I'm facing issue with send_config_set command in nxos device with variant NEXUS7K alone. send-config_set command is executing commands in privilege mode and it is not entering configuration mode.
Here device is accessed via terminal server.
Device output: switch# switch# hostname SCLLAB-NSO1-CORE01 ^ % Invalid command at '^' marker. switch# username admin password ***** role network-admin ^ % Invalid command at '^' marker. switch# vrf context management ^ % Invalid command at '^' marker. switch# ip route 0.0.0.0/0 10.198.15.1 ^ % Invalid command at '^' marker. switch# interface mgmt0 ^ % Invalid command at '^' marker. switch# vrf member management ^ % Invalid command at '^' marker. switch# ip address 10.198.15.19/24 ^ % Invalid command at '^' marker. switch#
Below are the error snippet.
Traceback (most recent call last): File "provision_device.py", line 413, in
overall_result = main(inventory_file)
File "provision_device.py", line 378, in main
configure_nxos_device(console_server_ip, dev_oob_ip, console_port, dev_name, platform)
File "provision_device.py", line 93, in configure_nxos_device
response = net_connect.send_config_set(config_command, delay_factor=5, cmd_verify=False)
File "/usr/lib/python3.6/site-packages/netmiko/base_connection.py", line 1770, in send_config_set
output += self.exit_config_mode()
File "/usr/lib/python3.6/site-packages/netmiko/base_connection.py", line 1652, in exit_config_mode
raise ValueError("Failed to exit configuration mode")
ValueError: Failed to exit configuration mode
Python code where the issue is experiences is below,
The below is the netmiko logging details.
DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:send_command_timing final output: Cisco Nexus Operating System (NX-OS) Software TAC support: http://www.cisco.com/tac Copyright (c) 2002-2016, Cisco Systems, Inc. All rights reserved. The copyrights to certain works contained in this software are owned by other third parties and used and distributed under license. Certain components of this software are licensed under the GNU General Public License (GPL) version 2.0 or the GNU Lesser General Public License (LGPL) Version 2.1. A copy of each such license is available at http://www.opensource.org/licenses/gpl-2.0.php and http://www.opensource.org/licenses/lgpl-2.1.php
DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\r' DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\r' DEBUG:netmiko:read_channel: switch# INFO:root:Connected after reboot
INFO:root:Configuring device with default configurations
DEBUG:netmiko:write_channel: b'\r' DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:read_channel: switch# switch# switch# DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'hostname SCLLAB-NSO1-CORE01\n' DEBUG:netmiko:write_channel: b'username admin password Wt1g1tHb role network-admin\n' DEBUG:netmiko:write_channel: b'vrf context management\n' DEBUG:netmiko:write_channel: b'ip route 0.0.0.0/0 10.198.15.1\n' DEBUG:netmiko:write_channel: b'interface mgmt0\n' DEBUG:netmiko:write_channel: b'vrf member management\n' DEBUG:netmiko:write_channel: b'ip address 10.198.15.19/24\n' DEBUG:netmiko:read_channel: hostname SCLLAB-NSO1-CORE01 ^ % Invalid command at '^' marker. switch# username admin password Wt1g1tHb role network-admin ^ % Invalid command at '^' marker. switch# vrf context management ^ % Invalid command at '^' marker. switch# ip route 0.0.0.0/0 10.198.15.1 ^ % Invalid command at '^' marker. switch# interface mgmt0 ^ % Invalid command at '^' marker. switch# vrf member management ^ % Invalid command at '^' marker. switch# ip address 10.198.15.19/24 ^ % Invalid command at '^' marker. switch# DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:read_channel: switch# DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel: DEBUG:netmiko:write_channel: b'\n' DEBUG:netmiko:Pattern is: DEBUG:netmiko:_read_channel_expect read_data:
DEBUG:netmiko:Pattern found:
DEBUG:netmiko:write_channel: b'\n' switch# tmiko:read_channel: switch# DEBUG:netmiko:read_channel: DEBUG:netmiko:read_channel:
Please do needful.