Cloud Managed Networks

 View Only
last person joined: yesterday 

Forum to discuss all things related to HPE Aruba Networking Central and UXI Network Management, including deployment of managed networks, configuration, best practices, APIs, Cloud Guest, AIOps, Presence Analytics, and other included Applications
Expand all | Collapse all

Aruba Central script to bulk change AP names

This thread has been viewed 23 times
  • 1.  Aruba Central script to bulk change AP names

    MVP EXPERT
    Posted Jun 07, 2022 02:53 PM
    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
    ------------------------------


  • 2.  RE: Aruba Central script to bulk change AP names

    EMPLOYEE
    Posted Jun 07, 2022 07:08 PM
    This is great.

    Also I wanted to ensure that everyone is aware of this Aruba Central API automation site that was developed by one of our senior engineers and is fully operational. This  show cases the true power of automation.
    https://central.wifidownunder.com/settings.html

    Here is the full doco on it.
    https://central.wifidownunder.com/documentation.html



    ------------------------------
    Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or Aruba.
    ------------------------------



  • 3.  RE: Aruba Central script to bulk change AP names

    MVP EXPERT
    Posted Jun 08, 2022 12:43 AM
    Thanks for sharing!

    Outlook voor iOS downloaden