-
Notifications
You must be signed in to change notification settings - Fork 4
How to use "Create Multiple Sites"
Use this script at your own risk. Make sure you understand what you are doing before executing it.
This script require you to have the following modules installed in your Python environment:
- requests
- semfio-mist
- geocoder
If the modules are not installed, run the following command to install it: pip install requests semfio-mist
You will also need to register and get a Google API key to be able to use the Google Geocoder API. Follow the following instructions to retrieve your Google API key: Get Google API Key
The config.json
file is used to configure the following settings:
- Your Mist Organization information:
- Organization ID
- Your Mist API Token
- Your Google API information
- Your Google API key
Here is an example:
{
"org_id": "<org_id>",
"token": "<token>",
"google_api_key": "<google_api_key>"
}
Feel free to modify the config-example.json
file and rename it to config.json
and place it in the same directory as the script file.
Make sure that you set the proper variables in this config.json file before running the script.
You will have to feed the script with a CSV file containing the details on the sites you want to create in your Mist organization. This file will include the following pieces of information:
- Site Name
- Site Group
- Site Address
- RF Template Name
It is important that this CSV file follows this format:
site_name,site_group,site_address,rf_template
HQ,Office,"<address>",office_CA
Remote-CA,Remote,"<address>",remote_CA
Remote-FR,Remote,"<address>",remote_FR
You can find an example there: example
Here is how to install the script to use it on your own machine:
git clone https://github.com/francoisverges/semfio-mist.git
Then you can navigate to the script directory:
cd semfio-mist/Create-Mulitple-Sites
In order to use the script, all you have to do is the following:
python create-multiple-sites.py list-stadiums.csv
Here is what the output will look like if none of the sites have been created before:
** Creating sites from CSV...
[2021-01-07 15:44:58 PST | INFO] Creating site: Stade de France
[2021-01-07 15:44:58 PST | INFO] Site already exists ID:d01367b2-85aa-47c4-9d96-c5aabe2d1ef1
[2021-01-07 15:44:59 PST | INFO] Creating site: Rogers Centre
[2021-01-07 15:44:59 PST | INFO] Site already exists ID:04176b65-3ab1-4ddb-b1ac-404b4d443dbd
[2021-01-07 15:45:01 PST | INFO] Creating site: Maracana
[2021-01-07 15:45:01 PST | INFO] Site already exists ID:04174820-f9ac-473e-a327-8916432839ea
[2021-01-07 15:45:02 PST | INFO] Creating site: Groupama Stadium
[2021-01-07 15:45:02 PST | INFO] Site already exists ID:86955eaf-39ac-48ab-8f6c-d87f2bc91a4a
[2021-01-07 15:45:03 PST | INFO] Creating site: Velodrome
[2021-01-07 15:45:03 PST | INFO] Site already exists ID:11d0df1c-dcfe-4e19-8b46-47d9a26999bf
[2021-01-07 15:45:04 PST | INFO] Creating site: Stade Pierre Mauroy
[2021-01-07 15:45:05 PST | INFO] Site already exists ID:2d48ce30-d7f4-4c1c-8623-ed50bd29e2be
[2021-01-07 15:45:06 PST | INFO] Creating site: Emirates Stadium
[2021-01-07 15:45:06 PST | INFO] Site already exists ID:634fadef-9f40-46d0-94a7-d212630148c9
[2021-01-07 15:45:07 PST | INFO] Creating site: Stamford Bridge
[2021-01-07 15:45:08 PST | INFO] Site already exists ID:a7431e3d-ae18-4c5a-8472-8ae68df1cc04
[2021-01-07 15:45:09 PST | INFO] Creating site: Old Trafford
[2021-01-07 15:45:09 PST | INFO] Site already exists ID:a1e5ef4f-cdec-4810-a926-061348fc99cc
[2021-01-07 15:45:10 PST | INFO] Creating site: Anfield
[2021-01-07 15:45:11 PST | INFO] Site already exists ID:62eab857-40ad-4115-bb90-12424e6c334f
[2021-01-07 15:45:12 PST | INFO] Creating site: Camp Nou
[2021-01-07 15:45:12 PST | INFO] Site already exists ID:fba2761f-1045-4742-857b-9e3b600dda89
[2021-01-07 15:45:13 PST | INFO] Creating site: Santiago Bernabeu
[2021-01-07 15:45:13 PST | INFO] Site already exists ID:2e6d0a1b-a095-4ed3-802c-2f9281709b61
[2021-01-07 15:45:15 PST | INFO] Creating site: Allianz Arena
[2021-01-07 15:45:15 PST | INFO] Site already exists ID:34b2144b-b99b-470a-884f-fe68251d6b54
[2021-01-07 15:45:16 PST | INFO] Creating site: Signal Iduna Park
[2021-01-07 15:45:16 PST | INFO] Site already exists ID:72ad952c-9f0e-405e-99b6-a82a2686271d
[2021-01-07 15:45:17 PST | INFO] Creating site: Allianz Juventus Stadium
[2021-01-07 15:45:18 PST | INFO] Site already exists ID:86762e1e-9cb0-45e8-bd0a-f76db91a6a12
[2021-01-07 15:45:19 PST | INFO] Creating site: San Siro
[2021-01-07 15:45:19 PST | INFO] Site already exists ID:352ec347-4acf-4438-8acd-3d3bdffe5fbc
[2021-01-07 15:45:20 PST | INFO] Creating site: Luzhniki Stadium
[2021-01-07 15:45:20 PST | INFO] Site already exists ID:65e8d801-ffd8-4203-bbac-d484c951efcf
[2021-01-07 15:45:22 PST | INFO] Creating site: Stadio Olimpico
[2021-01-07 15:45:22 PST | INFO] Site already exists ID:98803e95-3af8-4e49-9f8e-f1d577876f55
[2021-01-07 15:45:25 PST | INFO] Creating site: Olympiastadion
[2021-01-07 15:45:25 PST | INFO] Site already exists ID:c8588e8f-361f-4b86-b06a-723a1b41f4ad
[2021-01-07 15:45:26 PST | INFO] Creating site: Metropolitano Stadium
[2021-01-07 15:45:26 PST | INFO] Site already exists ID:7074287d-8871-4d2d-b062-6575ddebbd06
[2021-01-07 15:45:27 PST | INFO] Creating site: Estádio da Luz
[2021-01-07 15:45:28 PST | INFO] Site already exists ID:41b83100-7ea5-4744-b85d-af91bb738f19
[2021-01-07 15:45:28 PST | INFO] Creating site: Estádio do Dragão
[2021-01-07 15:45:29 PST | INFO] Site already exists ID:41bad9f2-2dc7-4d3c-893e-480eee35f8f2
[2021-01-07 15:45:30 PST | INFO] Creating site: Matmut Atlantique
[2021-01-07 15:45:30 PST | INFO] Site already exists ID:5d5b6244-2739-4190-9774-f2af8a9d9492
[2021-01-07 15:45:31 PST | INFO] Creating site: Stade Gaston Gérard
[2021-01-07 15:45:32 PST | INFO] Site already exists ID:1cef6bba-ae22-476b-a002-e25752f1a3c1
[2021-01-07 15:45:33 PST | INFO] Creating site: Stade Louis II
[2021-01-07 15:45:33 PST | INFO] Site already exists ID:b27cff21-bf8d-4695-96ba-8cd4093c8755
** Time to run: 37.91 sec