-
Notifications
You must be signed in to change notification settings - Fork 298
/
snabb-snabbflow-v1.yang
761 lines (646 loc) · 21 KB
/
snabb-snabbflow-v1.yang
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
module snabb-snabbflow-v1 {
yang-version 1.1;
namespace snabb:snabbflow-v1;
prefix snabbflow;
import ietf-inet-types { prefix inet; }
import ietf-yang-types { prefix yang; }
organization "Snabb";
contact "Max Rottenkolber <max@mr.gy>";
description
"Configuration for the Snabbflow IPFIX exporter.";
revision 2022-04-27 {
description
"Initial draft.";
}
// Snabbflow configuration
container snabbflow-config {
description
"Configuration for the Snabbflow IPFIX exporter.";
list interface {
key device;
description
"Interaces serving as IPFIX Observation Points.";
leaf device {
type pci-address;
description
"PCI address of the network device.";
}
leaf name {
type string;
description
"String used for ifName in ifTable MIB (SNMP).";
}
leaf description {
type string;
description
"String used for ifAlias in ifTable MIB (SNMP).";
}
leaf vlan-tag {
type uint16 { range 0..4095; }
description
"802.1Q Ethernet VLAN tag for this interface.";
}
leaf receive-queue-size {
type uint32 { range 512|1024|2048|4096|8192|16384|32768; }
default 2048;
description
"Receive queue size.";
}
}
container rss {
description
"Receive-side scaling (RSS) configuration.
The IPFIX workload can be scaled across multiple worker processes via
1. hardware-scaling: the device driver used to ingest traffic
on an interface distributes packets across one or more RSS groups.
2. software-scaling: traffic may further be distributed to any number
of dedicated exporter instance workers via software RSS.";
container cpu-pool {
description
"Snabbflow worker processes are bound to CPU cores
from the cpu-pool.";
leaf-list cpu {
type uint32;
description
"CPU cores used by Snabbflow.";
}
}
container hardware-scaling {
description
"Snabbflow supports hardware assisted RSS to scale the workload
across one ore more RSS groups. Each RSS group is handled by a
dedicated worker process.";
leaf rss-groups {
type uint32 { range 1..64; }
default 1;
description
"Number of hardware-assisted RSS groups used for scaling.";
}
}
container software-scaling {
description
"In addition to hardware assisted RSS Snabbflow supports
software RSS. For each IPFIX exporter, traffic is scaled across
one or more exporter instances in each RSS group.";
list exporter {
key name;
description
"Sofware RSS configuration for the selected exporter.";
leaf name {
type leafref {
path "/snabbflow-config/ipfix/exporter/name";
require-instance true;
}
description
"The 'name' of an exporter defined in
/snabbflow-config/ipfix/exporter.";
}
leaf embed {
type boolean;
default true;
description
"By default a single instance of each exporter is embedded
in each RSS group worker process.
If set to false, then for each RSS group the exporter is
executed in one or more instances, each in its own dedicated
worker process (using a dedicated CPU core).";
}
leaf instances {
type uint32 { range 1..max; }
default 1;
description
"When 'embed' is false, number of exporter instances per
RSS group. Has no effect when 'embed' is set to true.";
}
container restart {
description
"Restart policy for exporter instance workers.
Exporter workers will be restarted if they crash unless they
would exceed the configured restart policy.
The restart policy is expressed as follows: a process may be
restarted up to 'intensity' times within 'period' seconds.
Setting 'intensity' to 0 effectively disables restarts.";
leaf intensity {
type decimal64 { range 0..max; }
default 5;
description
"The number of restarts permitted within a given time period.
Setting the intensity to 0 effectively disables restarts.";
}
leaf period {
type decimal64 { range 0..max; }
default 30;
description
"The duration of the time period in seconds.";
}
}
}
}
}
container flow-director {
description
"Snabbflow supports distinct sets of flows being processed by
any number of exporters. Flows are matched into traffic classes
which are in turn processed by exporters.";
list class {
key exporter;
description
"Traffic classes match packets making up the sets of flows
processed by indivdual exporters.
Each class specifies a single exporter which processes the
matched flows, and exporters can only process a single
traffic class each.
Classes are ordered and matched in sequence. Packets may match
multiple classes via use of the 'continue' option. When a packet
matches multiple classes, it is duplicated for each class and
thereby flows can be processed by multiple exporters.";
ordered-by user;
leaf exporter {
type leafref {
path "/snabbflow-config/ipfix/exporter/name";
require-instance true;
}
description
"An exporter defined in /snabbflow-config/ipfix/exporter.
Packets matched by the class are processed by this exporter.";
}
leaf filter {
mandatory true;
type string;
description
"pcap-filter(7) expression that specifies
packets matching this class.";
}
leaf continue {
type boolean;
default false;
description
"If set to true, a packet matching this class can also match
further consecutive classes (in match order).
By default the matching of a packet to a class terminates
the matching process.";
}
}
container default-class {
description
"The default class matches all flows not matched by
any other traffic class.";
leaf exporter {
type leafref {
path "/snabbflow-config/ipfix/exporter/name";
require-instance true;
}
description
"An exporter defined in /snabbflow-config/ipfix/exporter.
Flows matched by the default class are processed by this
exporter. If none is given, then flows matched by the
default class are dropped and not processed by any exporter.";
}
}
leaf remove-ipv6-extension-headers {
type boolean;
default true;
description
"IPv6 extention headers are stripped from packets unless this
is set to false.";
}
}
container ipfix {
description
"IPFIX configuration. See also: apps.ipfix";
leaf idle-timeout {
type decimal64;
default 300;
description
"Number of seconds after which a flow should be considered
idle and available for expiry.";
}
leaf active-timeout {
type decimal64;
default 120;
description
"Period at which an active, non-idle flow should produce
export records.";
}
leaf flush-timeout {
type decimal64;
default 10;
description
"Maximum number of seconds after which queued data records
are exported. If set to a positive value, data records are queued
until a flow export packet of maximum size according to the configured
'mtu' can be generated or 'flush-timeout' seconds have passed
since the last export packet was generated, whichever occurs first.
If set to zero, data records are exported immediately after each scan
of the flow cache.";
}
leaf cache-size {
type uint32;
default 20000;
description
"Initial size of flow tables, in terms of number of flows.";
}
leaf max-load-factor {
type decimal64;
default 0.4;
description
"Controls provisioning size of hash table backing the cache.
Refer to “max_occupancy_rate” in lib/README.ctable.md.";
}
container scan-protection {
description
"Per /24 prefix, the rate of new flows consisting of only
a single packet is measured. This is intended to detect
address and port range scans.
The options below can be used to limit the rate at which
these flows are exported by suppressing them.";
leaf enable {
type boolean;
default false;
description
"If set to true, scan protection will be enabled.";
}
leaf threshold-rate {
type decimal64;
default 10000;
description
"Rate of new single-packet flows per second within a /24 prefix
beyond which exports will be suppressed.";
}
leaf export-rate {
type decimal64;
default 500;
description
"Shared rate limit for exports of all suppressed flows
(exports per second).";
}
}
leaf scan-time {
type decimal64;
default 10;
description
"The flow cache for every configured template is scanned
continously to check for entries eligible for export based on the
'idle-timeout' and 'active-timeout' leaves. Scan-time
determines the interval in seconds that a scan of the entire flow
cache will take. The implementation uses a token bucket mechanism by
which access to the tables is distributed evenly over the time
interval.";
}
leaf template-refresh-interval {
type decimal64;
default 600;
description
"Period at which to send template records over UDP.";
}
leaf version {
type uint32;
default 10;
description
"Version of IPFIX to export.
9 indicates legacy NetFlow v9;
10 indicates RFC 7011 IPFIX.";
}
leaf mtu {
type uint32;
default 1500;
description
"MTU for exported UDP packets.";
}
leaf exporter-ip {
mandatory true;
type inet:ipv4-address;
description
"The IPv4 address from which to send exported UDP packets.";
}
container maps {
description
"Maps to translate various protocol fields to additional flow metadata.";
// XXX: YANGify? Document formats.
// XXX: make optional, default to empty maps.
container pfx4-to-as { leaf file { mandatory true; type string; } }
container pfx6-to-as { leaf file { mandatory true; type string; } }
container vlan-to-ifindex { leaf file { mandatory true; type string; } }
container mac-to-as { leaf file { mandatory true; type string; } }
leaf log-directory {
type string;
description
"Path in which to create log files for map failures.
If given, failed lookups in maps will be logged to
<log-directory>/<observation-domain>.log";
}
}
leaf log-date {
type boolean;
default true;
description
"Indicates whether each log message should be prepended by
the current date and time.";
}
list collector-pool {
key name;
description
"Named pools of collector endpoints. Exporter instances
distribute exported flows across the collectors in a pool.";
leaf name {
type string-name;
description
"Identifier used to refer to the collector pool in
/snabbflow-config/ipfix/exporter/collector-pool.";
}
list collector {
key "ip port";
description
"The set of collector endpoints within the pool.";
leaf ip {
mandatory true;
type inet:ipv4-address;
description
"Address of the collector.";
}
leaf port {
mandatory true;
type uint16;
description
"Port of the collector.";
}
}
}
leaf observation-domain-base {
type uint32;
default 256;
description
"Each exporter instance is assigned an Observation Domain.
This leaf defines the first identifer used. Further instances
will be assigned consecutive identifiers by incrementing the
last assigned identifier by one.";
}
list exporter {
key name;
description
"Set of configured exporters. Each exporter receives packets
matching a single class defined in /snabbflow-config/rss/flow-director,
aggregates flows according to a set of templates, and
exports them to a specified /snabbflow-config/ipfix/collector-pool.";
leaf name {
type string-name;
description
"The name used to refer to this exporter in
/snabbflow-config/rss/software-scaling/exporter/name.";
}
leaf-list template {
type string;
description
"The set of templates used to aggregate flows.
The available templates are described in apps/ipfix/README.templates.md.";
}
leaf collector-pool {
type leafref {
path "/snabbflow-config/ipfix/collector-pool/name";
require-instance true;
}
mandatory true;
description
"A collector pool defined in /snabbflow-config/ipfix/collector-pool.";
}
}
}
}
// Types
typedef string-name {
type string { pattern '[\w_]+'; }
description
"A string name used to refer to various Snabbflow components.";
}
typedef numeric-id {
type uint32 { range 1..max; }
description
"A numeric identifier.";
}
typedef pci-address {
type string {
pattern '([0-9a-fA-F]{4}:)?[0-9a-fA-F]{2}:[0-9a-fA-F]{2}\.[0-9a-fA-F]';
}
description
"The bus address of a PCI device.";
}
// Snabbflow state
container snabbflow-state {
config false;
description
"Inspectable state for the Snabbflow IPFIX exporter.";
list interface {
key device;
description
"Network device statistics";
uses interface-state;
}
list exporter {
key name;
description
"Exporter statistics.";
leaf name {
type leafref {
path "/snabbflow-config/ipfix/exporter/name";
}
description
"An exporter defined in /snabbflow-config/ipfix/exporter.";
}
uses exporter-state;
list template {
key id;
description
"Template statistics.";
uses template-state;
}
}
list rss-group {
key id;
description
"Statistics for the RSS group workers defined in
/snabbflow-config/rss/hardware-scaling.";
leaf id {
type numeric-id;
description
"RSS group identifier.";
}
uses worker-state;
list queue {
key device;
description
"Statistics for the receive queues used by this RSS group.";
leaf device {
type pci-address;
description
"PCI address of the network device.";
}
leaf packets-dropped {
type yang:zero-based-counter64;
description
"Count of incoming packets that were dropped.";
}
}
list exporter {
key name;
description
"Exporter statistics for this RSS group as per
/snabbflow-config/rss/software-scaling.";
leaf name {
type leafref {
path "/snabbflow-config/ipfix/exporter/name";
}
description
"An exporter defined in /snabbflow-config/ipfix/exporter.";
}
list instance {
key id;
description
"Statistics for exporter instance workers for this RSS group.";
leaf id {
type numeric-id;
description
"Exporter instance identifier (within this RSS group).";
}
uses worker-state;
uses exporter-state;
uses exporter-instance-state;
list template {
key id;
description
"Statistics for template instances.";
uses template-state;
uses template-instance-state;
}
}
}
}
grouping interface-state {
leaf device {
type pci-address;
description
"PCI address of the network device.";
}
leaf packets-received {
type yang:zero-based-counter64;
description
"Count of packets received.";
}
leaf packets-dropped {
type yang:zero-based-counter64;
description
"Count of incoming packets that were dropped.";
}
}
grouping exporter-state {
leaf packets-received {
type yang:zero-based-counter64;
description
"Count of packets received.";
}
leaf packets-dropped {
type yang:zero-based-counter64;
description
"Count of incoming packets that were dropped.";
}
leaf packets-ignored {
type yang:zero-based-counter64;
description
"Count of incoming packets that were ignored.";
}
leaf template-packets-transmitted {
type yang:zero-based-counter64;
description
"Number of template packets transmitted.";
}
}
grouping exporter-instance-state {
leaf observation-domain {
type uint32;
description
"Observation Domain of this IPFIX exporter instance.";
}
leaf sequence-number {
type yang:zero-based-counter64;
description
"Current IPFIX sequence number. counts the cumulative number of data records
transmitted (i.e. excluding template and option records).";
}
}
grouping worker-state {
leaf pid {
type uint32;
description
"Process identifier of this worker.";
}
}
grouping template-state {
leaf id {
type numeric-id;
description
"Template ID. See apps/ipfix/README.templates.md.";
}
leaf packets-processed {
type yang:zero-based-counter64;
description
"Number of packets processed by this template.";
}
leaf flows-exported {
type yang:zero-based-counter64;
description
"Count of flows exported for this template.";
}
leaf flow-export-packets {
type yang:zero-based-counter64;
description
"Number of packets emitted for flow exports by this template.";
}
}
grouping template-instance-state {
container flow-table {
description
"Statistics for the table used to track active flows for this template.";
leaf last-scan-time {
type uint64;
description
"Seconds elapsed from start to completion of the last full flow table scan.";
}
uses table-state;
}
container flow-export-rate-table {
description
"Statistics for the table used to track flow export rates for this template.";
uses table-state;
}
}
grouping table-state {
description
"Various data describing a table’s dimensions in memory.";
leaf occupancy {
type uint64;
description
"Number of entries stored in the table.";
}
leaf size {
type uint64;
description
"Current size of the table in entries.";
}
leaf byte-size {
type uint64;
description
"Current size of the table in bytes.";
}
leaf load-factor {
type decimal64;
description
"Ratio of table occupancy/size.";
}
leaf max-displacement {
type uint64;
description
"The most entries that currently map to a single hash bucket.
Large 'max-displacement' values indicate an unnaturally unbalanced table.";
}
}
}
}