[Interop-dev] netjson for meshviewer
nemesis
(spam-protected)
Wed Jan 3 18:20:53 CET 2018
I added:
Access-Control-Allow-Origin:*
Access-Control-Allow-Methods:GET, OPTIONS
Let me know if it works.
The fix is only temporary though, because the ansible-role which
manages OpenWISP 2 doesn't support CORS yet:
https://github.com/openwisp/ansible-openwisp2/issues/69
That means at the next update of the instance the configuration added
manually will be deleted, but I hope the feature will be implemented
soon.
Federico
On Sat, 23 Dec 2017 15:37:13 +0100, Moritz Warning
<(spam-protected)> wrote:
> Hi Federico,
>
> I have implemented URL loading now and set up a public test:
> https://mwarning.de/MeshNetSimulator/
>
> But your link you give me gives this error message:
> Cross-Origin Request Blocked: The Same Origin Policy disallows
> reading the remote resource at
>
> https://openwisp.nnxx.ninux.org/api/topology/b079ba15-0009-4d4d-9d61-73b85c6c91f1/?format=json.
> (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
>
> Can you please set "Access-Control-Allow-Origin: *" in the HTTP
> header of the server?
>
> thanks,
> mwarning
>
> On 12/21/2017 04:35 PM, Nemesis wrote:
>> Super cool!
>>
>> Would it be possible to feed to it data from external APIs?
>>
>> For example:
>>
>> https://openwisp.nnxx.ninux.org/api/topology/b079ba15-0009-4d4d-9d61-73b85c6c91f1/
>>
>> To disable the HTML browsable API use this:
>>
>> https://openwisp.nnxx.ninux.org/api/topology/b079ba15-0009-4d4d-9d61-73b85c6c91f1/?format=json
>>
>> This type of backend implementation is open source:
>> https://github.com/netjson/django-netjsongraph
>>
>> Federico
>>
>>
>> On 12/20/2017 12:47 PM, Moritz Warning wrote:
>>> Hey Federico,
>>>
>>> I have implemented NetJSON Network graph support in my project now:
>>> https://github.com/mwarning/MeshNetSimulator
>>>
>>> It is not well tested, but it works for importing and exporting.
>>> The current MeshViewer format is also supported.
>>>
>>> - Moritz
>>>
>>> On 12/11/2017 11:45 AM, Nemesis wrote:
>>>> Hey Moritz,
>>>>
>>>> here's an example, I added some comments although they are not
>>>> valid
>>>> according to the JSON spec, but I added them anyway for
>>>> explaination
>>>> purposes. Keep in mind the spec allows flexibility in placing
>>>> custom
>>>> properties and attributes:
>>>>
>>>> {
>>>> "type": "NetworkGraph",
>>>> "protocol": "batman-adv",
>>>> "version": "batman-adv version here",
>>>> "metric": "tq",
>>>> // custom attributes are allowed
>>>> "timestamp": "2017-09-10T21:15:01",
>>>> "directed": false,
>>>> "multigraph": false,
>>>> "nodes": [
>>>> {
>>>> "id": "62:e3:27:ff:8a:64",
>>>> "node_id": "62e327ff8a64",
>>>> "flags": {
>>>> "gateway": false,
>>>> "online": false
>>>> },
>>>> "properties": {
>>>> "firstseen": "2017-09-04T12:40:29",
>>>> "hardware": {
>>>> "model": "TP-Link TL-WA901N/ND v4"
>>>> },
>>>> "hostname": "FreeHemp1",
>>>> "location": {
>>>> "latitude": 48.396396,
>>>> "longitude": 9.98526335
>>>> },
>>>> "network": {
>>>> "mac": "62:e3:27:ff:8a:64"
>>>> },
>>>> "node_id": "62e327ff8a64",
>>>> "owner": {
>>>> "contact": "(spam-protected)"
>>>> },
>>>> "software": {
>>>> "firmware": {
>>>> "release": "ffulm-0.6.5"
>>>> }
>>>> },
>>>> "system": {
>>>> "role": "node",
>>>> "site_code": "gotham"
>>>> },
>>>> "lastseen": "2017-09-10T05:20:01"
>>>> },
>>>> "statistics": {
>>>> "clients": 0,
>>>> "memory_usage": 0.589754,
>>>> "rootfs_usage": 0.83,
>>>> "uptime": 10487.19
>>>> }
>>>> },
>>>> {
>>>> "id": "ea:de:27:b7:8d:be",
>>>> "node_id": "eade27b78dbe",
>>>> "flags": {
>>>> "gateway": false,
>>>> "online": false
>>>> },
>>>> "properties": {
>>>> "firstseen": "2017-09-04T12:40:29",
>>>> "hardware": {
>>>> "model": "TP-Link TL-WA901N/ND v4"
>>>> },
>>>> "hostname": "FreeHemp2",
>>>> "location": {
>>>> "latitude": 49.396396,
>>>> "longitude": 10.00
>>>> },
>>>> "network": {
>>>> "mac": "ea:de:27:b7:8d:be"
>>>> },
>>>> "node_id": "eade27b78dbe",
>>>> "software": {
>>>> "firmware": {
>>>> "release": "ffulm-0.6.5"
>>>> }
>>>> },
>>>> "system": {
>>>> "role": "node",
>>>> "site_code": "gotham"
>>>> },
>>>> "lastseen": "2017-09-10T05:20:01"
>>>> },
>>>> "statistics": {
>>>> "clients": 0,
>>>> "memory_usage": 0.589754,
>>>> "rootfs_usage": 0.83,
>>>> "uptime": 10487.19
>>>> }
>>>> }
>>>> ],
>>>> "links": [
>>>> {
>>>> "source": "62:e3:27:ff:8a:64",
>>>> "target": "ea:de:27:b7:8d:be",
>>>> "cost": 1.008,
>>>> "properties": {
>>>> "vpn": true
>>>> }
>>>> // vpn may also be here if preferred
>>>> // it depends on implementation details
>>>> "vpn": true
>>>> }
>>>> ]
>>>> }
>>>>
>>>> I suggest you to read the NetworkGraph section of the spec, is
>>>> basically
>>>> just a page and if you read it you will understand the purpose of
>>>> the
>>>> NetworkGraph object:
>>>> http://netjson.org/rfc.html#rfc.section.4
>>>>
>>>> I would really like to rewrite the frontend library
>>>> https://github.com/netjson/netjsongraph.js so it would have some
>>>> of the
>>>> features of meshviwer but we haven't been able to accomplish yet
>>>> and the
>>>> attempt to rewrite it in WebGL did not produce the result we are
>>>> hoped,
>>>> but I will keep insisting in the near future when I get a chance.
>>>>
>>>> Federico
>>>>
>>>>
>>>> On 12/07/2017 01:06 PM, Moritz Warning wrote:
>>>>> Hi,
>>>>>
>>>>> I like to evaluate netjson for a meshviewer implementation.
>>>>> It would be helpful if somebody could tell me how the attached
>>>>> graph.json and nodes.json would look like in netjson.
>>>>>
>>>>> thanks,
>>>>> mwarning
More information about the Interop-dev
mailing list