This repository will continue to evolve in the future, as I will continue to maintin the Mist Library to reflect Mist API changes and add new demo scripts.
Python library to use Mist APIs
Library presentation can be found in the document Mist_Library_Doc.pdf
This repository is collection of Python3 files made to simplify the creation of python scripts using Mist APIs. It has 3 main parts:
- The mlib folder: This is the Mist Library that you can import and use into your project. It will deal with different aspects of the API requests, so you can focus on your app.
- The demo scripts: Python scripts using the Mist Library to generate different kind of actions. These scripts are placed in the root folder, and can be used as is.
- the console module: It's a Python module you can import into a Python CLI, so you can quickly and easily test API requests.
The configuration file located inside the root folder and it allows to store:
- Your Mist credentials (Login, Login/Pwd, Api Token)
- the host to reach depending on the Cloud used (US, EU)
- the log level.
To use the configuration file, you'll have to create a file config.py in the root folder.
The format and explanation of the configuration file file can be found in the config_example.py file.
console.py is a module created to easily use/test the Mist library from python CLI.
This module will:
- automatically start a session (i.e. authenticate the user based on the configuration stored in config.py or by asking credentials).
- Provide autocompletion to easily find the right syntax to use the Python3 Mist Library
This console is build to easily see the available API calls. For example:
- under
console.requestsyou will find theorgsandsitesparts. - under
console.requests.orgsyou will find the different orgs objects you can call through APIs, which areadmins, licenses, settings, templates, alarmtemplates, mxclusters, sitegroups, webhooks, assetfilters, mxedges, sites, wlans, channels, mxtunnels, ssoroles, wxrules, deviceprofiles, psks, ssos, wxtags, info, rftemplates, stats, wxtunnels, inventory, secpolicies, subscriptions - under
console.requets.orgs.inventoryyou will find the available action for this specific object, which areadd, get, assign_macs_to_site, unassign, delete
Start the python interpreter from the Mist Library folder, and type import console. This will automatically initiate the library, and start the authentication (depending on your configuration).
It is a set of Python3 scripts using the Mist Library. The demo scripts are built to require a minimum input from the user, but they can also be totally automated and/or run by an external software.You will find some description and help at the beginning of each file.
org_admin_import.pyread a CSV file to automatically generate admin invitationsorg_auto_site_assignment.pyuse APIs to enable autoprovisionning featureorg_conf_backup.pybackup all the organisation object, maps, ... to filesorg_conf_restore.pyrestore a backup (done with org_conf_backup.py) to an organisationorg_inventoy_backup.pybackup all the devices and their configuration, pictures, ... from an organisation to filesorg_inventory_precheck.pyused to validate that the inventory restor can be done on a specific organisation. E.g. It will check that all the reqjired obejcts are present.org_inventory_restore.pyrestore an inventory backup (done with org_inventory_backup.py) to an organisationorg_report_rogue.pygenerate a report (and save it as a CSV file) of all the rogue APs and clients from an organization or a site.site_conf_psk_import_csv.pyread a CSV file to automatically create PSKsite_conf_psk.pyuse APIs to create a new PSKsite_conf_rogue.pyuse APIs to configure Rogue detectionsite_conf_webhook.pyuse APIs to configure webhooks (org or site level). Useful to create a webhook configuration for Splunk.site_conf_wlan.pyuse APIs to create/delete a WLAN