aboutsummaryrefslogtreecommitdiffstats
path: root/samples/vnf_samples/traffic_profiles/ipv4_throughput-10.yaml
blob: f862abdb717660ddc9c9526b595d1c464af2d278 (plain)
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
# Copyright (c) 2016-2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# flow definition for ACL tests - 1K flows - ipv4 only
#
# the number of flows defines the widest range of parameters
# for example if srcip_range=1.0.0.1-1.0.0.255 and dst_ip_range=10.0.0.1-10.0.1.255
# and it should define only 16 flows
#
# there is assumption that packets generated will have a random sequences of following addresses pairs
# in the packets
# 1. src=1.x.x.x(x.x.x =random from 1..255) dst=10.x.x.x (random from 1..512)
# 2. src=1.x.x.x(x.x.x =random from 1..255) dst=10.x.x.x (random from 1..512)
# ...
# 512. src=1.x.x.x(x.x.x =random from 1..255) dst=10.x.x.x (random from 1..512)
#
# not all combination should be filled
# Any other field with random range will be added to flow definition
#
# the example.yaml provides all possibilities for traffic generation
#
# the profile defines a public and private side to make limited traffic correlation
# between private and public side same way as it is made by IXIA solution.
#
---
schema: "nsb:traffic_profile:0.1"

# This file is a template, it will be filled with values from tc.yaml before passing to the traffic generator

name: rfc2544
description: Traffic profile to run RFC2544 latency
traffic_profile:
  traffic_type: RFC2544Profile # defines traffic behavior - constant or look for highest possible throughput
  frame_rate: 100  # pc of linerate
  # that specifies a range (e.g. ipv4 address, port)


uplink_0:
  ipv4:
    id: 1
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_0', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_0', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_0', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_0', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_0:
  ipv4:
    id: 2
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_0', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_0', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_0', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_0', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_1:
  ipv4:
    id: 3
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_1', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_1', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_1', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_1', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_1:
  ipv4:
    id: 4
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_1', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_1', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_1', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_1', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_2:
  ipv4:
    id: 5
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_2', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_2', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_2', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_2', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_2:
  ipv4:
    id: 6
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_2', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_2', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_2', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_2', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_3:
  ipv4:
    id: 7
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_3', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_3', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_3', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_3', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_3:
  ipv4:
    id: 8
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_3', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_3', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_3', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_3', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_4:
  ipv4:
    id: 9
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_4', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_4', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_4', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_4', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_4:
  ipv4:
    id: 10
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_4', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_4', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_4', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_4', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_5:
  ipv4:
    id: 11
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_5', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_5', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_5', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_5', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_5:
  ipv4:
    id: 12
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_5', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_5', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_5', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_5', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_6:
  ipv4:
    id: 13
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_6', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_6', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_6', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_6', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_6:
  ipv4:
    id: 14
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_6', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_6', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_6', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_6', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_7:
  ipv4:
    id: 15
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_7', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_7', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_7', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_7', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_7:
  ipv4:
    id: 16
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_7', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_7', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_7', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_7', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_8:
  ipv4:
    id: 17
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_8', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_8', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_8', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_8', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_8:
  ipv4:
    id: 18
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_8', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_8', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_8', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_8', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
uplink_9:
  ipv4:
    id: 19
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.uplink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.uplink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.uplink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.uplink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.uplink.512B', '0') }}"
        570B: "{{get(imix, 'imix.uplink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.uplink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.uplink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.uplink.1518B', '0') }}"
    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.src_ip_9', '1.1.1.1-1.1.255.255') }}"
      dstip4: "{{get(flow, 'flow.dst_ip_9', '90.90.1.1-90.90.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.src_port_9', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.dst_port_9', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
