brancott
brancott

Reputation: 1

Cannot get whole running config from maipu switch using netmiko script

I'm new to netmiko, just wanted a simple script to backup a maipu switch config and the script runs "sh run" and gets output but only before ---MORE--- it doesn't go beyond it:

how it looks

I use cisco_ios as device_type because as far as I know there is no device_type for maipu. Here is the script:

from getpass import getpass
from netmiko import ConnectHandler

from datetime import date

today = date.today()

username = input('Enter your SSH username: ')
password = getpass()

with open('myswitches') as f:
    ip_lines = f.read().splitlines()
print (ip_lines)

for device in ip_lines:
    ip_address_of_device = device
    CE = {
        'device_type': 'cisco_ios',
        'ip':   ip_address_of_device,
        'username': username,
        'password': password
    }

    net_connect = ConnectHandler(**CE)
    running_config = net_connect.send_command("show running-config", read_timeout=500)
    with open(
       f'/root/networklab/maipu/maipu-running-config-{today}.txt', "w"
    ) as outfile:
       outfile.write(running_config.lstrip())
    print(f'Backup completed')
    net_connect.disconnect()

The same script gets config from cisco nexus switch fine. How to fix it?

Upvotes: 0

Views: 106

Answers (0)

Related Questions