/
common-api.txt
406 lines (285 loc) · 13.9 KB
/
common-api.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
========================================================================
A common RESTful API for node databases of wireless community networks
========================================================================
Types
---------------
* Antenna
* Antenna_Band
* Antenna_Type
* Net_Device
* Net_Device_Type
* Net_Interface
* Net_Link
* Node
* Wired_Interface
* Wireless_Channel
* Wireless_Interface
* Wireless_Interface_uses_Antenna
* Wireless_Interface_uses_Wireless_Channel
Custom attribute types
-------------------------
Freq_Interval
==============
Tuple of float values (lower, upper) in units of Hertz.
Geo_Position
==============
An sub-object with the attributes:
=============== =============== =============== ===========================
Name Type Kind Unit
=============== =============== =============== ===========================
altitude Float optional meters above mean sea level
latitude Float required degrees
longitude Float required degrees
=============== =============== =============== ===========================
Remark: `position` is modelled as a composite attribute because it is
optional, but `latitude` and `longitude` both need to be specified if
one of them is given; `altitude` can only be specified together with
`latitude` and `longitude`, but can also be skipped.
Polarization
==============
One of: ("horizontal", "vertical", "left circular", "right circular")
Wireless_Mode
================
One of: ("AP", "Ad-Hoc", "Client")
Wireless_Std
================
One of : ("802.11a", "802.11b", "802.11g", "802.11n")
Attributes
-------------
Antenna
========
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
azimuth Angle [Float] required degrees, (0, 360)
desc String optional
elevation_angle Angle [Float] optional degrees, (-90, +90)
gain Float optional
name String optional
polarization Polarization optional
type Antenna_Type required foreign-key
=============== =============== =============== ======================
Antenna_Band
=============
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
band Freq_Interval required (Hertz, Hertz)
type Antenna_Type required foreign-key
=============== =============== =============== ======================
Antenna_Type
===============
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
desc String optional
gain Float required dBi
model_no String optional
name String required
polarization Polarization required
revision String optional
=============== =============== =============== ======================
Todo: add information about radiation pattern in a computationally
useful format.
Net_Device
============
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
desc String optional
name String optional
node Node required foreign-key
type Net_Device_Type required foreign-key
=============== =============== =============== ======================
Question:
* location info: Ninux has it, AWMN, Funkfeuer and Guifi keep
it with the Node.
Net_Device_Type
================
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
desc String optional
model_no String optional
name String required
revision String optional
=============== =============== =============== ======================
Net_Interface
===============
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
desc String optional
device Net_Device required foreign-key
mac_address Mac_Address optional
name String optional
=============== =============== =============== ======================
Net_Link
==========
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
left Net_Interface required foreign-key
right Net_Interface required foreign-key
=============== =============== =============== ======================
Question: Ninux has an additional Planned_Link (node-node), AWMN doesn't
model devices and interfaces and has links as node-to--node.
Node
=======
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
address String optional
desc String optional
name String required
position Geo_Position optional
=============== =============== =============== ======================
Wired_Interface
==================
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
desc String optional
device Net_Device required foreign-key
mac_address Mac_Address optional
name String optional
is_active Boolean optional
=============== =============== =============== ======================
Wireless_Channel
===================
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
number Integer required
frequency Frequency required Hertz
=============== =============== =============== ======================
Wireless_Interface
=====================
=============== =============== =============== ======================
Name Type Kind Unit
=============== =============== =============== ======================
desc String optional
device Net_Device required foreign-key
mac_address Mac_Address optional
name String optional
is_active Boolean optional
mode Wireless_Mode optional
essid String optional max_length = 32
bssid MAC_Address optional
standard Wireless_Std required
tx_power TX-Power optional milliWatt
=============== =============== =============== ======================
Wireless_Interface_uses_Antenna
=================================
=============== ===================== =============== ======================
Name Type Kind Unit
=============== ===================== =============== ======================
interface Wireless_Interface required foreign-key
antenna Antenna required foreign-key
relative_height Float optional meters
=============== ===================== =============== ======================
Todo: move `relative_height` to Antenna ???
Wireless_Interface_uses_Wireless_Channel
==========================================
=============== ===================== =============== ======================
Name Type Kind Unit
=============== ===================== ============== ======================
interface Wireless_Interface required foreign-key
channel Wireless_Channel required foreign-key
=============== ===================== =============== ======================
Attribute representation in JSON
---------------------------------
=============== ========================== ==========================
Attribute type Raw value json Cooked value json
=============== ========================== ==========================
Boolean "yes" true
"no" false
Date "2014-02-26" "2014-02-26"
Datetime "2014-02-26 15:08" "2014-02-26T15:08+01:00"
Frequency "2.5 Ghz" 2.5e9
IP4 address "1.2.3.40/28" "1.2.3.40/28"
IP6 address "::1" "::1"
Polarization "horizontal" "horizontal"
Reference {"pid": pid, "url": url} {"pid": pid, "url": url}
String "Don's network" "Don's network"
String no-case "McDonalds" "mcdonalds"
TX-Power "20 dBm" 100
"100 mW" 100
=============== ========================== ==========================
Common-API URL scheme
----------------------
All resources support the method `OPTIONS` which returns the list of methods
supported by that resource.
- /CAPI/: root URL of common-api (name depends on community network)
* Supported methods:
+ GET: returns list of urls of supported types
- /CAPI/<Type>: REST resource for `<Type>`
* Supported methods:
+ GET: returns list of instances of `<Type>`
+ OPTIONS: returns the list of methods supported by that resource and
documentation (in JSON) about `<Type>`.
+ POST: create new instance of `<Type>`
- /CAPI/<Type>/<pid>: REST resource for one specific instance of `<Type>`
* Supported methods:
+ DELETE: delete the instance
+ GET: returns attributes of, and meta information about, the instance
+ OPTIONS: returns the list of methods supported by that resource and
documentation (in JSON) about `<Type>`.
+ PATCH: change values of specified attributes
JSON representation of GET responses
-------------------------------------
- /CAPI/: object with the attributes
* entries: list of urls of supported types
- /CAPI/<Type>: object with the attributes
* attribute_names: list of names of (editable) attributes of `<Type>`
* entries: list of instances matching the query arguments
- /CAPI/<Type>/<pid>: JSON representation of instance `<pid>` of `<Type>`
object with the attributes:
* attributes: JSON object containing name and cooked value for each
non-null attribute requested (value can be nested)
+ This is not returned if the request contains the query
argument `raw` unless it also contains the query arguments `ckd`
* attributes_raw: JSON object containing name and raw value for each
non-null attribute requested (value can be nested)
+ This is only returned if the request contains the query argument `raw`
* cid: change id of instance at time of request
+ This must be passed to a subsequent `PATCH` request and is used to
avoid update conflicts
+ A timestamp can be used if the resolution is fine enough (at least 1
second). TBD: RSC
* pid: permanent id of instance
* url: url of resource describing the instance
* a common-api server may include more fields in the response
JSON representation of OPTIONS responses for documentation
------------------------------------------------------------
The `OPTIONS` methods of `/CAPI/<Type>` and `/CAPI/<Type>/<pid>` return
documentation about the respective types in the JSON format:
- attributes: JSON object containing documentation about the `editable` and
`queryable` attributes of the type.
`editable` and `queryable` are JSON lists of the respective attributes as
JSON objects with the fields:
* default_value: the default value of the attribute, if any
* description: short description of the attribute (usable for end-user
documentation, e.g., for display as help text)
* is_required: true for attributes where a value **must** be defined
* kind: primary|required|optional TBD
* max_length: maximum length (string attributes only)
* max_value: maximum allowed value, if any
* min_value: minimum allowed value, if any
* name: name of the attribute
* representation: canonical representation of attribute value, e.g., int,
node, unicode, or datetime
* syntax: a description of the syntax accepted for raw values, if applicable
* type: semantic type of attribute value, e.g., frequency, reference,
datetime, email
* for references::
+ type_name: name of type the reference refers to
- description: short description of the type
- type_name: name of the type
JSON representation of PATCH responses
---------------------------------------
TBD
JSON representation of POST responses
--------------------------------------
TBD
..