question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IOS upgrade for Cisco IE-3400

See original GitHub issue

Hello,

I am testing netmiko for ios upgrade automation. I wanted to try the script so I can understand it.

The device is a Cisco IE-3400 running IOS-XE. I have tried both cisco_ios and cisco_xe but the end result is the same.

The script in question:

https://github.com/ktbyers/netmiko/blob/develop/EXAMPLES.md#adjusting-delay_factor

from netmiko import ConnectHandler
from getpass import getpass
from datetime import datetime

Traffic_IP = [
	"10.199.0.38",
	]

username = input("USERNAME: ")	
cisco1 = {
"host": Traffic_IP[0],
"username": username,
"device_type": "cisco_ios",
"password": getpass(),
}

command = "copy sftp://SFTPBackup1:kODpYI0Jr)Z8YF5@172.26.3.62/images/IOS/IE/ie3x00-universalk9.17.03.04.SPA.bin flash:/ie3x00-universalk9.17.03.04.SPA.bin"
# Start clock
start_time = datetime.now()

net_connect = ConnectHandler(**cisco1)

# Netmiko normally allows 100 seconds for send_command to complete
# delay_factor=4 would allow 400 seconds.

output = net_connect.send_command_timing(
    command, strip_prompt=False, strip_command=False, delay_factor=7
)
# Router prompted in this example:
# -------
# cisco1
#copy flash:c880data-universalk9-mz.155-3.M8.bin flash:test1.bin# Destination filename [test1.bin]? 
# Copy in progress...CCCCCCC
# -------

if "Destination filename" in output:
    print("Starting copy...")
    output += net_connect.send_command("\n", delay_factor=7, expect_string=r"!")
    net_connect.disconnect()

end_time = datetime.now()
print(f"\n{output}\n")
print("done")
print(f"Execution time: {start_time - end_time}")

The script works as expected, however it finishes without actually copying the image over.

image

I am wondering what is causing the script to complete but not actually copy over.

Help is greatly appreciated.

Nick

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ktbyerscommented, Oct 12, 2021

For this type of operation, I would use send_command and not send_command_timing:

output = net_connect.send_command(
    command, strip_prompt=False, strip_command=False
)

Also probably should set fast_cli=False as an argument to ConnectHandler.

How long does the transfer normally take i.e. what is the expected execution time?

0reactions
ktbyerscommented, Oct 29, 2021

Yeah, this should all be greatly simplified in the next release of Netmiko, but basically you needed to set fast_cli=False so that things get set back to 100 seconds and so that delay_factor works as you would expect (i.e. * 7 = wait for 700 seconds).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cisco Catalyst IE3400 Rugged Series - Install and Upgrade ...
Cisco Catalyst IE3400 Rugged Series - Some links below may open a new browser window to display the document you selected. ... Install...
Read more >
Release Notes for Cisco Catalyst IE3x00 Rugged, IE 3400 ...
Example. Upgrading Cisco IOS XE Software Bundle Mode. This example shows the steps to upgrade the Cisco IOS XE software on a switch...
Read more >
New Hardware Versions of Cisco Catalyst IE3400 Rugged ...
A new version of the Cisco Catalyst IE3400 Rugged Series and Cisco Catalyst ... with Minimum Software Release - Software Upgrade Recommended.
Read more >
Cisco Catalyst IE3400 Rugged Series
Cisco Catalyst IE3400 Rugged Series - Technical support documentation, ... IE3400 Rugged/IE3400 Heavy Duty Series Will Be Supported with Minimum Software ...
Read more >
Cisco IOS XE Software Update Program for Cisco Catalyst ...
The Program provides Software updates to customers at no additional charge. It is designed to complement the existing 5-year limited hardware warranty offered ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found