Cisco DNA Spaces accuracy and latency tester
A small python script to test out Cisco DNA Spaces. The script creates a web server using Flask and connects to DNA Spaces Firehose API to receive location updates. It can then calculate the error distance and latency as a device is moved to a specific location on the map.
- Have a look at the Cisco DNA Spaces API over at DevNet. To get familar with the APIs available.
- Clone this repository into a directory to get the helper scripts:
git clone https://github.com/leigh-jewell/dnaspaces_tester.git
- Install Python 3.9+ with the appropriate distribution for your OS.
- Install Pipenv using pip which should have been installed with Python3:
pip install pipenv
Or if you are using Homebrew simply run:
brew install pipenv
For your script to receive Firehose API events you need to create an application in Cisco DNA Spaces Partners.
The steps for creating an application are:
- Browse to Cisco DNA Spaces Partners
- Create new app
- For app type select on prem
- App Center > Complete APP Name, APP Tag line, APP Description, Primary Industry, App Icon
- App Tile > Complete APP Tile and App Tile Tag line
- Events > Check the event Device Location Update
- Create
- Select App Activation Sandbox > App Center > Select your new App, click Activate button
- Sign up and continue
- Accept Permissions
- Choose locations that you wish to test
- Generate App Activation token and copy token
- Paste this token into the local http://127.0.0.1/ once you start python app.py
Create the virtual environment using Pipflie.lock. This will ensure the dependencies are installed
pipenv install --ignore-pipfile
The script will use the environment variable 'TOKEN' to authenticate to DNA Spaces. You will need to set this according to your OS.
Use the Pipenv shell to ensure you access the virtual environment created:
pipenv shell
You can now run the scripts:
python app.py
This will run a local Flask web server on http://127.0.0.1:5000 which is helpful for testing.
Some utility files are provided if you want to use vagrant to test with or if you want to provision this to a real server.