Changeset 1b181c6e2f58 in nodewatcher


Ignore:
Timestamp:
09/07/2014 12:52:53 PM (5 years ago)
Author:
kostko
Branches:
Travis-warnings, Update-packages, development, feature/cidr
Children:
19a9b3934bc8
Parents:
abf1aac9f1b3
git-author:
Jernej Kos <jernej@…> (09/07/2014 12:52:53 PM)
git-committer:
Jernej Kos <jernej@…> (09/07/2014 12:52:53 PM)
Message:

Implemented proof of concept topology display. See #736.

Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • nodewatcher/modules/monitor/topology/processors.py

    rabf1aac9f1b3 r1b181c6e2f58  
    33from django_datastream import datastream 
    44 
     5from nodewatcher.core import models as core_models 
    56from nodewatcher.core.monitor import processors as monitor_processors, models as monitor_models 
    67from nodewatcher.modules.monitor.datastream import base as ds_base, fields as ds_fields 
     
    3031    def __init__(self, vertices, edges): 
    3132        self.topology = { 
    32             'v': [{'i': uuid} for uuid in vertices], 
     33            'v': [dict(i=uuid, **attrs) for uuid, attrs in vertices.iteritems()], 
    3334            'e': edges, 
    3435        } 
     
    5354        """ 
    5455 
    55         vertices = set() 
     56        vertices = {} 
    5657        edges = [] 
    5758        for link in monitor_models.TopologyLink.objects.select_related('monitor').all(): 
     
    6061 
    6162            # Add vertex UUIDs 
    62             vertices.add(source_id) 
    63             vertices.add(destination_id) 
     63            vertices[source_id] = {} 
     64            vertices.setdefault(destination_id, {}) 
    6465            # Add edges 
    6566            edge = {'f': source_id, 't': destination_id} 
     
    7071            edges.append(edge) 
    7172 
     73        # Fetch per-node attributes 
     74        NODE_ATTRIBUTES = { 
     75            # Node name 
     76            'n': 'core.general#name', 
     77        } 
     78 
     79        qs = core_models.Node.objects.filter(pk__in=vertices.keys()) 
     80        qs = qs.regpoint('config').registry_fields(**NODE_ATTRIBUTES) 
     81        qs = qs.values(*(['pk'] + NODE_ATTRIBUTES.keys())) 
     82        for node in qs: 
     83            node_id = str(node['pk']) 
     84            del node['pk'] 
     85            vertices[node_id] = node 
     86 
    7287        # Prepare graph for datastream processor 
    7388        context.datastream.topology = TopologyStreamsData(vertices, edges) 
  • nodewatcher/modules/routing/olsr/models.py

    rabf1aac9f1b3 r1b181c6e2f58  
    109109 
    110110        return { 
    111             'lq': self.lq, 
    112             'ilq': self.ilq, 
    113             'etx': self.etx, 
     111            'proto': 'olsr', 
     112            'metrics': { 
     113                'lq': self.lq, 
     114                'ilq': self.ilq, 
     115                'etx': self.etx, 
     116            }, 
    114117        } 
    115118 
  • nodewatcher/settings.py

    rabf1aac9f1b3 r1b181c6e2f58  
    280280    'nodewatcher.modules.frontend.mynodes', 
    281281    'nodewatcher.modules.frontend.statistics', 
     282    'nodewatcher.modules.frontend.topology', 
    282283 
    283284    # Accounts support. 
  • requirements.txt

    rb03aa74b5b3f r1b181c6e2f58  
    1010billiard==3.3.0.17 
    1111celery==3.1.11 
    12 git+https://github.com/wlanslovenija/datastream.git@d886b2b30d2293cfe00445d7a666f6849a29fc9b#egg=datastream-master 
     12git+https://github.com/wlanslovenija/datastream.git@0b95d9495d751ec42a1759c4f234a7b580faf50d#egg=datastream-master 
    1313defusedxml==0.4.1 
    1414django-celery==3.1.10 
    1515django-classy-tags==0.5.1 
    16 git+https://github.com/wlanslovenija/django-datastream.git@d799799f39ddd21d69b0206ab202ed9cabb1ffc6#egg=django_datastream-master 
     16git+https://github.com/wlanslovenija/django-datastream.git@79347949e54ae1ff2e97a05f6589b957bae2eda4#egg=django_datastream-master 
    1717django-guardian==1.2 
    1818git+https://github.com/mitar/django-missing.git@9cf0fd6cfe39bb2cd0b90b3dd37be1b465308ae8#egg=django_missing-master 
Note: See TracChangeset for help on using the changeset viewer.