Projecte

General

Perfil

Ubus » Historial » Versió 4

Roger Pueyo Centelles, 30-05-2014 20:06

1 1 Roger Pueyo Centelles
h1. Ubus
2
3
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.
4
5
h2. NCd ubus namespace and procedures summary
6
7 4 Roger Pueyo Centelles
h3. Local node information
8 1 Roger Pueyo Centelles
9 4 Roger Pueyo Centelles
|_.Path                       |_.Procedure                                      |_.Signature                                      |_.Description |
10 1 Roger Pueyo Centelles
|\4=. |
11 4 Roger Pueyo Centelles
|ncd                          | [[Ubus#ncd-id|id]]                              | { }                                             | Get the unique id of the local node. |
12
|ncd                          | [[Ubus#ncd-board|board]]                        | { }                                             | Get the system information of the local node (model, CPU, OpenWrt version, hostname, kernel version, etc.) ¹|
13
|ncd                          | [[Ubus#ncd-info|info]]                          | { }                                             | Get the system status of the local node (uptime, load, memory, etc.) ²|
14
15 1 Roger Pueyo Centelles
|ncd.node                     | [[Ubus#ncdnodeneighbours|neighbours]]           | { "node" : "id" }                               | List all the neighbours of a specified node using its unique id. |
16 4 Roger Pueyo Centelles
17 1 Roger Pueyo Centelles
|ncd.node.position            | [[Ubus|get]]                                    | { "nodes" : [ "id_1", "id_2", "id_3" ] }        | Get the position (latitude and longitude) of the nodes. |
18
|ncd.node.position            | [[Ubus|set]]                                    | { "position" : [ "lat", "lon" ] }               | Set the position (latitude and longitude) of the node. |
19
|ncd.node                     | [[Ubus|info]]                                   | { "node" : "id" }                               | Get all the device-specific details of a node (hardware, software, interfaces, etc.) |
20 4 Roger Pueyo Centelles
21
¹ It is the same information provided by OpenWrt's _system board_ Ubus call
22
¹ It is the same information provided by OpenWrt's _system info_ Ubus call
23 1 Roger Pueyo Centelles
24
h3. Link-related information
25
26
|_.Path                        |_.Procedure                   |_.Signature                                      |_.Description |
27
|\4=. |
28
|ncd.link                      | link                         | {  "nodes": [ "id_1", "id_2" ] }                | Get the details of the link(s) between nodes id_1 and id_2. |
29
|                              |                              |                                                 |                               |
30
31
h2. Usage examples
32
33
h3. ncd.node.id
34
35
Request:
36 3 Roger Pueyo Centelles
 
37 1 Roger Pueyo Centelles
 @ncd.id { }@
38
39
Response:
40 3 Roger Pueyo Centelles
41 1 Roger Pueyo Centelles
 @{ "id" : "node_id" }@
42
43
 
44
45
h3. ncd.node.neighbours
46
47
Request:
48
 
49
 @ncd.node.neighbours { "node" : "id" }@
50
51
Response:
52
53
 @{ "nodes" : [ "id_1", "id_2", "id_3" ] }@
54
55
 
56
57
58
59
h3. ncd.node.name
60
61
Request:
62
 
63
 @ncd.node.name { "nodes" : [ "id_1", "id_2", "id_3" ] }@
64
65
Response:
66
67
 @{ "name" : [ "Name001", "Name002", "Name003" ] }@
68
69
 
70
71
72
73
h3. ncd.node.info
74
75
Request:
76
 
77
 @ncd.node.info { "node" : "id" }@
78
79
Response:
80
81
<pre>
82
{
83
  "nodeinfo": {
84
    "id": "node016",
85
    "name": "FT-NarrowStreet1616-NSLM5",
86
    "hardware": {
87
      "model": "Ubiquiti Nanostation M",
88
      "type": "Atheros AR7241 rev 1",
89
      "cpu": "MIPS 24Kc V7.4",
90
      "ram": "29312"
91
    },
92
    "software": {
93
      "os": {
94
        "name": "OpenWrt",
95
        "version": 12.09,
96
        "codename": "Attitude Adjustment",
97
        "date": "2013-09-06",
98
        "revision": "r38347"
99
      },
100
      "qMp": {
101
        "version": "3.0-rc3",
102
        "codename": "Clearance",
103
        "date": 20140227,
104
        "revision": "d94713e",
105
        "branch": "master"
106
      },
107
      "bmx6": {
108
        "revision": "bae36ab0",
109
        "version": 12,
110
        "branch": "master"
111
      },
112
      "ncd": {
113
        "revision": "36aaed94",
114
        "version": 0.2,
115
        "branch": "dev"
116
      }
117
    },
118
    "interfaces": {
119
      "physical": {
120
        "wired": {
121
          "eth0": {
122
            "mac": "DC:9F:DB:4F:A1:F6",
123
            "encap": "Ethernet",
124
            "mode": "100baseTX",
125
            "mtu": 1500
126
          },
127
          "eth1": {
128
            "mac": "DE:9F:DB:4F:A1:F6",
129
            "encap": "Ethernet",
130
            "mode": "down",
131
            "mtu": 1500
132
          }
133
        },
134
        "wireless": {
135
          "radio0": {
136
            "type": "mac80211",
137
            "mac": "DC:9F:DB:4E:A1:F6",
138
            "hwmode": "auto",
139
            "channel": 124,
140
            "country": "SP",
141
            "txpower": 17,
142
            "distance": 5000,
143
            "ht": [
144
              "SHORT-GI-40",
145
              "RX-STBC1",
146
              "DSSS_CCK-40"
147
            ],
148
            "interfaces": {
149
              "wlan0": {
150
                "device": "radio0",
151
                "mode": "adhoc",
152
                "bssid": "02:CA:FF:EE:BA:BE",
153
                "ssid": "qMp-HWErmitaBellvitge16",
154
                "encryption": "open",
155
                "network": "lan",
156
                "ifname": "wlan0",
157
                "stations": {
158
                  "dc:9f:db:34:17:b6": {
159
                    "signal": [
160
                      -70,
161
                      -74,
162
                      -73
163
                    ],
164
                    "avgsignal": [
165
                      -70,
166
                      -74,
167
                      -73
168
                    ],
169
                    "txbitrate": "60.0 MBit/s MCS 9 40Mhz short GI",
170
                    "rxbitrate": "81.0 MBit/s MCS 4 40Mhz"
171
                  }
172
                }
173
              }
174
            }
175
          }
176
        }
177
      },
178
      "virtual": {
179
        "lo": {
180
          "type": "loopback",
181
          "addressing": {
182
            "ipv4": [
183
              {
184
                "ipaddr": "127.0.0.1",
185
                "netmask": "255.0.0.0"
186
              }
187
            ],
188
            "ipv6": [
189
              {
190
                "ipaddr6": "::1/128",
191
                "scope": "host"
192
              }
193
            ]
194
          }
195
        },
196
        "br-lan": {
197
          "type": "bridge",
198
          "ifname": [
199
            "eth0"
200
          ],
201
          "addressing": {
202
            "ipv4": [
203
              {
204
                "ipaddr": "10.1.32.33",
205
                "netmask": "255.255.255.224"
206
              },
207
              {
208
                "ipaddr": "169.254.246.1",
209
                "netmask": "255.255.255.248"
210
              }
211
            ],
212
            "ipv6": [
213
              {
214
                "scope": "global",
215
                "ipaddr6": "fd00:1714:1714:a1f6::1/64"
216
              },
217
              {
218
                "scope": "link",
219
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64"
220
              }
221
            ]
222
          }
223
        },
224
        "br-lan.12": {
225
          "type": "vlan",
226
          "ifname": [
227
            "eth0"
228
          ],
229
          "addressing": {
230
            "ipv6": [
231
              {
232
                "scope": "global",
233
                "ipaddr6": "fd66:66:66:8:de9f:dbff:fe4f:a1f6/64"
234
              },
235
              {
236
                "scope": "global",
237
                "ipaddr6": "fd02::dc9f:db4f:a1f6:0:112/128"
238
              },
239
              {
240
                "scope": "link",
241
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64"
242
              }
243
            ]
244
          }
245
        },
246
        "wlan0": {
247
          "type": "wireless",
248
          "ifname": "radio0",
249
          "addressing": {
250
            "ipv4": [
251
              {
252
                "ipaddr": "169.254.246.1",
253
                "netmask": "255.255.255.248"
254
              },
255
              {
256
                "ipaddr": "10.1.32.33",
257
                "netmask": "255.255.255.224"
258
              }
259
            ],
260
            "ipv6": [
261
              {
262
                "scope": "link",
263
                "ipaddr6": "fe80::de9f:dbff:fe4e:a1f6/64"
264
              },
265
              {
266
                "scope": "global",
267
                "ipaddr6": "fd00:1714:1714:a1f6::1/64"
268
              },
269
              {
270
                "scope": "link",
271
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64"
272
              }
273
            ]
274
          }
275
        },
276
        "wlan0.12": {
277
          "type": "vlan",
278
          "ifname": "radio0",
279
          "addressing": {
280
            "ipv6": [
281
              {
282
                "scope": "link",
283
                "ipaddr6": "fd66:66:66:a:de9f:dbff:fe4e:a1f6/64"
284
              },
285
              {
286
                "scope": "global",
287
                "ipaddr6": "fd02::dc9f:db4f:a1f6:0:212/128"
288
              },
289
              {
290
                "scope": "link",
291
                "ipaddr6": "fe80::de9f:dbff:fe4e:a1f6/64"
292
              }
293
            ]
294
          }
295
        },
296
        "bmxtmain": {
297
          "type": "tunnel6",
298
          "addressing": {
299
            "ipv4": [
300
              {
301
                "ipaddr": "10.1.32.33",
302
                "netmask": "255.255.255.224"
303
              }
304
            ],
305
            "ipv6": [
306
              {
307
                "scope": "global",
308
                "ipaddr6": "2012:0:0:a1f6::1/128"
309
              },
310
              {
311
                "scope": "link",
312
                "ipaddr6": "fe80::de9f:dbff:fe4f:a1f6/64"
313
              }
314
            ]
315
          }
316
        }
317
      }
318
    }
319
  }
320
}
321
</pre>
322
323
&nbsp;
324
325
326
327
328
329
330
h2. More examples
331
332
There is an example of the communication process between the CNAd and the CNAui via ubus [[CNAui-CNAd_communication_example|here]].