cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1666
Views
0
Helpful
3
Replies

Automating Carriage Return on Cisco devices

gdrandles
Level 1
Level 1

I created a text file that allows me to cut and paste the config and run no shut on certain interfaces. How can I get past the beginning where the IOS ask you to press "Enter" to continue before getting the router> prompt?

3 Replies 3

Jason Fraioli
Level 3
Level 3

maybe toss in a couple "!". The terminal window will have to carriage return to get to the next line. Might work, not sure, never tried.

!

config t

...

leeg
Level 1
Level 1

Hi what is the latest on this? the exclamations do not work.

You can do this with Netmiko, you can use the send feature (https://pyneng.readthedocs.io/en/latest/book/18_ssh_telnet/netmiko.html)  to send an empty command to the router, which will have the same effect as pressing "Enter". Here's an example, update this for your use case.

from netmiko import ConnectHandler

router = ConnectHandler(device_type='cisco_ios', ip='router_ip', username='username', password='password')

# Send an empty command to get past the "Press Enter to continue" prompt
router.send('\n')

# Wait for the router prompt
output = router.read_until('router>')

# Send your configuration commands
router.send_config_from_file('config_file.txt')

# Close the connection
router.disconnect()

 Hope this helps.

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io