Network Management

Reply
New Contributor

Backup flash file system configuration files on Aruba Wireless Controller using python

I recently needed to develop an automated method for backing up an aruba wireless controller without using airwave. In tackling this challenege I developed a python script that connects to the controller using ssh, inititaes a flash file system backup, and then copies the file off the controller to a ftp server.

 

Code is below:

 

from netmiko import ConnectHandler

# Create device dictionary
wlc01 = {
    'device_type': 'aruba_os',
    'ip': '192.168.1.10',
    'username': 'admin',
    'password':'password',
}

# Establish secure session to device
net_connect = ConnectHandler(**wlc01)

# Send command to create backup file and wait 2 seconds for backup to complete
net_connect.send_command('backup flash', delay_factor=2)

# Send command to copy backup file to backup server via ftp
cmd1 = 'copy flash: flashbackup.tar.gz ftp: 172.16.1.100 ftpusername /backups flashbackup.tar.gz'
output = net_connect.send_command_timing(cmd1)
if 'Password:' in output:
    output += net_connect.send_command_timing('ftpuserpassword')

#  Disconnect secure session from device
net_connect.disconnect()

 

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: