### Install from PyPI Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Installs the latest stable version of the openwisp-network-topology package from the Python Package Index (PyPI). ```shell pip install openwisp-network-topology ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Installs the project in editable mode and installs all testing-specific dependencies from requirements-test.txt. This prepares the environment for development and testing. ```shell pip install -e . pip install -r requirements-test.txt ``` -------------------------------- ### Install from GitHub Tarball Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Installs the latest development version of the openwisp-network-topology package directly from a tarball hosted on GitHub via HTTPS. ```shell pip install https://github.com/openwisp/openwisp-network-topology/tarball/master ``` -------------------------------- ### Automate Topology Data Sending with Crontab Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/quickstart.rst Instructions to make the topology data sending script executable and schedule it to run every 5 minutes using the root crontab. Root privileges are necessary for the `zerotier-cli` command. ```shell # flag script as executable chmod +x /opt/send-zt-topology.sh # open rootcrontab sudo crontab -e ## Add the following line and save */5 * * * * /opt/send-zt-topology.sh ``` -------------------------------- ### Install from GitHub Git Repository Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Installs the openwisp-network-topology package in editable mode directly from its Git repository on GitHub using the git protocol. This is useful for development. ```shell pip install -e git+git://github.com/openwisp/openwisp-network-topology#egg=openwisp_network-topology ``` -------------------------------- ### Install System Dependencies Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Installs SQLite and SpatiaLite development libraries required for the project and its spatialite integrations. These are essential for database operations and testing. ```shell sudo apt install -y sqlite3 libsqlite3-dev # Install system dependencies for spatialite which is required # to run tests for openwisp-network-topology integrations with # openwisp-network-topology and openwisp-monitoring. sudo apt install libspatialite-dev libsqlite3-mod-spatialite ``` -------------------------------- ### Database Setup and User Creation Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Navigates into the 'tests' directory, applies database migrations, and creates a superuser account for accessing the Django admin interface. ```shell cd tests/ ./manage.py migrate ./manage.py createsuperuser ``` -------------------------------- ### Automate Topology Data Sending with Cron Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/quickstart.rst This snippet shows how to make the topology data sending script executable and add it to the crontab for periodic execution. The example configures the script to run every 5 minutes. ```shell # flag script as executable chmod +x /opt/send-topology.sh # open crontab crontab -e ## Add the following line and save */5 * * * * /opt/send-topology.sh ``` -------------------------------- ### Update Pip Packages Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Updates core Python packaging tools: pip, wheel, and setuptools. Ensures the package installer and build tools are up-to-date. ```shell pip install -U pip wheel setuptools ``` -------------------------------- ### Clone Repository Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Clones the OpenWISP Network Topology repository from a GitHub fork. Replace '' with your actual GitHub username. ```shell git clone git://github.com//openwisp-network-topology ``` -------------------------------- ### ZeroTier Topology Data Sending Script Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/quickstart.rst A bash script that fetches ZeroTier controller peers data in JSON format using `zerotier-cli` and uploads it to an OpenWISP API endpoint via `curl`. It requires placeholder values for topology UUID, key, and OpenWISP domain. ```shell #!/bin/bash # command to fetch zerotier controller peers data in json format COMMAND="zerotier-cli peers -j" UUID="" KEY="" OPENWISP_URL="https://" $COMMAND | # Upload the topology data to OpenWISP curl -X POST \ --data-binary @- \ --header "Content-Type: text/plain" \ $OPENWISP_URL/api/v1/network-topology/topology/$UUID/receive/?key=$KEY ``` -------------------------------- ### Setup Virtual Environment Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Creates and activates a Python virtual environment named 'env' using the 'virtualenv' package. This isolates project dependencies. ```shell python -m virtualenv env source env/bin/activate ``` -------------------------------- ### Start Docker Services Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Starts InfluxDB and Redis services in detached mode using Docker Compose. These services are required for running integration tests, particularly for WiFi Mesh functionality. ```shell docker compose up -d influxdb redis ``` -------------------------------- ### Run Tests Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Executes the project's test suite using the provided runtests.py script. Includes options to run WiFi Mesh integration tests by setting the WIFI_MESH environment variable. ```shell # Running tests without setting the "WIFI_MESH" environment # variable will not run tests for WiFi Mesh integration. # This is done to avoid slowing down the test suite by adding # dependencies which are only used by the integration. ./runtests.py # You can run the tests only for WiFi mesh integration using # the following command WIFI_MESH=1 ./runtests.py ``` -------------------------------- ### Navigate to Repository Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Changes the current directory to the root of the cloned openwisp-network-topology repository. ```shell cd openwisp-network-topology/ ``` -------------------------------- ### Run QA Tests Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/installation.rst Executes the Quality Assurance checks for the project. This script helps ensure code quality and adherence to standards. ```shell ./run-qa-checks ``` -------------------------------- ### Send Topology Data via POST Request Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/quickstart.rst This script demonstrates how to send topology data to the OpenWISP API using curl. It requires specifying the topology UUID, an API key, and the OpenWISP domain. The data is sent as a POST request with the Content-Type set to text/plain. ```shell #!/bin/bash # replace COMMAND with the command used to fetch the topology data COMMAND="cat /var/log/openvpn/tun0.stats" UUID="" KEY="" OPENWISP_URL="https://" $COMMAND | # Upload the topology data to OpenWISP curl -X POST \ --data-binary @- \ --header "Content-Type: text/plain" \ $OPENWISP_URL/api/v1/network-topology/topology/$UUID/receive/?key=$KEY ``` -------------------------------- ### Install OpenWISP Network Topology Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/extending.rst Install the openwisp-network-topology package using pip. This command should be run within your project's virtual environment and added to your project's requirements. ```shell pip install openwisp-network-topology ``` -------------------------------- ### OpenWISP Network Topology API Endpoint Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/quickstart.rst This describes the API endpoint for receiving topology data. It's a POST request used to submit network topology information to a specific topology instance identified by its UUID. The request requires an API key for authentication and authorization. ```APIDOC POST /api/v1/network-topology/topology/{uuid}/receive/ Description: Submits network topology data for a specific topology instance. Parameters: uuid (path parameter): The unique identifier for the topology. key (query parameter): An API key for authentication and authorization. Request Body: --data-binary @- : The raw topology data is sent as the request body. Content-Type: text/plain Example Usage: curl -X POST \ --data-binary @- \ --header "Content-Type: text/plain" \ https:///api/v1/network-topology/topology//receive/?key= ``` -------------------------------- ### Setup API URLs for OpenWISP Network Topology Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/extending.rst This snippet demonstrates how to set up API URLs for the OpenWISP Network Topology module by creating an `api/urls.py` file. It utilizes a utility function to generate the necessary API URL patterns. ```python from openwisp_network_topology.api import views from openwisp_network_topology.utils import get_api_urls # When you want to modify views, please change views location # from . import views urlpatterns = get_api_urls(views) ``` -------------------------------- ### Configure Root URLs for OpenWISP Network Topology Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/extending.rst This snippet shows how to register the OpenWISP Network Topology URLs within your project's main `urls.py` file. It includes an example of how to optionally include visualizer URLs. ```python from django.urls import include, path from django.contrib import admin # If you've extended visualizer views (discussed below). # Import visualizer views & function to add it. # from openwisp_network_topology.utils import get_visualizer_urls # from .sample_network_topology.visualizer import views urlpatterns = [ # If you've extended visualizer views (discussed below). # Add visualizer views in urls.py # path('topology/', include(get_visualizer_urls(views))), path("", include("openwisp_network_topology.urls")), path("admin/", admin.site.urls), ] ``` -------------------------------- ### Run upgrade_from_django_netjsongraph Management Command Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/management-commands.rst This command facilitates migration from `django-netjsongraph` to `openwisp-network-topology`, importing topologies, users, and groups. It accepts optional `--backup` for specifying backup file locations and `--organization` for targeting a specific organization UUID during import. ```shell ./manage.py upgrade_from_django_netjsongraph ./manage.py upgrade_from_django_netjsongraph --backup /home/user/django_netjsongraph/ ./manage.py upgrade_from_django_netjsongraph --organization 900856da-c89a-412d-8fee-45a9c763ca0b ``` -------------------------------- ### Initialize NetJSONGraph Visualization Source: https://github.com/openwisp/openwisp-network-topology/blob/master/openwisp_network_topology/templates/netjsongraph/detail.html This JavaScript code initializes the NetJSONGraph visualization by targeting an HTML element with the class '.djnjg-overlay'. It assumes the NetJSONGraph library is loaded and available globally. ```JavaScript const graph = window.loadNetJsonGraph('.djnjg-overlay'); ``` -------------------------------- ### Run OpenWISP Network Topology Automated Tests Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/extending.rst This command shows how to execute the automated tests for the OpenWISP Network Topology module, including an option for parallel execution. Replace `sample_network_topology` with your app's name. ```bash # the --parallel flag is optional ./manage.py test --parallel sample_network_topology ``` -------------------------------- ### Load and Render Network Topology Graph (JavaScript) Source: https://github.com/openwisp/openwisp-network-topology/blob/master/openwisp_network_topology/templates/netjsongraph/netjsongraph-script.html Initializes and renders a network topology graph using the NetJSONGraph library. It sets up WebSocket connections for live updates, customizes graph appearance and behavior, processes link and node data including date parsing, and adds interactive UI elements like a legend and a date picker. Performance optimizations are applied for large datasets. ```javascript loadNetJsonGraph = (el='body', url='{{ graph_url }}?include_unpublished=true') => { const history_url = '{{ history_url }}?include_unpublished=true'; const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; const apiHost = new URL('{{ graph_url }}').host; const wsUrl = `${wsProtocol}//${apiHost}/ws/network-topology/topology/${getTopologyIdFromUrl()}/`; const socket = new WebSocket(wsUrl); const getDataParseOptions = (data) => { return { dateString: data, parseRegular: /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,6}))?Z$/ }; }; const graphConfig = { series:{ zoom:'2', }, baseOptions: { backgroundColor: '#282222b3', toolbox: { right: '60', top: '15', }, }, } // load graph const graph = new NetJSONGraph(url, { el: el, graphConfig: graphConfig, linkCategories: [ { name: 'down', linkStyle: { color: '#c92517', width: 6, }, emphasis: { linkStyle: { color: '#FD0101', opacity: 1, }, }, }, { name: 'up', linkStyle: { color: '#1ba619', width: 6, }, emphasis: { linkStyle: { color: '#3acc38', opacity: 1, }, }, }, ], prepareData: (data) => { data.links.map((link) => { link.properties = link.properties || {}; if (link.properties.status) { link.category = link.properties.status; } if (link.properties.created) { link.properties.created = graph.utils.dateParse( getDataParseOptions(link.properties.created) ); } if (link.properties.modified) { link.properties.modified = graph.utils.dateParse( getDataParseOptions(link.properties.modified) ); } if (link.properties.status_changed) { link.properties.status_changed = graph.utils.dateParse( getDataParseOptions(link.properties.status_changed) ); } }); data.nodes.map((node) => { node.properties = node.properties || {}; if (node.properties.created) { node.properties.created = graph.utils.dateParse( getDataParseOptions(node.properties.created) ); } if (node.properties.modified) { node.properties.modified = graph.utils.dateParse( getDataParseOptions(node.properties.modified) ); } }); // Disable animation in graph for large topologies. // See https://github.com/openwisp/openwisp-network-topology/issues/164 if (data.nodes.length > 20) { graph.config.graphConfig.series.force = { layoutAnimation: false, }; graph.config.graphConfig.series.draggable = false; if (data.nodes.length > 50) { graph.config.graphConfig.series.force.edgeLength = 250; } } }, }); const overlay = document.querySelector(el); const createLegend = (key, name) => { const legendItem = document.createElement('p'); const legendIcon = document.createElement('span'); legendIcon.setAttribute('class', name); legend.appendChild(legendItem); legendItem.appendChild(legendIcon); legendItem.innerHTML += key; return legendItem; }; const legend = document.createElement('div'); const legendHeader = document.createElement('h4'); legend.setAttribute('id', 'legend'); legendHeader.innerHTML = 'Legend'; legend.appendChild(legendHeader); legend.appendChild(createLegend('Up', 'link-up')); legend.appendChild(createLegend('Down', 'link-down')); overlay.appendChild(legend); const switcher = document.createElement('div'); switcher.setAttribute('class', 'njg-switcher'); const dateLabel = document.createElement('label'); dateLabel.setAttribute('for', 'njg-datepicker'); dateLabel.innerHTML = 'Date:'; switcher.appendChild(dateLabel); const datePicker = document.createElement('input'); datePicker.setAttribute('type', 'text'); datePicker.setAttribute('id', 'njg-datepicker'); datePicker.setAttribute('data-history-api', history_url); switcher.appendChild(datePicker); overlay.appendChild(switcher); socket.onmessage=function(e){ const data=JSON.parse(e.data); if(data.type==="broadcast_topology"){ const topology=JSON.parse(data.topology); window.graph.utils.JSONDataUpdate.call(window.graph, topology); } } graph.render(); window.initTopologyHistory(django.jQuery); return graph // Utility function function getTopologyIdFromUrl() { let topologyId; try { topologyId = /\/((\w{4,12}-?)){5}\//.exec(window.location)[0]; } catch (error) { try { topologyId = /\/(\d+)\//.exec(window.location)[0]; } catch (error) { throw error; } } return topologyId.replace(/\//g, ''); } }; ``` -------------------------------- ### Django INSTALLED_APPS Configuration Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/extending.rst This snippet shows the necessary entries to add to your Django project's `settings.py` file to include the OpenWISP Network Topology application and its various optional contributions. ```python INSTALLED_APPS = [ # ... other apps "openwisp_network_topology", "openwisp_network_topology.contrib.openwisp_monitoring", "openwisp_network_topology.contrib.openwisp_ipam", "openwisp_network_topology.contrib.openwisp_radius", "openwisp_network_topology.contrib.openwisp_vpn", "openwisp_network_topology.contrib.openwisp_utils", "openwisp_network_topology.contrib.openwisp_users", "openwisp_network_topology.contrib.openwisp_geo", "openwisp_network_topology.contrib.openwisp_flow", "openwisp_network_topology.contrib.openwisp_billing", "openwisp_network_topology.contrib.openwisp_config", "openwisp_network_topology.contrib.openwisp_log", "openwisp_network_topology.contrib.openwisp_notifications", "openwisp_network_topology.contrib.openwisp_sms", "openwisp_network_topology.contrib.openwisp_ui", "openwisp_network_topology.contrib.openwisp_widgets", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semanticui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs5", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_semantic", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_materialize", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_flatui", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte2", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_adminlte3", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bulma", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_tailwind", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap", "openwisp_network_topology.contrib.openwisp_widgets.contrib.openwisp_widgets_bootstrap_bs4", "openwisp ``` -------------------------------- ### Django Template for Network Graph Source: https://github.com/openwisp/openwisp-network-topology/blob/master/openwisp_network_topology/templates/netjsongraph/detail.html A Django template snippet that extends a base layout, sets the page title dynamically from a topology label, and includes JavaScript for graph rendering. It loads static files and incorporates another template for specific graph scripts. ```Django {% extends 'netjsongraph/base.html' %} {% load static %} {% block title %}{{ topology.label }}{% endblock %} {% block script %} {{ block.super }} {% include './netjsongraph-script.html' %} {% endblock %} ``` -------------------------------- ### Run create_device_nodes Management Command Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/management-commands.rst The `create_device_nodes` management command is designed to establish initial `DeviceNode` relationships. This is particularly useful in pre-existing systems with devices and topology objects, especially when integration with OpenWISP Controller is enabled. ```shell ./manage.py create_device_nodes ``` -------------------------------- ### Add Integration to Django INSTALLED_APPS Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/integrations.rst Enables the device integration module by adding its path to the INSTALLED_APPS setting in your Django project. ```python INSTALLED_APPS.append("openwisp_network_topology.integrations.device") ``` -------------------------------- ### Create Custom Django Apps Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/developer/extending.rst Commands to create new Django applications for custom network topology or integration modules. These commands initiate the basic structure for your derivative apps. ```shell django-admin startapp sample_network_topology ``` ```shell django-admin startapp sample_integration_device ``` -------------------------------- ### OPENWISP_NETWORK_TOPOLOGY_SIGNALS Setting Source: https://github.com/openwisp/openwisp-network-topology/blob/master/docs/user/settings.rst Specifies a Python module string to import on initialization for custom behavior or loading Django signals. Default is None. ```APIDOC OPENWISP_NETWORK_TOPOLOGY_SIGNALS: type: str default: None description: String representing Python module to import on initialization. usage: Useful for loading Django signals or to define custom behavior. ``` -------------------------------- ### List Topologies with Links (Django Template) Source: https://github.com/openwisp/openwisp-network-topology/blob/master/openwisp_network_topology/templates/netjsongraph/list.html This template snippet iterates over a list of topology objects and generates a Markdown-formatted list. Each item displays the topology's label and provides a link to its detailed view using the 'topology_detail' URL pattern. It requires a 'topologies' variable to be passed to the template context. ```Django Template {% for topology in topologies %}* [{{ topology.label }}]({% url 'topology_detail' topology.id %}) {% endfor %} ``` -------------------------------- ### Network Topology Django Template Source: https://github.com/openwisp/openwisp-network-topology/blob/master/openwisp_network_topology/templates/admin/topology/visualize.html This Django template snippet loads internationalization and admin URL tags, along with static files. It defines content and script blocks, including a NetJSON graph script for visualization. ```Django {% load i18n admin_urls %} {% load static %} {% block content %} {% block script %} {% include '../../netjsongraph/netjsongraph-script.html' %} {% endblock %} {% endblock %} ```