downlink_9:
  ipv4:
    id: 20
    outer_l2:
      framesize:
        64B: "{{ get(imix, 'imix.downlink.64B', '0') }}"
        128B: "{{ get(imix, 'imix.downlink.128B', '0') }}"
        256B: "{{ get(imix, 'imix.downlink.256B', '0') }}"
        373b: "{{ get(imix, 'imix.downlink.373B', '0') }}"
        512B: "{{ get(imix, 'imix.downlink.512B', '0') }}"
        570B: "{{get(imix, 'imix.downlink.570B', '0') }}"
        1400B: "{{get(imix, 'imix.downlink.1400B', '0') }}"
        1500B: "{{get(imix, 'imix.downlink.1500B', '0') }}"
        1518B: "{{get(imix, 'imix.downlink.1518B', '0') }}"

    outer_l3v4:
      proto: "udp"
      srcip4: "{{get(flow, 'flow.dst_ip_9', '90.90.1.1-90.90.255.255') }}"
      dstip4: "{{get(flow, 'flow.src_ip_9', '1.1.1.1-1.1.255.255') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
      ttl: 32
      dscp: 0
    outer_l4:
      srcport: "{{get(flow, 'flow.dst_port_9', '1234-4321') }}"
      dstport: "{{get(flow, 'flow.src_port_9', '2001-4001') }}"
      count: "{{get(flow, 'flow.count', '1') }}"
