[Interop-dev] OLSRd2 JSON APIs
Henning Rogge
(spam-protected)
Tue Feb 3 08:41:24 CET 2015
On Mon, Feb 2, 2015 at 6:34 PM, Nemesis <(spam-protected)> wrote:
> Hi Henning,
>
> looking back the discussion we had, I was looking for some examples of
> the JSON objects used in OLSRd2.
OLSRd2 has an internal subsystem called "viewer", that is used by
several plugins to generate "table views" of OLSRd2 internal data
structures... one of the output formats is JSON. You can choose
between human-readable output (with iso-prefixes, rounded to three
fractional digits) and raw output
layer2info (viewer for the layer2 database, mostly information
gathered from nl80211):
- interface: interface specific data
- defaults: interface defaults of neighbor specific data
- neighbor: neighbor specific data
- destinations: proxied mac addresses behind neighbors (used for 802.11s)
nhdpinfo (viewer for HELLO protocol data):
- interface: data about local interface
- if_addr: local addresses of interface
- link: interface specific data about connections to nodes
- link_addr: remote addresses of links
- link_twohop: interface specific data about links of neighbors
- neighbor: (not interface specific) data about connections of nodes
(aggregated link information)o
- neighbor_addr: remote addresses of neighbors
olsrv2info (viewer for OLSRV2 protocol data):
- originator: current originator addresses of local node
- old_originator: former originator addresses (used to detect messages
generated by this node)
- lan: locally attached networks (prefixes that can be reached through
this node)
- node: known olsrv2 routers in the mesh
- attached_network: networks attached to remote nodes ("remote LAN")
- edge: connections between olsrv2 routers
- route: current routing entries
A few examples:
echo /layer2info jsonraw neighbor|nc 127.0.0.1 2009
{
"neighbor": [
{
"if" : "wlan0",
"if_index" : 5,
"if_local_addr" : "00:15:6d:e2:4a:b6",
"neigh_addr" : "00:15:6d:dc:eb:67",
"neigh_lastseen" : 0.271,
"neigh_signal" : "-36",
"neigh_tx_bitrate" : "56623104",
"neigh_rx_bitrate" : "56623104",
"neigh_tx_bytes" : "1567127689",
"neigh_rx_bytes" : "581474303",
"neigh_tx_frames" : "11410950",
"neigh_rx_frames" : "43603326",
"neigh_tx_retries" : "36050",
"neigh_tx_failed" : "0"
},
echo /nhdpinfo json interface |nc 127.0.0.1 2009
{
"interface": [
{
"if" : "eth1",
"if_bindto_v4" : "169.254.1.101",
"if_bindto_v6" : "fe80::dcad:beff:feef:10b",
"if_mac" : "de:ad:be:ef:01:0b",
"if_flooding_v4" : "false",
"if_flooding_v6" : "true",
"if_dualstack_mode" : "IPv6"
},
{
"if" : "lo",
"if_bindto_v4" : "192.168.0.101",
"if_bindto_v6" : "fd00:0:0:100::",
"if_mac" : "00:00:00:00:00:00",
"if_flooding_v4" : "false",
"if_flooding_v6" : "false",
"if_dualstack_mode" : "-"
}
]
}
echo /nhdpinfo json link |nc 127.0.0.1 2009
{
"link": [
{
"if" : "eth1",
"link_bindto" : "169.254.1.102",
"link_vtime_value" : 20,
"link_itime_value" : 2,
"link_symtime" : 19.059,
"link_heardtime" : 19.159,
"link_vtime" : 39.159,
"link_status" : "symmetric",
"link_dualstack" : "fe80::dcad:beff:feef:20b",
"link_mac" : "de:ad:be:ef:02:0b",
"neighbor_originator" : "192.168.0.102",
"neighbor_dualstack" : "fd00:0:0:200::",
"domain" : 0,
"domain_metric" : "ff_dat_metric",
"domain_metric_in" : "1020 bit/s",
"domain_metric_in_raw" : 2105088,
"domain_metric_out" : "1020 bit/s",
"domain_metric_out_raw" : 2105088,
"domain_metric_internal" : "33/33,1
kbit/s(pktsuccess=8/8,missed_hello=0,lastseq=27035)"
},
...
(olsrd2 is multi-topology capable... it can run multiple routing
metrics at the same time and put the results in different routing
tables... "domain" is the internal name for a combination of
metric/mpr/hysteresis because topology was already used ^^)
echo /olsrv2info json node |nc 127.0.0.1 2009
{
"node": [
{
"node" : "192.168.0.102",
"node_ansn" : 64323,
"node_vtime" : 315.664
},
{
"node" : "192.168.0.103",
"node_ansn" : 39499,
"node_vtime" : 316.264
},
...
Does this help?
Henning
More information about the Interop-dev
mailing list