Projecte

General

Perfil

Actions

Ubus » Historial » Revisió 4

« Anterior | Revisió 4/31 (diferencies) | Següent »
Roger Pueyo Centelles, 30-05-2014 20:06


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

Local node information

Path Procedure Signature Description
ncd id { } Get the unique id of the local node.
ncd board { } Get the system information of the local node (model, CPU, OpenWrt version, hostname, kernel version, etc.) ¹
ncd info { } Get the system status of the local node (uptime, load, memory, etc.) ²
ncd.node neighbours { "node" : "id" } List all the neighbours of a specified node using its unique id.
ncd.node.position get { "nodes" : [ "id_1", "id_2", "id_3" ] } Get the position (latitude and longitude) of the nodes.
ncd.node.position set { "position" : [ "lat", "lon" ] } Set the position (latitude and longitude) of the node.
ncd.node info { "node" : "id" } Get all the device-specific details of a node (hardware, software, interfaces, etc.)

¹ It is the same information provided by OpenWrt's system board Ubus call
¹ It is the same information provided by OpenWrt's system info Ubus call

Link-related information

Path Procedure Signature Description
ncd.link link { "nodes": [ "id_1", "id_2" ] } Get the details of the link(s) between nodes id_1 and id_2.

Usage examples

ncd.node.id

Request:

ncd.id { }

Response:

{ "id" : "node_id" }

 

ncd.node.neighbours

Request:

ncd.node.neighbours { "node" : "id" }

Response:

{ "nodes" : [ "id_1", "id_2", "id_3" ] }

 

ncd.node.name

Request:

ncd.node.name { "nodes" : [ "id_1", "id_2", "id_3" ] }

Response:

{ "name" : [ "Name001", "Name002", "Name003" ] }

 

ncd.node.info

Request:

ncd.node.info { "node" : "id" }

Response:

{
  "nodeinfo": {
    "id": "node016",
    "name": "FT-NarrowStreet1616-NSLM5",
    "hardware": {
      "model": "Ubiquiti Nanostation M",
      "type": "Atheros AR7241 rev 1",
      "cpu": "MIPS 24Kc V7.4",
      "ram": "29312" 
    },
    "software": {
      "os": {
        "name": "OpenWrt",
        "version": 12.09,
        "codename": "Attitude Adjustment",
        "date": "2013-09-06",
        "revision": "r38347" 
      },
      "qMp": {
        "version": "3.0-rc3",
        "codename": "Clearance",
        "date": 20140227,
        "revision": "d94713e",
        "branch": "master" 
      },
      "bmx6": {
        "revision": "bae36ab0",
        "version": 12,
        "branch": "master" 
      },
      "ncd": {
        "revision": "36aaed94",
        "version": 0.2,
        "branch": "dev" 
      }
    },
    "interfaces": {
      "physical": {
        "wired": {
          "eth0": {
            "mac": "DC:9F:DB:4F:A1:F6",
            "encap": "Ethernet",
            "mode": "100baseTX",
            "mtu": 1500
          },
          "eth1": {
            "mac": "DE:9F:DB:4F:A1:F6",
            "encap": "Ethernet",
            "mode": "down",
            "mtu": 1500
          }
        },
        "wireless": {
          "radio0": {
            "type": "mac80211",
            "mac": "DC:9F:DB:4E:A1:F6",
            "hwmode": "auto",
            "channel": 124,
            "country": "SP",
            "txpower": 17,
            "distance": 5000,
            "ht": [
              "SHORT-GI-40",
              "RX-STBC1",
              "DSSS_CCK-40" 
            ],
            "interfaces": {
              "wlan0": {
                "device": "radio0",
                "mode": "adhoc",
                "bssid": "02:CA:FF:EE:BA:BE",
                "ssid": "qMp-HWErmitaBellvitge16",
                "encryption": "open",
                "network": "lan",
                "ifname": "wlan0",
                "stations": {
                  "dc:9f:db:34:17:b6": {
                    "signal": [
                      -70,
                      -74,
                      -73
                    ],
                    "avgsignal": [
                      -70,
                      -74,
                      -73
                    ],
                    "txbitrate": "60.0 MBit/s MCS 9 40Mhz short GI",
                    "rxbitrate": "81.0 MBit/s MCS 4 40Mhz" 
                  }
                }
              }
            }
          }
        }
      },
      "virtual": {
        "lo": {
          "type": "loopback",
          "addressing": {
            "ipv4": [
              {
                "ipaddr": "127.0.0.1",
                "netmask": "255.0.0.0" 
              }
            ],
            "ipv6": [
              {
                "ipaddr6": "::1/128",
                "scope": "host" 
              }
            ]
          }
        },
        "br-lan": {
          "type": "bridge",
          "ifname": [
            "eth0" 
          ],
          "addressing": {
            "ipv4": [
              {
                "ipaddr": "10.1.32.33",
                "netmask": "255.255.255.224" 
              },
              {
                "ipaddr": "169.254.246.1",
                "netmask": "255.255.255.248" 
              }
            ],
            "ipv6": [
              {
                "scope": "global",
                "ipaddr6": "fd00:1714:1714:a1f6::1/64" 
              },
              {
                "scope": "link",
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64" 
              }
            ]
          }
        },
        "br-lan.12": {
          "type": "vlan",
          "ifname": [
            "eth0" 
          ],
          "addressing": {
            "ipv6": [
              {
                "scope": "global",
                "ipaddr6": "fd66:66:66:8:de9f:dbff:fe4f:a1f6/64" 
              },
              {
                "scope": "global",
                "ipaddr6": "fd02::dc9f:db4f:a1f6:0:112/128" 
              },
              {
                "scope": "link",
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64" 
              }
            ]
          }
        },
        "wlan0": {
          "type": "wireless",
          "ifname": "radio0",
          "addressing": {
            "ipv4": [
              {
                "ipaddr": "169.254.246.1",
                "netmask": "255.255.255.248" 
              },
              {
                "ipaddr": "10.1.32.33",
                "netmask": "255.255.255.224" 
              }
            ],
            "ipv6": [
              {
                "scope": "link",
                "ipaddr6": "fe80::de9f:dbff:fe4e:a1f6/64" 
              },
              {
                "scope": "global",
                "ipaddr6": "fd00:1714:1714:a1f6::1/64" 
              },
              {
                "scope": "link",
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64" 
              }
            ]
          }
        },
        "wlan0.12": {
          "type": "vlan",
          "ifname": "radio0",
          "addressing": {
            "ipv6": [
              {
                "scope": "link",
                "ipaddr6": "fd66:66:66:a:de9f:dbff:fe4e:a1f6/64" 
              },
              {
                "scope": "global",
                "ipaddr6": "fd02::dc9f:db4f:a1f6:0:212/128" 
              },
              {
                "scope": "link",
                "ipaddr6": "fe80::de9f:dbff:fe4e:a1f6/64" 
              }
            ]
          }
        },
        "bmxtmain": {
          "type": "tunnel6",
          "addressing": {
            "ipv4": [
              {
                "ipaddr": "10.1.32.33",
                "netmask": "255.255.255.224" 
              }
            ],
            "ipv6": [
              {
                "scope": "global",
                "ipaddr6": "2012:0:0:a1f6::1/128" 
              },
              {
                "scope": "link",
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64" 
              }
            ]
          }
        }
      }
    }
  }
}

 

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 · 4 revisions