or string :return: Boolean True if success, False if error """ return self._manager.driver.ask_verify(make_stream_command( CMD_SET_STREAM_TEST_PAYLOAD_ID, identifier, self)) class XenaRXStats(object): """ Receive stat class """ def __init__(self, stats, epoc): """ Constructor :param stats: Stats from pr all command as list :param epoc: Current time in epoc :return: XenaRXStats object """ self._stats = stats self._time = epoc self.data = self.parse_stats() self.preamble = 8 @staticmethod def _pack_stats(param, start, fields=None): """ Pack up the list of stats in a dictionary :param param: The list of params to process :param start: What element to start at :param fields: The field names to pack as keys :return: Dictionary of data where fields match up to the params """ if not fields: fields = ['bps', 'pps', 'bytes', 'packets'] data = {} i = 0 for column in fields: data[column] = int(param[start + i]) i += 1 return data @staticmethod def _pack_tplds_stats(param, start): """ Pack up the tplds stats :param param: List of params to pack :param start: What element to start at :return: Dictionary of stats """ data = {} i = 0 for val in range(start, len(param) - start): data[i] = int(param[val]) i += 1 return data def _pack_rxextra_stats(self, param, start): """ Pack up the extra stats :param param: List of params to pack :param start: What element to start at :return: Dictionary of stats """ fields = ['fcserrors', 'pauseframes', 'arprequests', 'arpreplies', 'pingrequests', 'pingreplies', 'gapcount', 'gapduration'] return self._pack_stats(param, start, fields) def _pack_tplderrors_stats(self, param, start): """ Pack up tlpd errors :param param: List of params to pack :param start: What element to start at :return: Dictionary of stats """ fields = ['dummy', 'seq', 'mis', 'pld'] return self._pack_stats(param, start, fields) def _pack_tpldlatency_stats(self, param, start): """ Pack up the tpld latency stats :param param: List of params to pack :param start: What element to start at :return: Dictionary of stats """ fields = ['min', 'avg', 'max', '1sec'] return self._pack_stats(param, start, fields) def _pack_tpldjitter_stats(self, param, start): """ Pack up the tpld jitter stats :param param: List of params to pack :param start: What element to start at :return: Dictionary of stats """ fields = ['min', 'avg', 'max', '1sec'] return self._pack_stats(param, start, fields) @property def time(self): """ :return: Time as String of epoc of when stats were collected """ return self._time def parse_stats(self): """ Parse the stats from pr all command :return: Dictionary of all stats """ statdict = {} for line in self._stats: param = line.split() if param[1] == 'PR_TOTAL': statdict['pr_total'] = self._pack_stats(param, 2) elif param[1] == 'PR_NOTPLD': statdict['pr_notpld'] = self._pack_stats(param, 2,) elif param[1] == 'PR_EXTRA': statdict['pr_extra'] = self._pack_rxextra_stats(param, 2) elif param[1] == 'PT_STREAM': entry_id = "pt_stream_%s" % param[2].strip('[]') statdict[entry_id] = self._pack_stats(param, 3) elif param[1] == 'PR_TPLDS': tid_list = self._pack_tplds_stats(param, 2) if len(tid_list): statdict['pr_tplds'] = tid_list elif param[1] == 'PR_TPLDTRAFFIC': if 'pr_tpldstraffic' in statdict: data = statdict['pr_tpldstraffic'] else: data = {} entry_id = param[2].strip('[]') data[entry_id] = self._pack_stats(param, 3) statdict['pr_tpldstraffic'] = data elif param[1] == 'PR_TPLDERRORS': if 'pr_tplderrors' in statdict: data = statdict['pr_tplderrors'] else: data = {} entry_id = param[2].strip('[]') data[entry_id] = self._pack_tplderrors_stats(param, 3) statdict['pr_tplderrors'] = data elif param[1] == 'PR_TPLDLATENCY': if 'pr_tpldlatency' in statdict: data = statdict['pr_tpldlatency'] else: data = {} entry_id = param[2].strip('[]') data[entry_id] = self._pack_tpldlatency_stats(param, 3) statdict['pr_tpldlatency'] = data elif param[1] == 'PR_TPLDJITTER': if 'pr_tpldjitter' in statdict: data = statdict['pr_tpldjitter'] else: data = {} entry_id = param[2].strip('[]') data[entry_id] = self._pack_tpldjitter_stats(param, 3) statdict['pr_pldjitter'] = data elif param[1] == 'PR_FILTER': if 'pr_filter' in statdict: data = statdict['pr_filter'] else: data = {} entry_id = param[2].strip('[]') data[entry_id] = self._pack_stats(param, 3) statdict['pr_filter'] = data elif param[1] == 'P_RECEIVESYNC': if param[2] == 'IN_SYNC': statdict['p_receivesync'] = {'IN SYNC': 'True'} else: statdict['p_receivesync'] = {'IN SYNC': 'False'} else: logging.warning("XenaPort: unknown stats: %s", param[1]) mydict = statdict return mydict class XenaTXStats(object): """ Xena transmit stat class """ def __init__(self, stats, epoc): """ Constructor :param stats: Stats from pt all command as list :param epoc: Current time in epoc :return: XenaTXStats object """ self._stats = stats self._time = epoc self._ptstreamkeys = list() self.data = self.parse_stats() self.preamble = 8 @staticmethod def _pack_stats(params, start, fields=None): """ Pack up the list of stats in a dictionary :param params: The list of params to process :param start: What element to start at :param fields: The field names to pack as keys :return: Dictionary of data where fields match up to the params """ if not fields: fields = ['bps', 'pps', 'bytes', 'packets'] data = {} i = 0 for column in fields: data[column] = int(params[start + i]) i += 1 return data def _pack_txextra_stats(self, params, start): """ Pack up the tx extra stats :param params: List of params to pack :param start: What element to start at :return: Dictionary of stats """ fields = ['arprequests', 'arpreplies', 'pingrequests', 'pingreplies', 'injectedfcs', 'injectedseq', 'injectedmis', 'injectedint', 'injectedtid', 'training'] return self._pack_stats(params, start, fields) @property def pt_stream_keys(self): """ :return: Return a list of pt_stream_x stream key ids """ return self._ptstreamkeys @property def time(self): """ :return: Time as String of epoc of when stats were collected """ return self._time def parse_stats(self): """ Parse the stats from pr all command :return: Dictionary of all stats """ statdict = {} for line in self._stats: param = line.split() if param[1] == 'PT_TOTAL': statdict['pt_total'] = self._pack_stats(param, 2) elif param[1] == 'PT_NOTPLD': statdict['pt_notpld'] = self._pack_stats(param, 2,) elif param[1] == 'PT_EXTRA': statdict['pt_extra'] = self._pack_txextra_stats(param, 2) elif param[1] == 'PT_STREAM': entry_id = "pt_stream_%s" % param[2].strip('[]') self._ptstreamkeys.append(entry_id) statdict[entry_id] = self._pack_stats(param, 3) else: logging.warning("XenaPort: unknown stats: %s", param[1]) mydict = statdict return mydict def aggregate_stats(stat1, stat2): """ Judge whether stat1 and stat2 both have same key, if both have same key, call the aggregate fuction, else use the stat1's value """ newstat = dict() for keys in stat1.keys(): if keys in stat2 and isinstance(stat1[keys], dict): newstat[keys] = aggregate(stat1[keys], stat2[keys]) else: newstat[keys] = stat1[keys] return newstat def aggregate(stat1, stat2): """ Recursive function to aggregate two sets of statistics. This is used when bi directional traffic is done and statistics need to be calculated based on two sets of statistics. :param stat1: One set of dictionary stats from RX or TX stats :param stat2: Second set of dictionary stats from RX or TX stats :return: stats for data entry in RX or TX Stats instance """ newstat = dict() for (keys1, keys2) in zip(stat1.keys(), stat2.keys()): if isinstance(stat1[keys1], dict): newstat[keys1] = aggregate(stat1[keys1], stat2[keys2]) else: if not isinstance(stat1[keys1], int) and not isinstance( [keys1], float): # its some value we don't need to aggregate return stat1[keys1] # for latency stats do the appropriate calculation if keys1 == 'max': newstat[keys1] = max(stat1[keys1], stat2[keys2]) elif keys1 == 'min': newstat[keys1] = min(stat1[keys1], stat2[keys2]) elif keys1 == 'avg': newstat[keys1] = (stat1[keys1] + stat2[keys2]) / 2 else: newstat[keys1] = (stat1[keys1] + stat2[keys2]) return newstat def line_percentage(port, stats, time_active, packet_size): """ Calculate the line percentage rate from the duration, port object and stat object. :param port: XenaPort object :param stats: Xena RXStat or TXStat object :param time_active: time the stream was active in secs as int :param packet_size: packet size as int :return: line percentage as float """ # this is ugly, but its prettier than calling the get method 3 times... try: packets = stats.data['pr_total']['packets'] except KeyError: try: packets = stats.data['pt_total']['packets'] except KeyError: _LOGGER.error( 'Could not calculate line rate because packet stat not found.') return 0 ifg = port.get_inter_frame_gap() pps = packets_per_second(packets, time_active) l2br = l2_bit_rate(packet_size, stats.preamble, pps) l1br = l1_bit_rate(l2br, pps, ifg, stats.preamble) return 100.0 * l1br / port.get_effective_speed() def l2_bit_rate(packet_size, preamble, pps): """ Return the l2 bit rate :param packet_size: packet size on the line in bytes :param preamble: preamble size of the packet header in bytes :param pps: packets per second :return: l2 bit rate as float """ return (packet_size * preamble) * pps def l1_bit_rate(l2br, pps, ifg, preamble): """ Return the l1 bit rate :param l2br: l2 bit rate int bits per second :param pps: packets per second :param ifg: the inter frame gap :param preamble: preamble size of the packet header in bytes :return: l1 bit rate as float """ return l2br + (pps * ifg * preamble) def make_manager_command(cmd, argument=None): """ String builder for Xena socket commands :param cmd: Command to send :param argument: Arguments for command to send :return: String of command """ command = '{} "{}"'.format(cmd, argument) if argument else cmd _LOGGER.info("[Command Sent] : %s", command) return command def make_port_command(cmd, xena_port): """ String builder for Xena port commands :param cmd: Command to send :param xena_port: XenaPort object :return: String of command """ command = "{} {}".format(xena_port.port_string(), cmd) _LOGGER.info("[Command Sent] : %s", command) return command def make_stream_command(cmd, args, xena_stream): """ String builder for Xena port commands :param cmd: Command to send :param xena_stream: XenaStream object :return: String of command """ command = "{} {} [{}] {}".format(xena_stream.xena_port.port_string(), cmd, xena_stream.stream_id, args) _LOGGER.info("[Command Sent] : %s", command) return command def packets_per_second(packets, time_in_sec): """ Return the pps as float :param packets: total packets :param time_in_sec: time in seconds :return: float of pps """ return packets / time_in_sec