[Interop-dev] netdiff 0.1 released

Nemesis (spam-protected)
Sat May 2 21:40:14 CEST 2015


Hey,

we just released this very simple experimental python library that we
called "netdiff".

What can you do with it?

Mainly figure out changes to the network topology.
Currently only olsr 0.6.x and batman-advanced are implemented, but
itshould bequite easy to implement other routing protocols.

from netdiff import OlsrParser

from netdiff import diff

from time import sleep

current = OlsrParser('http://127.0.0.1:2006')

# wait 2 minutes
time.sleep(120)

latest = OlsrParser('http://127.0.0.1:2006')

diff(current, latest)

will return something like:

{

    "removed": [

        ["10.150.0.7", "10.150.0.9"]

    ], 

    "added": [

        ["10.150.0.5", "10.150.0.4"]

    ]

}


Another cool thing is to output a NetworkGraph json object, eg:

from netdiff import BatmanParser

from netdiff import diff

batman = BatmanParser('./test/alfred-output.json')

batman.json()


will output:

{

    "type": "NetworkGraph", 

    "protocol": "batman-adv", 

    "version": "2014.3.0", 

    "revision": null, 

    "metric": "TQ", 

    "nodes": [

        {

            "id": "a0:f3:c1:ac:6c:44"

        }, 

        {

            "id": "a0:f3:c1:96:94:06"

        }, 

        {

            "id": "10:fe:ed:37:3a:39"

        }, 

        {

            "id": "00:05:1c:06:35:8e"

        }, 

        {

            "id": "90:f6:52:f2:8c:2c"

        }

    ], 

    "links": [

        {

            "source": "a0:f3:c1:ac:6c:44", 

            "target": "10:fe:ed:37:3a:39", 

            "weight": "1.000"

        }, 

        {

            "source": "a0:f3:c1:96:94:06", 

            "target": "90:f6:52:f2:8c:2c", 

            "weight": "1.000"

        }, 

        {

            "source": "10:fe:ed:37:3a:39", 

            "target": "90:f6:52:f2:8c:2c", 

            "weight": "1.000"

        }, 

        {

            "source": "00:05:1c:06:35:8e", 

            "target": "90:f6:52:f2:8c:2c", 

            "weight": "1.000"

        }

    ]

}


Why we separated this logic into a library?

  * not tied to any particular framework or node-database, it's pure python
  * easy to add more routing protocols, newcomers can work on it more
    easily compared to having to delve into a node-database
  * it's possible to add some nice features that we'll implement in the
    near future thanks to the networkx library:
      o calculating betweenness centrality
      o merge topologies of different nodes of an island into one
        (union), so that if the network gets split up, it is possible to
        draw a complete topology with just the missing link, and not
        just half topology

So.. there's still some hard work to do to integrate this into our
node-db but I hope this experiment succeeds!

We are open for suggestions and improvements.

Federico

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.funkfeuer.at/pipermail/interop-dev/attachments/20150502/c58ce098/attachment.html>


More information about the Interop-dev mailing list