Ubus » Historial » Revisió 11
« Anterior |
Revisió 11/31
(diferencies)
| Següent »
Roger Pueyo Centelles, 03-06-2014 14:27
Ubus¶
The Network Characterization daemon (NCd) uses Ubus (the OpenWrt micro bus architecture) to communicate with the Network Characterization user interface and with other daemons and applications. This page documents the ubus namespace of the NC, with the available procedures and several examples.
NCd ubus namespace and procedures summary¶
NC-specific local node information¶
The NCd, once registered to the Ubus daemon, provides the following procedures.
Path | Procedure | Signature | Description |
---|---|---|---|
ncd.local | id | { } | Get the unique id of the local node |
ncd.local | neighbours | { } | List all the neighbours of the local node |
ncd.local | linkdevices | { "nodes": ["nodeid1", "nodeid2", ...] } | List the devices used to link the local node to other nodes ¹ |
ncd.local.location.name | ncd-local-location-name-get | { } | Get the position (name or description) where the node is located |
ncd.local.location.name | ncd-local-location-name-set | { "location" : "string" } | Get the position (name or description) where the node is located |
ncd.local.location.coordinates | ncd-local-location-coordinates-get | { } | Get the position (latitude and longitude coordinates) where the node is located |
ncd.local.location.coordinates | ncd-local-location-coordinates-set | { "coordinates" : [ "lat", "lon" ] } | Set the position (latitude and longitude coordinates) where the node is located |
¹ Two nodes can be linked via two different devices (a wired and a wireless device, two wireless devices at different frequencies, etc.)
Ubus local relay¶
The NCd is able to relay Ubus calls from the NCui to other Ubus instances registered locally (like netifd, rpcd, etc.).
Path | Procedure | Signature | Description |
---|---|---|---|
ncd.local.relay.daemon.path | procedure | { "daemon.path procedure signature" } | Get the unique id of the local node |
See the example below to get a clear idea of how it works.
NC-specific remote node information¶
The NCd can provide the following procedures regarding other nodes in the network running the NCd:
Path | Procedure | Signature | Description |
---|---|---|---|
ncd.nodeid ² | neighbours | { } | List all the neighbours of the node defined by nodeid |
ncd.nodeid | linkdevices | { "nodes": ["nodeid1", "nodeid2", ...] } | List the devices used to link the node defined by nodeid to other nodes |
ncd.nodeid.location.name | get | { } | Get the position (name or description) where the node defined by nodeid is located |
ncd.nodeid.location.name | get | { "location" : "Location name or description" } | Get the position (name or description) where the node defined by nodeid is located |
ncd.nodeid.location.coordinates | get | { } | Get the position (latitude and longitude coordinates) where the node defined by nodeid is located |
ncd.nodeid.location.coordinates | set | { "coordinates" : [ "lat", "lon" ] } | Set the position (latitude and longitude coordinates) where the node defined by nodeid is located |
² Replace nodeid by the node's unique id
Ubus remote relay¶
The NCd is able to relay Ubus calls from the NCui to other Ubus instances registered remotely (like netifd, rpcd, etc.).
Path | Procedure | Signature | Description |
---|---|---|---|
ncd.nodeid.relay.daemon.path ² | procedure | { "daemon.path procedure signature" } | Get the unique id of the node defined by nodeid |
² Replace nodeid by the node's unique id
Usage examples¶
ncd local id¶
Request:
ubus call ncd.local id { }
Response:
{ "id" : "node_id" }
ncd local neighbours¶
Request:
ubus call ncd.local neighbours { }
Response:
{ "nodes" : [ "node011", "node400" ] }
ncd local link devices¶
Request:
ubus call ncd.local linkdevices { "nodes" : [ "node011", "node400" ] }
Response:
{ "links": [ { "node011": [ "eth0.12", "wlan0" ] }, { "node400": [ "wlan0" ] } ] }
ncd local location name get¶
Request:
ubus call ncd.local.location.name get { }
Response:
{ "coordinates" : [ "Narrow Street 16, Faketown" ] }
ncd local position coordinates get¶
Request:
ubus call ncd.local.location.coordinates get { }
Response:
{ "coordinates" : [ "42.34796", "3.11036" ] }
ncd local position name set¶
Request:
ubus call ncd.local.location.name set { "name" : [ "Narrow Street 16, Faketown (rooftop)" }
Response:
{ ] }
ncd local position coordinates set¶
Request:
ubus call ncd.local.position.coordinates set { "coordinates" : [ "42.34796", "3.11036" ] }
Response:
{ }
ncd local ubus relay¶
Request:
ubus call ncd.local.relay.iwinfo devices { }
Response:
{ "devices": [ "wlan1", "wlan0", "wlan0ap" ] }
ubus call iwinfo devices
More examples¶
There is an example of the communication process between the CNAd and the CNAui via ubus here.
Actualitzat per Roger Pueyo Centelles fa més de 10 anys · 11 revisions