Ubus » Historial » Revisió 3
Revisió 2 (Roger Pueyo Centelles, 30-05-2014 19:26) → Revisió 3/31 (Roger Pueyo Centelles, 30-05-2014 19:27)
h1. Ubus The [[NCd|Network Characterization daemon]] (NCd) uses "ubus":http://wiki.openwrt.org/doc/techref/ubus (the "OpenWrt":http://www.openwrt.org micro bus architecture) to communicate with the [[NCui|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. h2. NCd ubus namespace and procedures summary h3. Node-related information |_.Path |_.Procedure |_.Signature |_.Description | |\4=. | |ncd.node | [[Ubus#ncdnode-id|id]] | { } | Get the unique id of the local node. | |ncd.node | [[Ubus#ncdnodeneighbours|neighbours]] | { "node" : "id" } | List all the neighbours of a specified node using its unique id. | |ncd.node | [[Ubus#ncdnodename|name]] | { "nodes" : [ "id_1", "id_2", "id_3" ] } | Get the names of the nodes specified with their ids. | |ncd.node | [[Ubus#ncdnodeinfo|info]] | { "node" : "id" } | Get all the device-specific details of a node (hardware, software, interfaces, etc.) | |ncd.node.position | [[Ubus|get]] | { "nodes" : [ "id_1", "id_2", "id_3" ] } | Get the position (latitude and longitude) of the nodes. | |ncd.node.position | [[Ubus|set]] | { "position" : [ "lat", "lon" ] } | Set the position (latitude and longitude) of the node. | |ncd.node | [[Ubus|info]] | { "node" : "id" } | Get all the device-specific details of a node (hardware, software, interfaces, etc.) | h3. Link-related information |_.Path |_.Procedure |_.Signature |_.Description | |\4=. | |ncd.link | link | { "nodes": [ "id_1", "id_2" ] } | Get the details of the link(s) between nodes id_1 and id_2. | | | | | | h2. Usage examples h3. ncd.node.id Request: @ncd.id @ncd.node.id { "node" : "local" }@ Response: @{ @ "id" : "node_id" }@ h3. ncd.node.neighbours Request: @ncd.node.neighbours { "node" : "id" }@ Response: @{ "nodes" : [ "id_1", "id_2", "id_3" ] }@ h3. ncd.node.name Request: @ncd.node.name { "nodes" : [ "id_1", "id_2", "id_3" ] }@ Response: @{ "name" : [ "Name001", "Name002", "Name003" ] }@ h3. ncd.node.info Request: @ncd.node.info { "node" : "id" }@ Response: <pre> { "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" } ] } } } } } } </pre> h2. More examples There is an example of the communication process between the CNAd and the CNAui via ubus [[CNAui-CNAd_communication_example|here]].