Controllerless Networks

 View Only
last person joined: yesterday 

Instant Mode - the controllerless Wi-Fi solution that's easy to set up, is loaded with security and smarts, and won't break your budget
Expand all | Collapse all

Extract and Re-Import names in bulk

This thread has been viewed 25 times
  • 1.  Extract and Re-Import names in bulk

    Posted Jan 23, 2023 06:07 AM

    Is there a way to be able to:

    • login to an IAP VIP and export all the APs it currently sees.
    • then import those into Excel and rename the APs
    • then import the renamed APs back onto the VIP.
    We have rather a lot of APs that currently appear just as their MAC-Add which is less than helpful and would like to apply a naming convention to them. Thankfully not my task but I said I'd ask the question f this is something we can do in bulk.

    Stuart D

  • 2.  RE: Extract and Re-Import names in bulk

    Posted Feb 01, 2023 08:19 AM
    Hi Stuart,

    I assume you are not using Aruba Central? If you are you could do this a number of ways including using the Aruba Central API.

    If these are non cloud managed APs then you could utilise the REST API -

    Here is some shonky python I've jumbled together... You would need to run allow-rest-api, commit apply on the IAP to enable the REST API. I can't guarantee the code will work for you perfectly.

    import csv
    import requests
    # specify the Aruba Master IAP IP Address
    iap_ip = "ip_addr_of_VC"
    #specify the Aruba AP Login details
    admin = "admin"
    password = "passsssword"
    # specify URLs for logging in and out of the Aruba Instant API
    loginurl = "https://"+iap_ip+":4343/rest/login"
    print(f"Logging in at: ", loginurl)
    logouturl = "https://"+iap_ip+":4343/rest/logout"
    # specify the headers
    headers = {'Content-Type': 'application/json'}
    # specify auth payload
    auth_payload = {"user": admin, "passwd": password}
    # login to the AP to retrieve the SID, include verify=False for certificate errors
    login =, headers=headers, json=auth_payload)
    if login.status_code == 503:
        print(f"Please enable the REST API")
        raise SystemExit('API disallowed')
        back = login.json()
    if str(back['Status']) == "Success":
        print(f"Successfully logged into the AP")
        sid = back['sid']
        print(f"Failed to log into the AP. Status-code: ",back['Status-code'],", Message :", back['message'])
        raise SystemExit('Login failed')
    # specify the URL for the AP API
    apiurl = "https://"+ iap_ip+":4343/rest/hostname?sid="+sid
    print(f"API URL: ", apiurl)
    # read the CSV file containing the AP names
    with open('ap_names.csv', 'r') as file:
        reader = csv.reader(file)
        next(reader) # skip the header row
        for row in reader:
            ap_ip, new_name = row[0], row[1]
            # construct the payload for the API request
            payload = {"iap_ip_addr": ap_ip,
                           {"hostname": new_name
            # send the API request to update the AP name, include verify=False for certificate errors
            response =, json=payload, headers=headers)
            check = response.json()
            # check the response status code to ensure the request was successful
            if response.status_code == 200:
                if check['Status-code'] == 0:
                    print(f"Successfully renamed AP {ap_ip} to {new_name}")
                print(f"Failed to rename AP {ap_ip}. Status Code: {response.status_code} Error: {response.text}")
    # logout afterwards to close the door, include verify=False for certificate errors
    lo_payload = {"sid": sid}
    logout =, json=lo_payload, headers=headers)
    print(f"Logging out at: ", logouturl)
    l_out = logout.json()
    # check the response status code to ensure the request was successful
    if logout.status_code == 200:
        print(f"Uh oh! Logout failed. Message: ",l_out['message'])

    You can setup a csv file like this...

    Not sure I can help with pre-populating this csv in response to the first part of your query. The show aps API doesn't respond with JSON so it would require some clever parsing. I've kept the CSV simple however. So hopefully you could easily populate it.

  • 3.  RE: Extract and Re-Import names in bulk

    Posted Feb 02, 2023 02:36 AM
    Many thanks for the code - that's beyond my skillset but I will pass it along to those that know better.

    And no, we are using Aruba Central but a dedicated deployment of AMP if that makes a difference?

    Stuart D