Repository: openwisp/openwisp-network-topology (language: python)

Issue:
[feature] Add support for Wireguard
Depends on https://github.com/openwisp/netdiff/issues/100.
[feature] Add support for Wireguard
Depends on https://github.com/openwisp/netdiff/issues/100.


Discussion / hints:

Fix patch:
diff --git a/README.rst b/README.rst
index b5754003..acdffc1a 100644
--- a/README.rst
+++ b/README.rst
@@ -97,6 +97,7 @@ Available features
     - BMX6 (q6m)
     - CNML 1.0
     - OpenVPN
+    - Wireguard
     - additional formats can be added by
       `writing custom netdiff parsers <https://github.com/openwisp/netdiff#parsers>`_
 * **network topology visualizer** based on
diff --git a/openwisp_network_topology/migrations/0016_alter_topology_parser.py b/openwisp_network_topology/migrations/0016_alter_topology_parser.py
new file mode 100644
index 00000000..e85dc1fb
--- /dev/null
+++ b/openwisp_network_topology/migrations/0016_alter_topology_parser.py
@@ -0,0 +1,31 @@
+# Generated by Django 4.0.5 on 2022-06-01 19:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('topology', '0015_shareable_topology_node_link'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='topology',
+            name='parser',
+            field=models.CharField(
+                choices=[
+                    ('netdiff.OlsrParser', 'OLSRd (txtinfo/jsoninfo)'),
+                    ('netdiff.BatmanParser', 'batman-advanced (jsondoc/txtinfo)'),
+                    ('netdiff.BmxParser', 'BMX6 (q6m)'),
+                    ('netdiff.NetJsonParser', 'NetJSON NetworkGraph'),
+                    ('netdiff.CnmlParser', 'CNML 1.0'),
+                    ('netdiff.OpenvpnParser', 'OpenVPN'),
+                    ('netdiff.WireguardParser', 'Wireguard'),
+                ],
+                help_text='Select topology format',
+                max_length=128,
+                verbose_name='format',
+            ),
+        ),
+    ]
diff --git a/openwisp_network_topology/settings.py b/openwisp_network_topology/settings.py
index 0fe5b4ae..893a105f 100644
--- a/openwisp_network_topology/settings.py
+++ b/openwisp_network_topology/settings.py
@@ -30,6 +30,7 @@ def get_settings_value(option, default):
     ('netdiff.NetJsonParser', 'NetJSON NetworkGraph'),
     ('netdiff.CnmlParser', 'CNML 1.0'),
     ('netdiff.OpenvpnParser', 'OpenVPN'),
+    ('netdiff.WireguardParser', 'Wireguard'),
 ]
 
 PARSERS = DEFAULT_PARSERS + get_settings_value('PARSERS', [])
diff --git a/requirements.txt b/requirements.txt
index a33e017c..08d8d0e1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
 django>=3.0,<4.1
 openwisp-users~=1.0.0
-netdiff~=1.0.0
+netdiff @ https://github.com/openwisp/netdiff/tarball/master
 jsonfield~=3.1.0
 django-flat-json-widget~=0.2.0


Test patch:
diff --git a/tests/openwisp2/sample_network_topology/migrations/0001_initial.py b/tests/openwisp2/sample_network_topology/migrations/0001_initial.py
index 348877c8..16caeb66 100644
--- a/tests/openwisp2/sample_network_topology/migrations/0001_initial.py
+++ b/tests/openwisp2/sample_network_topology/migrations/0001_initial.py
@@ -69,6 +69,7 @@ class Migration(migrations.Migration):
                             ('netdiff.NetJsonParser', 'NetJSON NetworkGraph'),
                             ('netdiff.CnmlParser', 'CNML 1.0'),
                             ('netdiff.OpenvpnParser', 'OpenVPN'),
+                            ('netdiff.WireguardParser', 'Wireguard'),
                         ],
                         help_text='Select topology format',
                         max_length=128,