I have a bunch of WLAN Templates in my test lab that I use from time to time. Some times it is for my own testing and research and some times for the customers.

Here are some of the reasons I need to audit/view these SSIDs:
- Some of these SSIDs under the WLAN Templates may be completely open; hence, it is imperative that I disable them after I complete my work.
- I am also working and testing with other vendor access points. If I am testing some of these SSIDs on a different vendor access point, I don’t need them enabled on my Mist Access Points.
- Lastly, you can imagine the Beacon overhead I’d create if I have all of these SSIDs enabled.
Why Not Just Disable Them ?
Yes, that is what I need to do, but first I need to know which ones are enabled/disabled and the Authentication methods being used. Almost like a quick audit. Currently, UI does not have specific columns for what I am looking for. I also do not want to go through clicking each Template and go through each SSID.
Python to the rescue:
I created a quick script that presents me with an output that I was looking for:
- SSID Name
- Enabled or not
- Authentication type

This quick code, gives me the output above and I am able to easily determine the status of SSIDs and Authentication method.
org_id = input('Enter Org ID: ')
url = f'https://api.mist.com/api/v1/orgs/{org_id}/wlans'
mist_api_key = os.environ.get('arf_mist_apikey')
headers = {
'Content-Type': 'application/json',
'Authorization': arf_mist_apikey
}
results = requests.get(url, headers=headers)
wlans = results.json()
#pp(wlans)
for items in wlans:
output =[]
if 'ssid' in items:
output.append(f"SSID: {items['ssid']}")
if 'enabled' in items:
enabled_val = items['enabled']
if enabled_val == True:
output.append(f"\033[91mEnabled: {enabled_val}\033[0m")
elif enabled_val == False:
output.append(f"Enabled: {items['enabled']}")
if 'auth' in items:
auth_val = items['auth']['type']
if auth_val == 'open':
output.append(f"\033[91mAuth Type: {auth_val}\033[0m")
else:
output.append(f"Auth Type: {items['auth']['type']}")
print(" : ".join(output))
Feel free to share your feedback, would love to get your thoughts if you use Mist and do something similar.
NOTE: All config/script samples are from my lab environment use them at your risk. They are provided as is without any warranty, assurance. Always test configurations, settings etc in a non production environment before using it in production.
