Automation of Operational Tasks on Mist Infrastructure

Ever since I posted my first python script to upgrade Mist Infrastructure, I was intrigued with the endless opportunities to automate daily tasks on Mist. I also got the chance to improve my python skills and learned how using modules can enable code reusability and improve efficiency. In this post I am sharing my Github repository which contains fours basic scripts to help with some operational tasks. The repository will be updated frequently with new scripts that will help in increased automation.

Save this repository to your computer

Be sure you have [git]( installed then run the command

git clone

Install Dependencies

The first step required to run the scripts is install the dependencies.
In the directory that you have the script“`pip3 install -r requirements.txt “`

Generate Token

Once you have the packages installed, the next requirement is to populate your token and OrID information in the file. For steps to create your token and identify your OrgID please please visit

Mist API Documentation

Home Page

Repository currently contains five files.

  • contains the functions that will be used from other scripts. This will also be the file where you store your token and Organization ID information

To start using these scripts , please add your token and Org Id to file

def getVar():
    token = "#Token Here"  
    orgId= "#ORGID Here" 
    return token,orgId
  • can be used to upgrade infrastructure at all sites in the organization

To upgrade access points at all sites in your Organization, please set the version in orgUpgrades script in the function shown below

def siteUpgrade(siteId):  # Function Upgrades access points at a site.
    payload = {
        "version": "0.5.1944", #Version to upgrade to
        "enable_p2p": True #Enabling peer to peer upgrade

If you want to upgrade only specific model of APs, the payload can be modified accordingly.

    "version": "3.1.5",
    "enable_p2p": false,
    "models": [
  • can be used to upgrade infrastructure at any one site in the organization. This will prompt you to enter a site name. The version on the payload needs to be updated in this file similar to
  • can be used to provide a list of offline APs in the organization. Running this script will result in a CSV file with the list of APs. Please note the APs need to have a name in order to appear in the list. Mist APs by default display the mac address under the name on UI. Such APs will not be included in the csv file.
  • can be used to track client details every 60 seconds. When this script is execute, it prompts you to enter a mac address of the client and the site name to track. Mist updates its client information every 60 seconds and so the default frequency to track client has been set to the same value.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: