public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] Alfred batadv-vis json conformance
@ 2013-10-01 20:26 Andrew Lunn
  2013-10-02 13:05 ` Simon Wunderlich
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Lunn @ 2013-10-01 20:26 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Janne Paatero

Hi Folks

I will soon need to parse the output of batadv-vis -f json.  However,
its not really, json, it does not pass json validation tools. Hence i
doubt i can use the standard parsing libraries.

There has been discussion similar to this recently, about alfred -r,
and a proposal to change the output to make it json conforming. I
would like to raise the discussion of modifying the vis output from
batadv-vis.

I have a simulation system of four nodes, fully interconnected, with
one double link, but is rather sort of translation table entries. The
current vis output is:

{ "primary" : "02:00:00:00:12:01" }
{ "router" : "02:00:00:00:12:01", "neighbor" : "02:00:00:00:10:01", "label" : "1.000" }
{ "router" : "02:00:00:00:12:01", "neighbor" : "02:00:00:00:13:01", "label" : "1.004" }
{ "router" : "02:00:00:00:12:01", "neighbor" : "02:00:00:00:11:01", "label" : "1.000" }
{ "router" : "02:00:00:00:12:01", "gateway" : "8e:4c:88:c4:76:c5", "label" : "TT" }
{ "primary" : "02:00:00:30:10:01" }
{ "secondary" : "02:00:00:00:10:01", "of" : "02:00:00:30:10:01" }
{ "router" : "02:00:00:30:10:01", "neighbor" : "02:00:00:30:13:01", "label" : "1.000" }
{ "router" : "02:00:00:00:10:01", "neighbor" : "02:00:00:00:12:01", "label" : "1.000" }
{ "router" : "02:00:00:00:10:01", "neighbor" : "02:00:00:00:13:01", "label" : "1.000" }
{ "router" : "02:00:00:00:10:01", "neighbor" : "02:00:00:00:11:01", "label" : "1.000" }
{ "router" : "02:00:00:30:10:01", "gateway" : "f6:00:48:13:d3:1e", "label" : "TT" }
{ "primary" : "02:00:00:00:11:01" }
{ "router" : "02:00:00:00:11:01", "neighbor" : "02:00:00:00:10:01", "label" : "1.000" }
{ "router" : "02:00:00:00:11:01", "neighbor" : "02:00:00:00:12:01", "label" : "1.000" }
{ "router" : "02:00:00:00:11:01", "neighbor" : "02:00:00:00:13:01", "label" : "1.000" }
{ "router" : "02:00:00:00:11:01", "gateway" : "ee:be:f3:0f:26:66", "label" : "TT" }
{ "primary" : "02:00:00:00:13:01" }
{ "secondary" : "02:00:00:30:13:01", "of" : "02:00:00:00:13:01" }
{ "router" : "02:00:00:00:13:01", "neighbor" : "02:00:00:00:10:01", "label" : "1.000" }
{ "router" : "02:00:00:00:13:01", "neighbor" : "02:00:00:00:12:01", "label" : "1.000" }
{ "router" : "02:00:00:30:13:01", "neighbor" : "02:00:00:30:10:01", "label" : "1.016" }
{ "router" : "02:00:00:00:13:01", "neighbor" : "02:00:00:00:11:01", "label" : "1.000" }
{ "router" : "02:00:00:00:13:01", "gateway" : "8e:4c:77:b3:65:b4", "label" : "TT" }

My first suggestion for a conforming output would be:  

[
  { "primary" : "02:00:00:00:12:01", 
    "neighbors" : [
        { "router" : "02:00:00:00:12:01", "neighbor" : "02:00:00:00:10:01", "label" : "1.000" },
        { "router" : "02:00:00:00:12:01", "neighbor" : "02:00:00:00:13:01", "label" : "1.004" },
        { "router" : "02:00:00:00:12:01", "neighbor" : "02:00:00:00:11:01", "label" : "1.000" }
    ],
    "TT" : [
      { "router" : "02:00:00:00:12:01", "gateway" : "8e:4c:88:c4:76:c5" }
    ]
  },
  { "primary" : "02:00:00:30:10:01",
    "secondary" : [
       "02:00:00:00:10:01"
    ],
    "neighbors" : [
      { "router" : "02:00:00:30:10:01", "neighbor" : "02:00:00:30:13:01", "label" : "1.000" },
      { "router" : "02:00:00:00:10:01", "neighbor" : "02:00:00:00:12:01", "label" : "1.000" },
      { "router" : "02:00:00:00:10:01", "neighbor" : "02:00:00:00:13:01", "label" : "1.000" },
      { "router" : "02:00:00:00:10:01", "neighbor" : "02:00:00:00:11:01", "label" : "1.000" }
    ],
    "TT" : [
      { "router" : "02:00:00:30:10:01", "gateway" : "f6:00:48:13:d3:1e" }
    ]
  },
  { "primary" : "02:00:00:00:11:01",
    "neighbors" : [
      { "router" : "02:00:00:00:11:01", "neighbor" : "02:00:00:00:10:01", "label" : "1.000" },
      { "router" : "02:00:00:00:11:01", "neighbor" : "02:00:00:00:12:01", "label" : "1.000" },
      { "router" : "02:00:00:00:11:01", "neighbor" : "02:00:00:00:13:01", "label" : "1.000" }
    ],
    "TT" : [
      { "router" : "02:00:00:00:11:01", "gateway" : "ee:be:f3:0f:26:66" }
    ]
  },
  { "primary" : "02:00:00:00:13:01",
    "secondary" : [ 
      "02:00:00:30:13:01"
    ],
    "neighbors" : [
       { "router" : "02:00:00:00:13:01", "neighbor" : "02:00:00:00:10:01", "label" : "1.000" },
       { "router" : "02:00:00:00:13:01", "neighbor" : "02:00:00:00:12:01", "label" : "1.000" },
       { "router" : "02:00:00:30:13:01", "neighbor" : "02:00:00:30:10:01", "label" : "1.016" },
       { "router" : "02:00:00:00:13:01", "neighbor" : "02:00:00:00:11:01", "label" : "1.000" }
    ],
    "TT" : [
       { "router" : "02:00:00:00:13:01", "gateway" : "8e:4c:77:b3:65:b4" }
    ]
  }
]

I'm also wondering if label and gateway could have more meaningful
names? TQ and host? Also, is TT the best?

I would like suggestions and comments from others with more experience
with json. Is the basic structure O.K. Are there better names to use?

There is also the issue of can we change the format of the current
output. Is it considered an ABI? Should I add a third format string
which can be passed with -f to produce true json, and leave the old
format as is, for backward compatibility?

Thanks
	Andrew

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-10-07  9:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01 20:26 [B.A.T.M.A.N.] Alfred batadv-vis json conformance Andrew Lunn
2013-10-02 13:05 ` Simon Wunderlich
2013-10-02 13:36   ` Andrew Lunn
2013-10-06  8:35     ` Nicolás Echániz
2013-10-07  9:00       ` Andrew Lunn
2013-10-02 16:01   ` Antonio Quartulli
2013-10-03  6:09     ` Martin Hundebøll
2013-10-03  8:11       ` Andrew Lunn
2013-10-03  8:22         ` Antonio Quartulli
2013-10-03  8:53           ` Andrew Lunn
2013-10-03  9:00             ` Antonio Quartulli
2013-10-03  9:05               ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox