Skip to contentSkip to conversation

Suggestions to get extended jsondoc alfred output

B.A.T.M.A.N. Germano Massullo 2 participants 6 messages Sep 28, 2015 – Sep 29, 2015

lore
Share & tools
lore
#0 lore raw

I created three Fedora virtual machines to get some alfred jsondoc format output. I followed [1] and [2] but I edited some commands because virtual machines obviously do not own wireless network interfaces. Since it is the first time I use batman+alfred I want to show you the entire list of commands (that have been runned on all the virtual machines.) I used before asking my question

# ip link set dev enp0s3 mtu 1532
# batctl if add enp0s3
# ip link set bat0 up
# alfred -i enp0s3 -m

The # ip addr of all virtual machines is [3]
Then I opened a new console

# cat /etc/hostname | alfred -s 65
# alfred -r 65
then I got [4] as the Examples paragraph [2] suggested
# batadv-vis --format=jsondoc
and I got [5]

Question: do you have any suggestion how I can extend the jsondoc output, to get an output similar to [6]?

Thank you for your time

[1] http://www.open-mesh.org/projects/batman-adv/wiki/Quick-start-guide
[2] http://downloads.open-mesh.org/batman/manpages/alfred.8.html
[3] http://i.imgur.com/IR9pSJg.jpg
[4] http://i.imgur.com/hEP4oV7.jpg
[5] http://i.imgur.com/Tb1hRHl.jpg
[6]
https://github.com/ninuxorg/netdiff/blob/master/tests/static/batman-1%2B1.json

#1 lore raw
Quoted 12 lines · On Monday 28 September 2015 18:56:11 Germano Massullo wrote:

I created three Fedora virtual machines to get some alfred jsondoc format output. I followed [1] and [2] but I edited some commands because virtual machines obviously do not own wireless network interfaces. Since it is the first time I use batman+alfred I want to show you the entire list of commands (that have been runned on all the virtual machines.) I used before asking my question

# ip link set dev enp0s3 mtu 1532
# batctl if add enp0s3
# ip link set bat0 up
# alfred -i enp0s3 -m
Quoted 6 lines

The # ip addr of all virtual machines is [3]
Then I opened a new console

# cat /etc/hostname | alfred -s 65
# alfred -r 65
then I got [4] as the Examples paragraph [2] suggested

Yup this looks good. :)

Quoted 2 lines
# batadv-vis --format=jsondoc
and I got [5]

This looks kind of incomplete - there are no neighbor information at all.

Quoted 3 lines

Question: do you have any suggestion how I can extend the jsondoc output, to get an output similar to [6]?

I'd suggest to create a new output type (maybe call it netjson?) next to the existing ones. If you look in the source code [1] You'll find a couple of hooks which are prepared exactly for this purpose.

Thanks!
Simon

[1] http://git.open-mesh.org/alfred.git/blob/HEAD:/vis/vis.c#l724

Quoted 12 lines

Thank you for your time

[1] http://www.open-mesh.org/projects/batman-adv/wiki/Quick-start-guide
[2] http://downloads.open-mesh.org/batman/manpages/alfred.8.html
[3] http://i.imgur.com/IR9pSJg.jpg
[4] http://i.imgur.com/hEP4oV7.jpg
[5] http://i.imgur.com/Tb1hRHl.jpg
[6]
https://github.com/ninuxorg/netdiff/blob/master/tests/static/batman-1%2B1.js
on

#2 lore raw

Il 28/09/2015 19:35, Simon Wunderlich ha scritto:

Quoted 4 lines
Quoted 3 lines
# batadv-vis --format=jsondoc
and I got [5]

This looks kind of incomplete - there are no neighbor information at all.

I would like to debug this thing. Virtual machines firewall have been deactivated. I don't understand why

# alfred -r 65
returns a correct output about the three nodes and instead the jsondoc
output only mentions one node...
Quoted 10 lines
Quoted 2 lines

Question: do you have any suggestion how I can extend the jsondoc output, to get an output similar to [6]?

I'd suggest to create a new output type (maybe call it netjson?) next to the existing ones. If you look in the source code [1] You'll find a couple of hooks which are prepared exactly for this purpose.

Thanks!
Simon

[1] http://git.open-mesh.org/alfred.git/blob/HEAD:/vis/vis.c#l724

Thank you, I will check it.

#3 lore raw
Quoted 11 lines · On Monday 28 September 2015 23:10:44 Germano Massullo wrote:

Il 28/09/2015 19:35, Simon Wunderlich ha scritto:

Quoted 4 lines
Quoted 2 lines
# batadv-vis --format=jsondoc
and I got [5]

This looks kind of incomplete - there are no neighbor information at all.

I would like to debug this thing. Virtual machines firewall have been deactivated. I don't understand why

# alfred -r 65
returns a correct output about the three nodes and instead the jsondoc
output only mentions one node...

batadv-vis is also a daemon which must run in background to collect data from batman-adv and push it (periodically) into alfred. Maybe you are not running it but only used the client part to query?

Cheers,
Simon

#4 lore raw

Il 29/09/2015 01:24, Simon Wunderlich ha scritto:

Quoted 3 lines

batadv-vis is also a daemon which must run in background to collect data from batman-adv and push it (periodically) into alfred. Maybe you are not running it but only used the client part to query? Cheers, Simon

Yeah that was the problem, thank you very much!
I attach again the whole and fixed procedure I followed, hoping that it can be useful to other people. At the end of the e-mail you can find also the jsondoc output I got.

1) Install a Fedora VirtualBox virtual machine;
2) In the virtual machine VirtualBox settings, set the network interface in bridge mode;
3) Clone two times the virtual machine, enabling the "re-initialise MAC addresses" option;
4) Start them and then run the following commands on each of them:

Maybe not required, but to avoid all possible problems, I also
disabled the firewall

    # systemctl disable firewalld; systemctl stop firewalld
    # dnf -y install batctl
    then download and install alfred from git source code (certain
guides show alfredadv-vis , I instead got batadv-vis)
    # ip link set dev enp0s3 mtu 1532
    # batctl if add enp0s3
    # ip link set bat0 up
    # alfred -i enp0s3 -m

Then I opened a new console (tty2)
# cat /etc/hostname | alfred -s 65
# batadv-vis -s

Then I opened a new console (tty3)
# cat /etc/hostname | alfred -s 65
# alfred -r 65 (note: this one will show the info sent from the
three nodes only if you entered the previous command on all the VMs)

    # batadv-vis --format=jsondoc

And here we go!

{
"source_version" : "2015.1-2-g4384c2b",
"algorithm" : 4,
"vis" : [

    { "primary" : "08:00:27:8f:b1:c2",
      "neighbors" : [
         { "router" : "08:00:27:8f:b1:c2",
           "neighbor" : "08:00:27:a9:8d:af",
           "metric" : "1.000" },
         { "router" : "08:00:27:8f:b1:c2",
           "neighbor" : "08:00:27:83:e5:59",
           "metric" : "1.000" }
      ],
      "clients" : [
        "33:33:00:00:00:01",
        "33:33:ff:f4:13:fb",
        "d6:ba:c2:f4:13:fb",
        "01:00:5e:00:00:01"
      ]
    },
    { "primary" : "08:00:27:83:e5:59",
      "neighbors" : [
         { "router" : "08:00:27:83:e5:59",
           "neighbor" : "08:00:27:a9:8d:af",
           "metric" : "1.000" },
         { "router" : "08:00:27:83:e5:59",
           "neighbor" : "08:00:27:8f:b1:c2",
           "metric" : "1.016" }
      ],
      "clients" : [
        "1a:7c:e9:74:cc:47",
        "33:33:00:00:00:01",
        "33:33:ff:74:cc:47",
        "01:00:5e:00:00:01"
      ]
    },
    { "primary" : "08:00:27:a9:8d:af",
      "neighbors" : [
         { "router" : "08:00:27:a9:8d:af",
           "neighbor" : "08:00:27:8f:b1:c2",
           "metric" : "1.000" },
         { "router" : "08:00:27:a9:8d:af",
           "neighbor" : "08:00:27:83:e5:59",
           "metric" : "1.004" }
      ],
      "clients" : [
        "4e:ae:15:0e:ba:a2",
        "33:33:00:00:00:01",
        "01:00:5e:00:00:01",
        "33:33:ff:0e:ba:a2"
      ]
    }

]
}

#5 lore raw

Errata corrige: change
Then I opened a new console (tty3)
# cat /etc/hostname | alfred -s 65

in
Then I opened a new console (tty3)