cancel
Showing results for 
Search instead for 
Did you mean: 

XCC API: Add an SSID to a given AP

XCC API: Add an SSID to a given AP

Claudio_Lori
New Contributor II

Hi All,

I’m trying to update ap configuration with XCC REST API.

I’d like to add a new SSID by updating the “service” linst in the Ap configuration.

Reading docs, I’ve written the following python function:

def addServiceToAp(controller,token,serial,service):
    #print(token)
    url = 'https://'+str(controller)+':5825/management/v1/aps/'+str(serial)
    myHeaders = {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'Authorization': 'Bearer ' + token
                }
    apConf = getApConfig(controller,token,serial)      # get configuration with custom function
    services = apConf['services']
    services.append(service)
    services.append(service)
    apConf['services'] = services  # Update list
    try:
        r = requests.put(url,verify=False, headers=myHeaders, json=apConf) # PUT the new configuration
    except requests.exceptions.Timeout:
        print("Timeout!")
        return False
    if r.status_code != 200:
        print("Cannot access XCC REST API! Error code: {}".format(r.status_code))
        print(r.content)
        return False
    else:
        print("unimi-convegni added!")
        print(r.status_code)
        return True

Before calling the function above, I correctly get the auth token and use it successful to get the full configuration of the ap.

This function first get the ap configuration, add the SSID unimi-convegni twice to the list of services, than PUT it on the XCC.

What appens is that the configuration on the XCC isn’t updated, even if the status code returned by the PUT method is 200, that it means that the operation is successful.

XCC software version is 05.26.05.0003

Is there something wrong on the code?

Thank you in advance for any help.

Claudio

10 REPLIES 10

Claudio_Lori
New Contributor II

Hi Stephan,

thank you for your reply.

So there’s no way to enable or disable an SSID in a single AP by Web API.

Do you know how to disable it by ECA CLI?

Thanks a lot

Claudio

StephanH
Valued Contributor III

If the SSIDs are the same for all APs that belong to a profile. You can make your changes directly to the profile.
The access is done via the "ProfileManager" and the "ServiceManager".
Where the so-called serviceIds are relevant for the profile.

It is best to first look at the profiles with: "management/v3/profiles/".

Regards Stephan

StephanH
Valued Contributor III

Hello,

from the API guide:

 

services    
Array of strings
A list of the names of the services this AP is providing. They could be obtained by looking up its site and getting them from there but it is likely that it will be more efficient to include references to the services directly. This attribute is READ-ONLY in this Access Point Element
Valid character set : Alphanumeric, special characters except semi-colon, colon and ampersand

 

It seems that can not work.

Regards Stephan

StephanH
Valued Contributor III

Hello Claudio,

I am aware that you are using the API. But you have to find the switch that sets the hook in my image either via the API or you have to set the hook once manually, otherwise your settings will be overwritten by the profile as written by me.
How should the AP know that he may no longer apply what comes from the profile?  Therefore, in my opinion, the hook must be set (for every AP) then the AP knows that you want to overwrite the settings manually.

Regards Stephan

Claudio_Lori
New Contributor II

Hello Stephan,

I’m using the API to enable and disable an SSID on schedule by a script. I’m aware that I can enable/disable It by hand, but I need to enable/disable It automatically.

I also tried to use ECA CLI with expect python module, but I found how to enable an SSID with ‘wlan-assign’ command in the ap/serial-number context, but I did not find the command to disable It.

Is seems that you can use the ‘no’ command, but I did not find the way to use It. The ECA CLI is not documented, as far as I know.

GTM-P2G8KFN