Developer

 View Only
last person joined: 2 days ago 

Expand all | Collapse all

Aruba Central - How to disable a WLAN/SSID?

This thread has been viewed 24 times
  • 1.  Aruba Central - How to disable a WLAN/SSID?

    Posted May 03, 2023 08:55 AM

    Now that we can change the wlan password in Central, we're working on automation to turn the wlan on and off.  We think the endpoint to do it is:

    {"wlan":{"disable_ssid": true}}

    However, we cannot get this working in swagger - getting 400's and 500's.  

    Can anyone help?



    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------


  • 2.  RE: Aruba Central - How to disable a WLAN/SSID?

    Posted May 03, 2023 01:30 PM

    I did a  

    apiPath = "/configuration/full_wlan/GROUPNAME/SSID"

    and got the full wlan config into JSON.  With a GUI change to disable the network, and then compared the "before" and "after" and the only change is:

    "disable_ssid": false,

    changes to:

    "disable_ssid": true,

    So, parsing the json, it appears the body to send the api should be:

    {
        "wlan": {
           //disable:false = ENABLED
    	"disable_ssid": false
    	}
    }
    
    //
    
    {
        "wlan": {
           //disable:true= DISABLED
    	"disable_ssid": true
    	}
    }


    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------



  • 3.  RE: Aruba Central - How to disable a WLAN/SSID?

    Posted May 03, 2023 01:38 PM

    However, this api call gives me a 500 error

    https://apigw-prod2.central.arubanetworks.com/configuration/full_wlan/GROUPNAME/SSID

    error:

    {
      "description": "'value'",
      "error_code": "0001",
      "service_name": "Configuration"
    }

    Response code 500



    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------



  • 4.  RE: Aruba Central - How to disable a WLAN/SSID?

    Posted May 03, 2023 02:12 PM

    Looks like this might be a step in the right direction - the change doesn't work, but it returns a "200" OK.

    {
        "wlan": {
          "essid": "LTTEST",
          "type":"employee",
    	  "disable_ssid": false
    	}
    }


    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------



  • 5.  RE: Aruba Central - How to disable a WLAN/SSID?

    Posted May 03, 2023 02:34 PM

    Also tried variations of "disable_ssid"

    "false"
    false
    False

    None work.



    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------



  • 6.  RE: Aruba Central - How to disable a WLAN/SSID?

    Posted May 04, 2023 09:52 AM

    Now I'm trying the string below, in swagger, and getting a 400 "not a string"

    {"value": {"wlan": {"essid": "LTTEST", "type": "employee", "disable_ssid": "false"}}}


    Getting swagger response:

    { "detail": "{'wlan': {'essid': 'LTTEST', 'type': 'employee', 'disable_ssid': 'false'}} is not of type 'string'", "status": 400, "title": "Bad Request", "type": "about:blank" }

     



    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------



  • 7.  RE: Aruba Central - How to disable a WLAN/SSID?
    Best Answer

    Posted May 05, 2023 06:08 PM

    If anyone comes across this, we got it to work.  Aruba Central get wlan, will send a key:value dictionary, formatted as a string.  This is what they want back in the "Put" call - except they want it as an "object" - a key:value object - with {"value":wlan_string}, where wlan_string is the original key:value they sent in the "get" call, modified as you need to, of course.

    If any Aruba dev's read this, it's really annoying/frustrating - that you want an object, with a key named "value", and the value of "value" is a string, of a dictionary.  Clear as mud.  Thanks.

        #...truncated
        # wlan at this point, is the raw string sent from Aruba Central - it's a k:v dictionary, in a string format.
        # The api demands wlan be an object, with a key called "value".
        wlan = {"value": wlan}
    
        # Build a dictionary with the base url and the token
        central = get_central()
        apiPath = f"/configuration/full_wlan/{group_name}/{ssid}" # this is the set the wlan configuration    
        apiMethod = "PUT"
    
        print("Sending wlan")
        response = central.command(apiMethod=apiMethod, apiPath=apiPath, apiData=wlan)
        if response['code'] == 200:
            print("Sent the wlan")
            return {'code':200, 'msg':'WLAN successfully sent to Aruba Central'}
        else:
            {'code':500, 'msg':response}
    
    ###################
    
    def get_central(ssl_verify:bool=False):
        """Create an Aruba Central Object which utilizes the Aruba Central SDK to issue
        commands to Aruba Central API endpoints.
    
        Args:
            ssl_verify (bool, optional): A Parameter the SDK wants. Defaults to False.
    
        Returns:
            central (Aruba Central SDK Object): An Aruba Central SDK object used to issue commands.
        """
        # get aws param to send to central
        PNAME = "XXXXXXXXXXXXXXX"
        # Note, we're NOT caching the token or renewing it.  Every time we make an api call
        # We're going to get a new token.  This is a TODO: for the future.
        token = get_token(PNAME) # Calling out to an imported function, which makes the API Call to get the Aruba Central token.
        
        # Build a dictionary with the base url and the token
        central_info = {
            "base_url": "https://apigw-prod2.central.arubanetworks.com",
            "token": token
        }
        # The code below instantiates an object, we're calling "central", of the ArubaCentralBase class.
        central = ArubaCentralBase(central_info=central_info, ssl_verify=ssl_verify)
        return central


    ------------------------------
    Brannen Taylor
    LendingTree
    Manager, Network Operations
    ------------------------------



  • 8.  RE: Aruba Central - How to disable a WLAN/SSID?

    Posted May 09, 2023 01:48 PM

    Hello @BT20 !

    I hear you regarding the confusion/complexity of the API you're using, please also keep in mind this API is an allowed API within your instance and not fully publicly available. That being said it is provided in the example Swagger body of what is expected for that API. It is recommended to use the CLI API in this use case.



    ------------------------------
    Ti Chiapuzio-Wong (they/them)
    HPE Aruba Networking
    ------------------------------