run-config is great output and is used with WLC Analyser tool.
Here is a way to make it more automatic
1st) make sure you are at a code level that supports run-config upload
Run the command: transfer upload run-config to see if the controller supports it.
This is a re-hash of some old scripts I've written. See:
https://supportforums.cisco.com/message/3450792#3450792
Here is the script:
executable:
wlc-run.sh
commands:
wlc-run-conf.exp
Prior to running it:
(Optional) In /tftpboot (or where you specified below) touch the file you want to call it, make sure you change it in the expect file too.
chmod a+w the file
run it as follows: ./wlc-run.sh <controller ip> <read-write user> <password>
Bash script that calls the command script:
#!/bin/bash
# wlc-run.sh
# 2011 Eric Garnel
# expect script to pull info from WLC controllers
# set the output directory
#
# Usage- call script with variables
#
# ./wlc-run.sh <wlc ip> <username> <password> <controllername>
#
# change path as needed
# example: path_to_scriptsdir=/tmp
path_to_scriptsdir=/usr/local/share/wlc
router="$1"
username="$2"
password="$3"
output=$($path_to_scriptsdir/wlc-run-conf.exp $router $username $password)
run=$(echo $output)
exit 0
Expect script that runs the actual commands:
#!/usr/bin/expect
#wlc-run-conf.exp
set router [ lindex $argv 0]
set username [ lindex $argv 1]
set password [ lindex $argv 2]
spawn ssh $router
#log_user 0
set timeout 10
expect "(yes/no)?" {
send "yes\r"; exp_continue }
expect "User:"
send -- "$username\r"
expect "Password:"
send -- "$password\r"
expect "Controller"
send -- "config paging disable\r"
# some wlc config commands require yes/no verification
# set the data type to run-cofig
expect "Controller"
send -- "transfer upload datatype run-config\r"
# set the serverip here. Sorry, it must be hard-coded as my coding skills suck
expect "Controller"
send -- "transfer upload serverip 192.168.1.9\r"
# tell it what file on the tftp server to save as. I touched the file manually in advance just to be sure
expect "Controller"
send -- "transfer upload filename 2504-run\r"
# Kick it off
expect "Controller"
send -- "transfer upload start\r"
expect "(y/N)"
send -- "y\r"
# logout of controller
expect "Controller"
send "logout\r"