Link to home
Start Free TrialLog in
Avatar of Brian Corson
Brian Corson

asked on

Aruba Controller OS 8.x cli script help

Aruba wireless controller OS 8.x cli configuration
I am looking to build scripts for deployments of aruba controllers rather than use the gui. Working with Aruba and others, this request has been made but without an answer other than 'use the gui'. With the support of Aruba, the gui is taking between 3 - 4 hours.

Attached is a sanitized version of a script. I believe there are portions of this script where it has to be written to memory before continuing as well as changing directories in various parts. There are so few lines, I dont understand why we cannot simply create a script to automate this part?? Anyone have experience doing this?
aruba_controller_sample_script.txt
Avatar of Soulja
Soulja
Flag of United States of America image

Hi Brian,

Do you have any experience with Python. If this script same script is being deployed to multiple Aruba controllers that you have SSH access to it's very possible if you take advantage of Netmiko.
Avatar of Brian Corson
Brian Corson

ASKER

Never used it but I will look into it. I want to make this process so simple the engineers can just copy and paste.
That's the thing. They won't even have to cut and paste. They would just run the python script, provide credentials, then the script does the rest. Here is a sample of what I am referring to. This netmiko python script will log into the device ip's listed in the iplist.txt file and apply the config that is in the configfile.txt.

from netmiko import ConnectHandler
import time, sys, getpass, paramiko
user = raw_input("Enter your SSH username: ")
pword = getpass.getpass()


device = {
    'device_type': 'aruba'
    'username': user,
    'password': pword,
 
}
ipfile=open("iplist.txt") #This file contains a list of switch ip addresses.
configfile=open("configfile.txt") #opening the config file with the changes you want to push
configset=configfile.read() ##reads the config file
configfile.close() #closes the config file

for line in ipfile:
    device['ip']=line.strip()
    print("Connecting to Device " + line)
    net_connect = ConnectHandler(**device)
    time.sleep(2)
    output1 = net_connect.send_config_set(configset)
    print ("Applying Configuration to Device " + line)
    print(output1)

Open in new window

I will look into this. Thank you for the input.
You're Welcome
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.