Skip to content

Commit

Permalink
[change] Added celerybeat task for creating mesh topology
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy committed May 12, 2023
1 parent 25aeeb1 commit ca6136b
Show file tree
Hide file tree
Showing 7 changed files with 282 additions and 281 deletions.
22 changes: 22 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,28 @@ In order to use this module simply add
'rest_framework',
]
If you have enabled WiFI Mesh integration, you will also need to update the
``CELERY_BEAT_SCHEDULE`` as follow:

.. code-block:: python
CELERY_BEAT_SCHEDULE = {
'create_mesh_topology': {
# This task generates the mesh topology from monitoring data
'task': 'openwisp_network_topology.integrations.device.tasks.create_mesh_topology',
# Execute this task every 5 minutes
'schedule': timedelta(minutes=5),
# List of organization UUIDs. The mesh topology will be
# created only for devices belonging these organizations.
'args': (
[
'4e002f97-eb01-4371-a4a8-857faa22fe5c',
'be88d4c4-599a-4ca2-a1c0-3839b4fdc315'
],
),
},
}
If you are enabling this integration on a pre-existing system, use the
`create_device_nodes <#create-device-nodes>`_ management command to create
the relationship between devices and nodes.
Expand Down
10 changes: 0 additions & 10 deletions openwisp_network_topology/integrations/device/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from django.db import transaction
from django.db.models.signals import post_save
from django.utils.translation import gettext_lazy as _
from openwisp_monitoring.device.signals import device_metrics_received

from ...utils import link_status_changed
from . import settings as app_settings
from .tasks import create_device_node_relation, trigger_device_updates


Expand All @@ -33,14 +31,6 @@ def connect_signals(self):
sender=Link,
dispatch_uid='controller_integration_link_status_chaged',
)
if app_settings.WIFI_MESH_INTEGRATION:
WifiMesh = swapper.load_model('topology_device', 'WifiMesh')
DeviceData = swapper.load_model('device_monitoring', 'DeviceData')
device_metrics_received.connect(
WifiMesh.create_wifi_mesh_topology_receiver,
sender=DeviceData,
dispatch_uid='create_wifi_mesh_topology',
)

@classmethod
def create_device_rel(cls, instance, created, **kwargs):
Expand Down
Loading

0 comments on commit ca6136b

Please sign in to comment.