Python script to copy NX-OS config to scp server

[ Edited ]
Posts: 1
89     0


My apologies if this has been answered before, I did a search and could not find anything. I’m trying to back up my configs to a SCP server. It works with IOS the issue is with NX-OS. When SCP I include the username and password in the command, however it still prompts for the password and times out. Is there a way to send the password in a different line? Here is my script.

Any help is much appreciated.




# Script-Filter:

#     $vendor eq "Cisco"



# Script-Variables:

#     $scp_user string "Network Username"    

#     $scp_pass password "Enter Password" 


# Script-timeout:300



from infoblox_netmri.easy import NetMRIEasy


import re


# This values will be provided by NetMRI before execution


defaults = {

    "api_url": api_url,

    "http_username": http_username,

    "http_password": http_password,

    "job_id": job_id,

    "device_id": device_id,

    "batch_id": batch_id



# Create NetMRI context manager. It will close the session after execution

with NetMRIEasy(**defaults) as easy:

    shover = easy.send_command('show version | inc IOS|Nexus')

    pattern = re.compile(r'(IOS|Nexus)')

    version = pattern.findall(shover)


    if(version[0] == 'IOS'):

        easy.send_command('write memory')

        easy.send_command('copy startup-config scp://{}:{}@ \r\r\r'.format(scp_user, scp_pass))

    elif(version[0] == 'Nexus'):

        easy.send_command('copy running-config startup-config')

        easy.send_command('copy startup-config scp://{}:{}@ vrf default \r\r'.format(scp_user, scp_pass))  


        print('This is not a switch or router')

Showing results for 
Search instead for 
Did you mean: 

Recommended for You