-
Notifications
You must be signed in to change notification settings - Fork 3
/
apispec.yaml
891 lines (839 loc) · 24.2 KB
/
apispec.yaml
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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
openapi: 3.0.0
info:
title: docsis-pnm API
version: 2.3.0
servers:
- url: /
paths:
/upstreams:
get:
tags:
- Upstreams
responses:
200:
description: Return a list of all known upstream channels
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Upstream'
/upstreams/{upstreamId}:
get:
tags:
- Upstreams
parameters:
- $ref: '#/components/parameters/upstreamId'
responses:
200:
description: Returns the upstream with the given ID
content:
application/json:
schema:
$ref: '#/components/schemas/Upstream'
/stats:
get:
tags:
- stats
responses:
200:
description: Some statistics. Some can be used for performance monitoring
content:
application/json:
schema:
$ref: '#/components/schemas/Stats'
/health/status:
get:
tags:
- stats
responses:
200:
description: |
Returns health status of the application. Use this for your load
balancer or monitoring system
content:
text/plain:
schema:
type: string
title: application status
description: Returns 'OK' if the application is up and running
/cmts:
get:
tags:
- CMTS
responses:
200:
description: List all CMT systems
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Cmts'
post:
tags:
- CMTS
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Cmts'
responses:
201:
$ref: '#/components/responses/cmtsResponse'
/cmts/{cmtsId}:
get:
tags:
- CMTS
description: Retrieves information about the specified CMTS
parameters:
- $ref: '#/components/parameters/cmtsId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Cmts'
404:
description: CMTS with the given ID does not exist
patch:
tags:
- CMTS
- Not implemented yet
parameters:
- $ref: '#/components/parameters/cmtsId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Cmts'
responses:
204:
description: No content
/cmts/{cmtsId}/modems:
get:
tags:
- CMTS
- Modem
description: Lists all known modems for this CMTS
parameters:
- $ref: '#/components/parameters/cmtsId'
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Modem'
/cmts/{cmtsId}/stats:
get:
tags:
- CMTS
- Not implemented yet
description: Current status and some statistics about the CMTS
parameters:
- $ref: '#/components/parameters/cmtsId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CmtsStats'
/modems:
get:
tags:
- Modem
description: Lists all known modems
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Modem'
/modems/{modemId}:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Modem'
404:
description: Not found
patch:
tags:
- Modem
- Not implemented yet
parameters:
- $ref: '#/components/parameters/modemId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Modem'
responses:
200:
description: Update successful
404:
description: Not found
409:
$ref: '#/components/responses/validationError'
delete:
tags:
- Modem
- Not implemented yet
parameters:
- $ref: '#/components/parameters/modemId'
description: Delete the modem from the database. History data
IS NOT DELETED because this is a very I/O expensive operation.
History data deletion relies on database partitions.
If this modem is active on any CMTS it will be automatically created
at the next CMTS poll run.
responses:
200:
description: OK
/modems/{modemId}/livestatus:
post:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ModemLiveStatus'
/modems/{modemId}/downstreamHistory/latest:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
description: latest downstream performance data as returned from modem
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DownstreamHistory'
/modems/{modemId}/downstreamHistory/{fromTS}/{toTS}:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
- $ref: '#/components/parameters/fromTS'
- $ref: '#/components/parameters/toTS'
description: downstream performance data history as returned from modem
responses:
200:
headers:
X-Count:
$ref: '#/components/headers/X-Count'
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/DownstreamHistory'
/modems/{modemId}/upstreamHistoryFromCMTS/latest:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
description: latest upstream performance data as returned from CMTS
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UpstreamHistory'
/modems/{modemId}/upstreamHistoryFromCMTS/{fromTS}/{toTS}:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
- $ref: '#/components/parameters/fromTS'
- $ref: '#/components/parameters/toTS'
description: upstream performance data as returned from CMTS
responses:
200:
headers:
X-Count:
$ref: '#/components/headers/X-Count'
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UpstreamHistory'
/modems/{modemId}/upstreamHistoryFromModem/latest:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
description: latest upstream performance data as returned from modem
responses:
200:
headers:
X-Count:
$ref: '#/components/headers/X-Count'
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UpstreamHistoryModem'
/modems/{modemId}/upstreamHistoryFromModem/{fromTS}/{toTS}:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
- $ref: '#/components/parameters/fromTS'
- $ref: '#/components/parameters/toTS'
description: upstream performance data history as returned from modem
responses:
200:
headers:
X-Count:
$ref: '#/components/headers/X-Count'
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/UpstreamHistoryModem'
/modems/{modemId}/traffic/{fromTS}/{toTS}:
get:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
- $ref: '#/components/parameters/fromTS'
- $ref: '#/components/parameters/toTS'
description: |
Returns the transferred bytes of the modem. The values are
read from the modem's MAC interface and include the DOCSIS protocol overhead.<br>
Due to the overhead and the often not very reliable modem implementation, this
data is not suitable for billing purposes.<br>
The values represent the increasing byte counters since reset or start of the modem. On older or simpler
devices, this byte counter is sometimes a 32 bit unsigned integer and might overflow.<br>
The returned values are in this format:
[<unix_timestamp>,<bytes_down>,<bytes_up>]
responses:
200:
headers:
X-Count:
$ref: '#/components/headers/X-Count'
description: OK
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/TransferHistory'
/modems/{modemId}/pnm/OFDMDownstreamMER:
post:
tags:
- Modem
parameters:
- $ref: '#/components/parameters/modemId'
description: |
Returns DOCSIS 3.1 OFDM downstream MER values in dB for each OFDM subcarrier. The upload
from the modem is done via TFTP and then parsed. For further information
how this works you can consult Appendix D in the
<a href="https://specification-search.cablelabs.com/CM-SP-CM-OSSIv3.1">
DOCSIS 3.1 specification
</a>
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/OFDMDownstreamMERTable'
components:
headers:
X-Count:
description: Number of returned items
schema:
type: integer
responses:
validationError:
description: ValidationError
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
cmtsResponse:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Cmts'
parameters:
upstreamId:
name: upstreamId
in: path
required: true
description: Upstream database ID
schema:
type: integer
example: 378
fromTS:
name: fromTS
in: path
required: true
description: Unix timestamp in seconds
schema:
type: integer
example: 1593791558
toTS:
name: toTS
in: path
required: true
description: Unix timestamp in seconds
schema:
type: integer
example: 1593795158
date:
name: date
in: path
required: true
schema:
type: string
format: date
example: 2020-06-20
cmtsId:
name: cmtsId
in: path
required: true
schema:
type: integer
format: int32
modemId:
name: modemId
in: path
required: true
schema:
type: string
description: Modem identifier. Can be the MAC address, database row ID
or IP address of the modem
modemMac:
name: modemMac
in: path
required: true
schema:
type: string
format: macaddr
schemas:
OFDMDownstreamMERTable:
type: object
readOnly: true
properties:
capture_time:
type: integer
example: 1598362391
description: Unix timestamp
channel_id:
type: integer
example: 33
description: OFDM channel ID
subcarrier_zero_frequency:
type: integer
example: 833600000
first_active_subcarrier_index:
type: integer
example: 1422
subcarrier_spacing_khz:
type: integer
example: 25
mac:
type: string
description: MAC address of the modem
mer_db:
type: array
example: [32.75, 33, 31.5]
items:
type: number
DocsisVersion:
type: string
enum:
- 'docs_10'
- 'docs_11'
- 'docs_20'
- 'docs_21'
- 'docs_31'
- 'unknown'
Error:
type: object
readOnly: true
properties:
message:
type: string
field_errors:
type: object
description: Fields with error message
example: {'hostname': 'invalid hostname'}
Cmts:
type: object
required:
- hostname
properties:
cmts_id:
type: integer
format: int32
example: 1
readOnly: true
hostname:
description: Hostname or IP address
type: string
example: cmts-rosenheim.example
snmp_community:
type: string
example: public
nullable: true
description: Override default SNMP community from config file.
Returns the overridden community string if set. Set to `null` to
use the default community.
snmp_community_modem:
type: string
example: public
nullable: true
description: Override the default SNMP community for modems.
Returns the overridden community string if set. Set to `null` to
use the default community.
disabled:
type: boolean
example: false
nullable: false
description: Set to `true` to disable polling of that CMTS
poll_interval:
type: integer
example: 60
nullable: false
description: Poll interval of the CMTS. Defaults to 60 if < 60
snmp_max_repetitions:
type: integer
example: 10
nullable: false
description: Set SNMP max-repetitions to this value. If set to 0 the default value (30) will be used.
CmtsStats:
type: object
readOnly: true
description: Status information about the CMTS
properties:
modems_online:
type: integer
format: int32
example: 4228
description: Modems the CMTS considers online
modems_offline:
type: integer
format: int32
example: 112
description: Modems the CMTS considers offline
last_seen:
type: string
format: date-time
description: Last successful data polling
Modem:
properties:
modem_id:
type: integer
format: uint64
readOnly: true
example: 1
cmts_id:
type: integer
format: int32
readOnly: true
example: 1
description: The ID of the CMTS the modem was last seen on
mac:
type: string
format: macaddr
readOnly: true
description: MAC address in Unix format (00:00:00:00:00:00)
example: 00:00:00:00:00:00
sysdescr:
type: string
readOnly: true
description: Sysdescr as returned via SNMP
example: 'FRITZ!Box Cable <<HW_REV: 233.8; VENDOR: AVM GmbH; BOOTR: 1.3465; SW_REV: 161.07.19-77042; MODEL: 6591>>'
ipaddr:
type: string
readOnly: true
description: IP address (IPv4 or IPv6) of the cable modem part of the modem
snmp_index:
type: integer
format: int32
description: SNMP index on the CMTS for that modem
readOnly: true
docsis_version:
type: string
enum:
- 'docs_10'
- 'docs_11'
- 'docs_20'
- 'docs_21'
- 'docs_31'
- 'unknown'
readOnly: true
description: DOCSIS version this modem is running on
ds_primary_hz:
type: integer
format: int32
description: Frequency of downstream primary channel
example: 618000000
cmts_ds_idx:
type: integer
format: int32
description: SNMP index of the downstream channel on the CMTS
example: 21993
ModemLiveStatus:
properties:
sysdescr:
type: string
description: system description as returned via SNMP
example: 'FRITZ!Box Cable <<HW_REV: 233.8; VENDOR: AVM GmbH; BOOTR: 1.3465; SW_REV: 161.07.19-77042; MODEL: 6591>>'
hostname:
type: string
description: hostname or IP address of the modem
example: 10.0.0.5
query_time_ns:
type: integer
description: time in nanoseconds it took to retrieve the data from the modem
example: 1000345
timestamp:
type: integer
format: int64
description: Unix timestamp in seconds at the time when the modem was polled
example: 1597155850
ds:
type: array
items:
$ref: '#/components/schemas/DownstreamChannel'
us:
type: array
items:
$ref: '#/components/schemas/ModemUpstream'
error:
type: string
description: error message of potential errors that occured while polling
docsis_version:
type: string
items:
$ref: '#/components/schemas/DocsisVersion'
example: docs_30
ds_primary:
type: integer
description: SNMP index of downstream primary
uptime:
type: integer
format: uint32
description: uptime in hundreths of a second (divide this by 100 to get seconds)
example: 3601
Upstream:
properties:
id:
type: integer
format: int32
description: Database upstream ID
cmts_id:
type: integer
format: int32
description: CMTS database ID
snmp_index:
type: integer
format: int32
description: SNMP index on the CMTS
description:
type: string
description: Description as returned by the CMTS
alias:
type: string
description: Alias of the upstream, can be set on the CMTS
freq:
type: integer
format: int32
description: Center frequency of the channel
admin_status:
type: integer
format: int32
description: admin status returned by SNMP
UpstreamHistoryEntry:
properties:
id:
type: integer
format: int32
description: Upstream ID
pwr:
type: integer
format: int32
description: Power in tenth dBmV
example: -10
snr:
type: integer
format: int32
description: Signal to noise ratio (SNR) in tenth dB (you have to divide the value by ten)
example: 299
mrefl:
type: integer
format: int32
example: -30
description: Microreflections in -dBc
unerr:
type: integer
format: uint64
description: Number of received unerrored codewords
corr:
type: integer
format: uint64
description: Number of received corrected codewords
err:
type: integer
format: uint64
description: Number of erroneous codewords
UpstreamHistory:
properties:
ts:
type: integer
format: int64
description: Unix timestamp in full seconds
us:
type: array
items:
$ref: '#/components/schemas/UpstreamHistoryEntry'
DownstreamChannel:
properties:
freq:
type: integer
format: int32
description: Downstream channel frequency in Hertz
example: 800000000
pwr:
type: integer
format: int32
description: Receive power in tenth dbmV (you have to divide the value by ten)
example: -12
snr:
type: integer
format: int32
description: Signal to noise ratio (SNR) in tenth dB (you have to divide the value by ten)
example: 401
mrefl:
type: integer
format: int32
example: -30
description: Microreflections in -dBc
unerr:
type: integer
format: uint64
description: Number of received unerrored codewords
corr:
type: integer
format: uint64
description: Number of received corrected codewords
err:
type: integer
format: uint64
description: Number of erroneous codewords
mod:
type: integer
format: int32
description: Modulation of the channel
TransferHistory:
type: array
example: [1597904009,63455680781,7679324455]
description: "[<unix_timestamp>,<bytes_down>,<bytes_up>]"
items:
type: integer
format: int64
DownstreamHistory:
properties:
ts:
type: integer
format: int64
description: Unix timestamp in full seconds
ds:
type: array
items:
$ref: '#/components/schemas/DownstreamChannel'
UpstreamHistoryModem:
properties:
ts:
type: integer
format: int54
description: Unix timestamp in full seconds
us:
type: array
items:
$ref: '#/components/schemas/ModemUpstream'
ModemUpstream:
properties:
freq:
type: integer
format: int32
description: Upstream Frequency in Hz
timing_offset:
type: integer
format: int32
description: Timing offset
tx_power:
type: integer
format: int32
description: Transmit power of the channel in tenth dBmV
Stats:
properties:
queue_length:
type: integer
description: Number of modems waiting for polling. The queue can get
full if the average poll time increases. If there are a lot of
modems with timeouts, the queue can get full very fast.
db_queue_length:
type: integer
description: Number of modem datasets waiting for insert. This
usually should be zero.
polls_successful:
type: integer
description: Number of successful modem polls since startup
polls_errors:
type: integer
description: Number of failed modem polls since startup
modems_online:
type: integer
description: Number of online modems. This value can be a bit
misleading, because all modems for scheduling
are retrieved directly from the CMTS and not from the database.
In the startup phase this value is lower than the real modem count
and this value might not be a good value for monitoring purposes.
modems_offline:
type: integer
description: Number of offline modems. This value can be a bit
misleading. See `modems_online` for details.
active_cmts_count:
type: integer
description: Number of CMT systems active for polling.