Network Topology
OpenWISP Network Topology is a network topology collector and visualizer web application and API, it allows to collect network topology data from different networking software (dynamic mesh routing protocols, OpenVPN), store it, visualize it, edit its details, it also provides hooks (a.k.a Django signals) to execute code when the status of a link changes.
When used in conjunction with OpenWISP Controller and OpenWISP Monitoring, it makes the monitoring system faster in detecting change to the network.
Deploy instructions
See Enabling the network topology module on the OpenWISP 22.05 ansible role documentation.
This module is also available in docker-openwisp although its usage is not recommended for production usage yet, unless the reader is willing to invest effort in adapting the docker images and configurations to overcome any roadblocks encountered.
Quick Start Guide
This module works by periodically collecting the network topology graph data of the supported networking software or formats. The data has to be either fetched by the application or received in POST API requests, therefore after deploying the application, additional steps are required to make the data collection and visualization work, read on to find out how.
Creating a topology
Create a topology object by going to Network Topology > Topologies > Add topology.
Give an appropriate label to the topology.
Select the topology format from the dropdown menu. The topology format determines which parser should be used to process topology data.
Select the Strategy for updating this topology.
If you are using FETCH strategy, then enter the URL for fetching topology data in the Url field.
If you are using RECEIVE strategy, you will get the URL for sending topology data. The RECEIVE strategy provides an additional field expiration time. This can be used to add delay in marking missing links as down.
Sending data for topology with RECEIVE strategy
Copy the URL generated by OpenWISP for sending the topology data.
E.g., in our case the URL is
http://127.0.0.1:8000/api/v1/network-topology/topology/d17e539a-1793-4be2-80a4-c305eca64fd8/receive/?key=cMGsvio8q0L0BGLd5twiFHQOqIEKI423
.Create a script (e.g.:
/opt/send-topology.sh
) which sends the topology data usingPOST
, in the example script below we are sending the status log data of OpenVPN but the same code can be applied to other formats by replacingcat /var/log/openvpn/tun0.stats
with the actual command which returns the network topology output:
#!/bin/bash
# Get OpenVPN topology data from OpenVPN management interface
cat /var/log/openvpn/tun0.stats |
# Upload the topology data to OpenWISP
curl -s -X POST \
--data-binary @- \
--header "Content-Type: text/plain" \
http://127.0.0.1:8000/api/v1/network-topology/topology/d17e539a-1793-4be2-80a4-c305eca64fd8/receive/?key=cMGsvio8q0L0BGLd5twiFHQOqIEKI423
Add the
/opt/send-topology.sh
script created in the previous step to the crontab, here's an example which sends the topology data every 5 minutes:
# flag script as executable
chmod +x /opt/send-topology.sh
# open crontab
crontab -e
## Add the following line and save
echo */5 * * * * /opt/send-topology.sh
Once the steps above are completed, you should see nodes and links being created automatically, you can see the network topology graph from the admin page of the topology change page (you have to click on the View topology graph button in the upper right part of the page) or, alternatively, a non-admin visualizer page is also available at the URL
/topology/topology/<TOPOLOGY-UUID>/
.
Find out more about OpenWISP Network Topology
For more information about the features offered by OpenWISP Network Topology we refer to the following sections of its documentation: