Hi Airheads,
I come up a situation i have to change the AP name for around 700 access points in Aruba Central. It seems like there is no easy xml import button to do this. Off course there maybe some other options but i come up the idea to create an python script what talks to the Aruba Central API interface.
The script read from a common seperate file "import.txt" what contains the AP serial numbers and the desired AP names like the follow format:
DZ0123456,HomeLAB-AP01
DZ0123457,HomeLAB-AP02
DZ0123458,HomeLAB-AP03
DZ0123459,HomeLAB-AP04
Before the script runs there are some attributes to customize yourself:
1. Fill in the API access+token you can generate in your Aruba Central account.
2. Prepare the "import.txt" file like above.
3. The URL must be match your Aruba Central datacenter location (EU-1, EU-3 for example has different URLs which can be find in Aruba Central.
To generate a Aruba Central token go to: Network Operations > Organization > Platform Integration > API Gateway > REST API
Here you will also find the URL of your Aruba Central , for example EU-1 is "https://eu-apigw.central.arubanetworks.com/".
Note: API access token will expire after 2 hours.
Hope you will find my script useful and inspire you to create your own API scripts.
import requests
import json
token = "api token here"
header = {'Authorization': 'Bearer ' + token}
with open('import.txt') as importfile:
for line in importfile:
serial, apname = line.split(',')
print(serial.strip(), apname.strip())
url = "https://eu-apigw.central.arubanetworks.com/configuration/v2/ap_settings/"+serial
payload = {"hostname": apname,
"ip_address": "",
"zonename": "",
"achannel": "",
"atxpower": "",
"gchannel": "",
"gtxpower": "",
"dot11a_radio_disable": False,
"dot11g_radio_disable": False,
"usb_port_disable": False}
r = requests.post(url, json=payload, headers=header)
response = r.text
print (response)
------------------------------
Marcel Koedijk | MVP Expert 2022 | ACEP | ACMP | ACCP | ACDP | Ekahau ECSE | Not an HPE Employee | Opinions are my own
------------------------------