10-01-2021 03:02 PM
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-04-2021 01:42 PM
OK, I’ll try that way.
Thank you for your support.
Claudio
10-14-2021 05:11 PM
10-04-2021 01:20 PM
Ok,
if you want to switch the SSIDs only for single APs then you can do it in the following way:
You can apparently switch the SSID on and off per radio.
I.e. you define all required SSIDs in the profile and then switch the SSIDs that are currently required on the radio as needed.
Take a look at the following two parameters:
under "/v1/aps/{apSerialNumber}":
radioIfList => Here you define the serviceIds for the radio.
radioIfListOvr => As written at the beginning you make sure that the profile does not overwrite your changes.
Here there is again a get and a set, so that you can check what is in there now.
By the way, the configuration via the CLI is not officially supported by XCC. Therefore, the way via the API is the right one.
10-04-2021 01:03 PM
OK, but unfortunately I need to enable/disable SSID on every single AP.
Using profiles, may be I’ve to reorganize completely my configuration.
It’ would be very useful to have a CLI command to disable an SSID on an AP, so I could use expect module to do that.