Cloud Managed Networks

 View Only
last person joined: 5 days ago 

Forum to discuss all things Aruba Central and UXI Network Management, this includes Aruba Central managed networks, Central configuration, best practices, Central APIs, Cloud Guest, AIOps, Presence Analytics and Other Central Applications

Aruba Central API - Get last known running configuration issue

This thread has been viewed 13 times
  • 1.  Aruba Central API - Get last known running configuration issue

    Posted Jan 26, 2023 08:19 AM
    Hi,

    I'm writing a python script to easily tear down and set up our demo customer in our MSP environment. One of the things I need to do is download the configuration of the devices before I tear everything down. For this I use the "/configuration/v1/devices//configuration" node as specified in the documentation.
    Unfortunately, this only seems to work on Access Points (AOS10.3.1.3) and not on Gateways (mix of 7010, 9004, 9004-LTE and vGW on Azure with AOS10.3.1.3) and Switches (AOS-CX 10.10.1030).
    On the gateways I either get a HTTP 500 "internal server error" or a HTTP 200 "Fetching configuration in progress for Mobility Controller <device_serial>/<MAC address>", but no configuration.
    On the switch (I currently only have one 6200F to play with) I get a HTTP 404 "Device <device_serial> or its configuration not found".

    My script is as follows:
    from pycentral.base import ArubaCentralBase
    from pprint import pprint
    from config.config import config
    
    def getConfiguration(central, device_serial):
        apiPath = f"/configuration/v1/devices/{device_serial}/configuration"
        apiMethod = "GET"
        headers = {"accept": "multipart/form-data"}
        resp = central.command(apiMethod=apiMethod, apiPath=apiPath, headers=headers)
        return resp
    
    def main():
        central_info = config["central_info"] # tested and correct
        ssl_verify = True
        central_info["token"] = ArubaCentralBase(
            central_info=central_info, ssl_verify=ssl_verify
        ).loadToken()
        central = ArubaCentralBase(central_info=central_info, ssl_verify=ssl_verify)
        configuration = getConfiguration(central, <some_correct_serial>)
        pprint(configuration)
        return
    
    if __name__ == "__main__":
        main()

    Any ideas?

    Steven


    ------------------------------
    Steven Demets
    ------------------------------