Hello,
I want to create a new access policy to a switch or a template by API call, using the python library.
For this, I am using the following method, found on https://developer.cisco.com/meraki/api-v1/#!create-network-switch-access-policy
dashboard.switch.createNetworkSwitchAccessPolicy(networkId=XXXXXXX)
I am using it on a switch bind to a template.
The problem is : it doesn't seem to create the access policy on the template.
To be sure about it, I have tried with the example on the API V1 documentation :
network_id = 'L_XXXXXXXXXXXXXXXXXX'
name = 'Access policy #1'
radius_servers = [{'host': '1.2.3.4', 'port': 22, 'secret': 'password1'}]
radius_testing_enabled = False
radius_coa_support_enabled = False
radius_accounting_enabled = True
host_mode = 'Single-Host'
url_redirect_walled_garden_enabled = True
response = dashboard.switch.createNetworkSwitchAccessPolicy(
network_id, name, radius_servers, radius_testing_enabled, radius_coa_support_enabled, radius_accounting_enabled,
host_mode, url_redirect_walled_garden_enabled,
radiusAccountingServers=[{'host': '1.2.3.4', 'port': 22, 'secret': 'password1'}],
radiusGroupAttribute='11',
accessPolicyType='Hybrid authentication',
increaseAccessSpeed=False,
guestVlanId=100,
voiceVlanClients=True,
urlRedirectWalledGardenRanges=['192.168.1.0/24']
)
print(response)
(By the way, in the documentation urlRedirectWalledGardenRanges is a string, but the method needs an array).
When doing so, I get the 201 Created response, but I cannot find this new access policy.
I created two first access policy by hand on the dasboard before trying by API.
After trying to create it by API and getting 201 Created, I cannot find it on the dashboard :
On the changelog, I do see POST logs :
But when analyzing it, there is something weird about the values. As you can see, I tried multiple times creating an access policy by API call. Every time I tried, I changed the radius servers to new values (IP and ports).
For my last try, I used the code above (the example on API V1 documentation). So, this was the radius server I gave in parameter to the method :
radius_servers = [{'host': '1.2.3.4', 'port': 22, 'secret': 'password1'}]
When checking the logs, there is something weird : it seems like it concatenates my previous radius servers given during my last tries to the new POST :
Each blurred host and port was radius servers I previously tried but never at the same time. There are 7 different host in this POST, when I only gave the method 1 radius server (1.2.3.4 port 22).
Also, I cannot find the new access policy when using the get method :
dashboard.switch.getNetworkSwitchAccessPolicies()
I cannot find anything else than my two first access policy created by hand :
Now, when I try to create a new access policy, I get a 500 Internal Server Error message :
I don't have any issue using the other switch access policy methods, the updateNetworkSwitchAccessPolicy() one works fine on my access policy created by hand.
Does anyone have the same issue as me ? What am I doing wrong ?
Thank you in advance for your answers on my issue !