Projecte

General

Perfil

Ubus » Historial » Versió 3

Roger Pueyo Centelles, 30-05-2014 19:27

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