Projecte

General

Perfil

Actions

Ubus » Historial » Revisió 10

« Anterior | Revisió 10/31 (diferencies) | Següent »
Roger Pueyo Centelles, 02-06-2014 17:36


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.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

 

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.local.location.name get { } Get the position (name or description) where the node defined by nodeid is located
ncd.local.location.name get { "location" : "Location name or description" } Get the position (name or description) where the node defined by nodeid is located
ncd.local.location.coordinates get { } Get the position (latitude and longitude coordinates) where the node defined by nodeid is located
ncd.local.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 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 · 10 revisions