[Interop-dev] django-netjsongraph add properties

Nemesis (spam-protected)
Fri Apr 29 15:16:50 CEST 2016


At the moment the only way you can solve your need it to use django signals:
https://github.com/interop-dev/django-netjsongraph#netjsongraph_signals

You can write a python file in which you define the action to perform
each time a link is saved.
In that action you check the geographic coordinates, calculate the
distance and save it.

I'm using django-signal to fill node information from a whois service:
https://gist.github.com/nemesisdesign/c1d7cb31831461b61ec0

You have to do something similar, but you'll have to use the Link model
instead of the Node model.
Refer to django-signals documentation for more information:
https://docs.djangoproject.com/en/1.9/topics/signals/

Federico


On 04/29/2016 02:32 PM, (spam-protected) wrote:
> Hi Federico,
> 
> Yes, now I can add any filed in properties.
> 
> I am back to my question about put in properties information on XY
> coordinates.
> 
> When we click on green line links we have in right top cornet
> information for example:
> 
> ================================
> 
> source: SP2IAZ
> 
> target: SP2MSF
> 
> cost: 1
> 
> status: up
> 
> neighbor link quality: 1
> 
> link quality: 0.874
> 
> created: 2016-04-28T15:38:34.517Z
> 
> modified: 2016-04-29T12:20:03.972Z
> 
> ============================
> 
> When we put XY coordinates in properties for example:
> 
> lat: 53.12345
> 
> lon: 18.12345
> 
> it will be nice to have additional information about distance between
> nodes for this link for example:
> 
> ===================
> 
> source: SP2IAZ
> 
> target: SP2MSF
> 
> distance 3.6 km
> 
> cost: 1
> 
> status: up
> 
> neighbor link quality: 1
> 
> link quality: 0.874
> 
> created: 2016-04-28T15:38:34.517Z
> 
> modified: 2016-04-29T12:20:03.972Z
> 
> ==========================================
> 
> it will be useful information haw far are the nodes in the selected link
> 
> But this must be calculated by django-netjsongraph framework if find
> information about lat/lon in properties links
> 
> Bets regards
> 
> 
> 2016-04-29 10:51 GMT+02:00 Nemesis <(spam-protected)
> <mailto:(spam-protected)>>:
> 
> 
>     Use instead:
> 
>     {
>         "hardware": "Nanostation M2"
>     }
> 
>     A visual editor like the one I'm using on django-netjsonconfig [1] would
>     surely prevent to do these mistakes, hopefully in the near future I'll
>     add something similar.
> 




More information about the Interop-dev mailing list