forked from keysightgems/Huawei_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIxia_NetNgpfTraffic.tcl
More file actions
14067 lines (12701 loc) · 375 KB
/
Ixia_NetNgpfTraffic.tcl
File metadata and controls
14067 lines (12701 loc) · 375 KB
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
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) Ixia technologies 2010-2011, Inc.
# Release Version 1.55
#===============================================================================
# Change made
# Version 1.0
# 1. Create
# Version 1.1
# 1. Add SingleVlan SingeMpls Hdr to represent single vlan/mpls header
# 2. add new type APPLIST to realize two headers of vlan/mpls
# 3. add custom view filtered by TrafficItem and RxPort in get_stats
# Version 1.2
# 4. Change highLevelStream to configElement object to generate stream
# Version 1.3.1.13
# 5. Add method get_hex_data
# 6. CreateRawStream generate a list of highLevelStream, add foreach in traffic.config method
# Version 1.4.1.17
# 7. Add condition before create raw stream in Traffic.config, or else there'll add one stream each config execution
# Version 1.5.2.2
# 8. Add enable_sig param in Traffic.config
# Version 1.6.2.4
# 9. Map config.-src = "" => = portObj
# Version 1.7.2.5
# 10. Add default value for sa in EtherHdr.config
# 11. Add Common CFM Header class
# 12. Add CCM Header class
# 13. Add default value for da in EtherHdr.config
# Version 1.8.2.6
# 14. Add condition that Traffic obj has been removed being configured (object reborn)
# Version 1.9.2.7
# 15. Set random mac for src mac and dst mac in EtherHdr.config
# Version 1.10.2.11
# 16. Add Header properties noMac and noIp to identify default mac and ip address to be filled
# 17. Modify EthHdr/Ipv4Hdr/ArpHdr src mac and src ip when noMac or noIp identified
# Version 1.11.2.12
# 18. Add exception on dest endpoint for transmitting port in CreateRawStream
# Version 1.12.2.13
# 19. Add empty argument repeat_count in Traffic.config
# Version 1.13.2.16
# 20. idn_num set to zero to disable vlan in Vlan.Config
# 21. double set suspend false in Traffic.enable
# Version 1.14.2.18
# 22. Fix the bug that confilct var name of reserved
# Version 1.15.2.18
# 23. Fix the bug that interface/ipv4 does not exist
# Version 1.16.2.19
# 24. Fix the bug that Traffic.config fired with no arguments
# 25. Add CustomHdr class
# Version 1.17.2.20
# 26. Make enable ineditable if state is initially enable
# Version 1.18.2.22
# 27. EthHdr.config -src_range_mode -dst_range_mode
# 28. Ipv4Hdr.config -src_range_mode -dst_range_mode
# Version 1.19.2.23
# 29. Add autos reset in PDU unconfig
# Version 1.20.2.26
# 30. Add latency_type in traffic.set
# Version 1.21.3.0
# 31. Add vlan.set -pri_num
# Version 1.22.3.1L
# 32. Adjust latency to us
# Version 1.23.3.5
# 33. Disable dataIntegrity check
# Version 1.24.3.8
# 34. Add DC header
# Version 1.25.3.9
# 35. Add l1 bit rate
# Version 1.26.3.10
# 36. Add default value for sarepeat and darepeat in IPv6Hdr.config
# 37. Add host type for src/dst in Traffic.config
# Version 1.28.4.0
# 38. change get_stats to traffic item view instead of port filtered view
# Version 1.29.4.1
# 39. change eg_nickname_step to hex in TrillHdr.config
# Version 1.30.cgn
# 40. Add mesh in traffic.config Header definition
# 41. Add src/dst port mesh in UdpHdr
# Version 1.31.4.11
# 42. Set 4 octets signature
# Version 1.32.4.12
# 43. Add adapter param -need_arp in traffic.config
# Version 1.33.4.13
# 43. Modify stream_load type also integer and double in traffic.config
# Version 1.34.4.19
# 44. check use 4bytes signature in Traffic config
# 45. check stats guard rail in Traffic config
# Version 1.35.4.23
# 46. Add IcmpHdr
# Version 1.36.4.24
# 46. Modify dscp in Ipv4Hdr
# Version 1.37.CGN
# 47. Create Traffic by existing trafficItem obj in Traffic.ctor
# Version 1.37.4.25
# 47. traffic::enable/disable back to version 4.19,control the attribution of suspend
# 48. traffic enabled in traffic::config
# Version 1.38 4.26
# 49. Add log information
# Version 1.38 4.27
# 50. Add tcp sequence num step
# Version 1.39 4.28
# 51. Change seq_num_count to seq_num_cnt
# Version 1.40 4.29
# 52. Add default seq_num to 123456, change the define of seq_num_mod
# Version 1.41.4.35
# 53. Add source/destination class awareness on BGP/Host/RouteBlock/MulticastGroup in traffic.config
# Version 1.42.4.36
# 54. Add precedence increment in Traffic.config
# Version 1.43.4.42
# 55. add source/destination class awareness on VcLsp
# Version 1.44.4.43
# 56. add ipv4 precedence tracking
# Version 1.45.4.46
# 57. add conditional apply traffic in Traffic.start
# Version 1.46.4.50
# 58. add no_mesh to_raw to config
# Version 1.47.4.51
# 59. fix bug for transfer to raw check mac error
# Version 1.48.4.53
# 60. add pdu_index in config
# Version 1.49.4.55
# 61. add GreHdr
# 62. change GreHdr.config args name
# Version 1.50.4.57
# 63.add precedence_fullmesh in IPv4Hdr.config
# Version 1.51.4.59
# 64. fix bugs in bgp route range traffic in Traffic.config
# Version 1.52.12.9
# 65. add VxlanHdr
# Version 1.53.1.15
# 66. add Traffic::traffic_enable/traffic_disable
# Version 1.54.4.8
# 67. add Traffic::config -tx_mode custom|auto
# Version 1.55
# 68. add Traffic::get_stats_per_port2 with all port stats view
# Version 1.56
# 69. add Traffic::config -frame_len_type imix
# Version 1.57
# 70. modify pdu mode
# -- Class definition...
class Traffic {
inherit NetObject
#--public method
constructor { port { hTraffic NULL } } {}
method config { args } {}
method search_min_frame_size_by_load {} {}
method enable {} {}
method disable {} {}
method traffic_enable {} {}
method traffic_disable {} {}
method get_status {} {}
method get_stats { args } {}
method get_stats_per_port { args } {}
method get_stats_per_port2 { args } {}
method get_hex_data {} {}
#--private method
method GetProtocolTemp { pro } {}
method GetField { stack field } {}
method SetStackLink { stackLinkList header value } {}
method CreateRawStream { { sig 1 } } {}
method CreateQuickStream {} {}
method GetQuickItem {} {}
method CreatePerPortView { rxPort } {}
method CreatePerPrecedenceView {} {}
method CreatePortView {} {}
method CreatePerDrillDownView {drillDownType targetRow} {}
method getHandle {} {
global LoadConfigMode
Deputs "get traffic handle...."
if { $LoadConfigMode } {
set traffic_name [GetObjNameFromString $this]
Deputs "loadconfig Mode traffic name :$traffic_name"
set handle [GetValidHandleObj "traffic" $traffic_name $hPort]
}
}
method start {} {
set tag "body Traffic::start [info script]"
Deputs "----- TAG: $tag -----"
if { [ catch {
Deputs "[ixNet getA ::ixNet::OBJ-//traffic -state]"
if { [ixNet getA ::ixNet::OBJ-//traffic -state] != "started" } {
# in case the handle was removed
if { $handle == "" } {
getHandle
}
Deputs "[ ixNet getA $handle -state ]"
if { [ ixNet getA $handle -state ] == "unapplied" || [ ixNet getA $handle -state ] == "stopped" } {
catch {
Tester::generate_traffic
after 2000
}
Tester::apply_traffic
after 2000
}
}
} err ] } {
Deputs "traffic start error:$err"
}
if { [ catch {
ixNet exec startStatelessTraffic $handle
} ] } {
after 2000
ixNet exec startStatelessTraffic $handle
}
set timeout 30
set stopflag 0
while { 1 } {
if { !$timeout } {
break
}
set root [ixNet getRoot]
set state [ ixNet getA $root/traffic -state ]
if { $state != "started" } {
Deputs "start state:$state"
if { [string match startedWaiting* $state ] } {
set stopflag 1
} elseif {[string match stopped* $state ] && ($stopflag == 1)} {
break
}
after 1000
} else {
Deputs "start state:$state"
break
}
incr timeout -1
Deputs "start timeout:$timeout state:$state"
}
return [ GetStandardReturnHeader ]
}
method stop {} {
set tag "body Traffic::stop [info script]"
Deputs "----- TAG: $tag -----"
ixNet exec stopStatelessTraffic $handle
#make sure the traffic has been stopped
set timeout 30
while {1} {
if { !$timeout } {
break
}
set state [ixNet getA $handle -state]
if {$state == "stopped"} {
break
}
after 1000
incr timeout -1
Deputs "stop timeout:$timeout state:$state"
}
return [ GetStandardReturnHeader ]
}
method completed {} {
set tag "body Traffic::completed [info script]"
Deputs "----- TAG: $tag -----"
set rate [ GetStatsFromReturn [ get_stats ] tx_frame_rate ]
set tx [ GetStatsFromReturn [ get_stats ] tx_frame_count ]
if { $rate == 0 && $tx > 0 } {
return 1
} else {
return 0
}
}
method wait_started {} {
set tag "body Traffic::wait_started [info script]"
Deputs "----- TAG: $tag -----"
set timeout 30
set start_click [ clock seconds ]
while { 1 } {
set timeout_click \
[ expr [ clock seconds ] - $start_click ]
if { $timeout_click >= 30 } {
return 0
}
set rate [ GetStatsFromReturn [ get_stats ] tx_frame_rate ]
if { $rate == 0 } {
after 1000
} else {
return 1
}
}
}
method wait_stopped {} {
set tag "body Traffic::wait_stopped [info script]"
Deputs "----- TAG: $tag -----"
set timeout 30
set start_click [ clock seconds ]
while { 1 } {
set timeout_click \
[ expr [ clock seconds ] - $start_click ]
if { $timeout_click >= 30 } {
return 0
}
set rate [ GetStatsFromReturn [ get_stats ] tx_frame_rate ]
if { $rate != 0 } {
after 1000
} else {
return 1
}
}
}
method suspend {} {
set tag "body Traffic::suspend [info script]"
Deputs "----- TAG: $tag -----"
ixNet setA $handle -suspend True
ixNet commit
}
method unsuspend {} {
set tag "body Traffic::unsuspend [info script]"
Deputs "----- TAG: $tag -----"
ixNet setA $handle -suspend False
ixNet commit
}
public variable id
public variable modifyMode
#stream stats
public variable hPort
public variable endpointSet
public variable highLevelStream
public variable portObj
#Binary search enhancement
public variable stream_load
public variable frame_len
public variable min_frame_len
public variable max_frame_len
public variable resolution
public variable frame_len_step
public variable iteration_duration
public variable traffic_name
#stats var
#public variable portView
#public variable flowView
}
class Header {
inherit NetObject
constructor { pduPro { pduType "APP" } } {
#set EMode [ list Incrementing Decremeting Fixed Random ]
set fieldModes [ list ]
set fields [ list ]
set fieldConfigs [ list ]
set optionals [ list ]
set autos [ list ]
set valid 0
set type $pduType
set protocol $pduPro
Deputs "type:$type\tprotocol:$protocol"
set noMac 1
set noIp 1
Deputs "constructor success"
}
method ConfigPdu { args } {}
destructor {}
public variable protocol
# SET - set | APP - append | MOD - modify | RAW - raw data
public variable type
public variable fields
public variable fieldModes
public variable fieldConfigs
public variable optionals
public variable autos
public variable meshes
public variable enables
public variable raw
public variable noMac
public variable noIp
private variable valid
method ChangeType { chtype } { set type $chtype }
method SetProtocol { value } { set protocol $value }
method SetRaw { value } { set raw $value }
method AddField { value { optional 0 } { auto 0 } { mesh 0 } {enable 0}} {
lappend fields $value
lappend optionals $optional
lappend autos $auto
lappend meshes $mesh
lappend enables $enable
set valid 1
Deputs "fields:$fields optionals:$optionals autos:$autos meshes:$meshes enables: $enables"
}
# Fixed | List | Segment ( set a segment of bits from the beginning of certain field )
# | Incrementing | Decrementing | Reserved ( for option and auto now )
method AddFieldMode { value } {
lappend fieldModes $value
set valid 1
}
method AddFieldConfig { args } {
lappend fieldConfigs $args
set valid 1
}
method Clear {} {
set fields [ list ]
set fieldModes [ list ]
set fieldConfigs [ list ]
set optionals [ list ]
set autos [ list ]
set meshes [ list ]
set enables [ list ]
set valid 0
}
method IsValid {} {
return $valid
}
method config { args } {
set tag "body Header::config [info script]"
Deputs "----- TAG: $tag -----"
set modify 0
#param collection
Deputs "Args:$args "
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-modify {
set modify $value
}
}
}
if { $modify } {
ChangeType MOD
}
}
method unconfig {} { Clear }
}
class EtherHdr {
inherit Header
constructor {} { chain Ethernet SET } {
set daoffset 0
set saoffset 0
set daStep 1
set saStep 1
set daNum 1
set saNum 1
set sa [ RandomMacAddr ]
set da [ RandomMacAddr ]
}
public variable daoffset
public variable saoffset
public variable daStep
public variable saStep
public variable daNum
public variable saNum
public variable sa
public variable da
method config { args } {}
}
class EtherNoFcsHdr {
inherit Header
constructor {} { chain Ethernet SET } {
set daoffset 0
set saoffset 0
set daStep 1
set saStep 1
set daNum 1
set saNum 1
set sa [ RandomMacAddr ]
set da [ RandomMacAddr ]
}
public variable daoffset
public variable saoffset
public variable daStep
public variable saStep
public variable daNum
public variable saNum
public variable sa
public variable da
method config { args } {}
}
class CustomHdr {
inherit Header
constructor {} { chain custom } {}
method config { args } {}
}
class SingleVlanHdr {
inherit Header
constructor {} { chain vlan } {}
method config { args } {}
}
class VlanHdr {
inherit Header
constructor {} { chain vlan APPLIST } {}
method config { args } {}
public variable objList
public variable linkToType
}
class Ipv4Hdr {
inherit Header
constructor {} { chain IPv4 } {}
method config { args } {}
}
class Ipv6Hdr {
inherit Header
constructor {} { chain IPv6 } {}
method config { args } {}
}
class Ipv6SegRoutingHdr {
inherit Header
constructor {} { chain IPv6RoutingType4 } {}
method config { args } {}
}
class TcpHdr {
inherit Header
constructor {} { chain TCP } {}
method config { args } {}
}
class IcmpHdr {
inherit Header
constructor {} { chain ICMPV2 } {}
method config { args } {}
}
class UdpHdr {
inherit Header
constructor {} { chain UDP } {}
method config { args } {}
}
class SingleMplsHdr {
inherit Header
constructor {} { chain MPLS } {}
method config { args } {}
}
class MplsHdr {
inherit Header
constructor {} { chain MPLS APPLIST } {}
method config { args } {}
public variable objList
public variable linkToType
}
class ArpHdr {
inherit Header
constructor {} { chain ethernetARP } {}
method config { args } {}
}
class CfmHdr {
inherit Header
constructor {} { chain cfm } { set opCode 0 }
method config { args } {}
public variable opCode
}
class CcmHdr {
inherit CfmHdr
constructor {} { chain } { set opCode 1 }
method config { args } {}
}
class TrillHdr {
inherit Header
constructor {} { chain Trill } {
set eg_nickname_mod 16
set ing_nickname_mod 16
set eg_nickname_step 1
set ing_nickname_step 1
set eg_nickname_num 1
set ing_nickname_num 1
}
public variable version
public variable reserved
public variable mcast_flag
public variable op_length
public variable hop_count
public variable eg_nickname
public variable eg_nickname_num
public variable eg_nickname_step
public variable eg_nickname_mod
public variable ing_nickname
public variable ing_nickname_num
public variable ing_nickname_step
public variable ing_nickname_mod
method config { args } {}
}
class GreHdr {
inherit Header
constructor {} { chain Gre } {
set checksum_present 0
set checksum 0
set key_present 0
set key 0
set sn_present 0
set sn 0
set version 0
}
public variable version
public variable gre_protocol
public variable checksum_present
public variable checksum
public variable key_present
public variable key
public variable sn_present
public variable sn
method config { args } {}
}
# -- Traffic implmentation
body Traffic::constructor { port { hTraffic NULL } } {
set tag "body Traffic::ctor [info script]"
Deputs "----- TAG: $tag -----"
set iteration_duration 10
set resolution 1
global LoadConfigMode
set traffic_name $this
set handle ""
set portObj $port
Deputs "portObj:$portObj"
if { [ catch {
set hPort [ $port cget -handle ]
} ] } {
Deputs "port:$port"
set port [ GetObject $port ]
Deputs "port:$port"
set hPort [ $port cget -handle ]
}
if { $hTraffic != "NULL" } {
set handle $hTraffic
set highLevelStream [ ixNet getL $handle configElement ]
set endpointSet [ ixNet getL $handle endpointSet ]
set modifyMode 1
} else {
if { $LoadConfigMode } {
set traffic_name [GetObjNameFromString $this]
Deputs "loadconfig Mode traffic name :$traffic_name"
set handle [GetValidHandleObj "traffic" $traffic_name $hPort]
}
if { $handle != "" } {
set highLevelStream [ ixNet getL $handle configElement ]
set endpointSet [ ixNet getL $handle endpointSet ]
set modifyMode 1
} else {
set root [ixNet getRoot]
set handle [ixNet add $root/traffic trafficItem]
ixNet commit
set handle [ ixNet remapIds $handle ]
Deputs "handle:$handle"
set modifyMode 0
ixNet setA $handle -name $this
ixNet commit
}
}
regexp {\d+} $handle id
Deputs "traffic item handle:$handle"
}
body Traffic::config { args } {
global LoadConfigMode
# in case the handle was removed
if { $handle == "" } {
Deputs "reborn traffic...."
set root [ixNet getRoot]
set handle [ixNet add $root/traffic trafficItem]
ixNet commit
set handle [ ixNet remapIds $handle ]
Deputs "handle:$handle"
regexp {\d+} $handle id
ixNet setA $handle -name $this
set port $portObj
Deputs "port:$port"
if { [ catch {
set hPort [ $port cget -handle ]
} ] } {
set port [ GetObject $port ]
set hPort [ $port cget -handle ]
}
set highLevelStream ""
Deputs "hport:$hPort"
}
# enable l1Rate use 4 bytes signature and disable data integrity check
set root [ixNet getRoot]
ixNet setA $root/traffic/statistics/l1Rates -enabled True
ixNet setA $root/traffic \
-enableDataIntegrityCheck False \
-enableMinFrameSize True
ixNet commit
# get default port Mac and IP address
Deputs "Traffic portObj: $portObj"
set default_mac [ lindex [ $portObj cget -intf_mac ] 0 ]
set default_ip [ lindex [ $portObj cget -intf_ipv4 ] 0 ]
if { ( $default_ip == "0.0.0.0" ) || ( $default_ip == "" ) } {
set default_ip 1.1.1.1
}
if { $default_mac == "" } {
set default_int [ lindex [ ixNet getL [ $portObj cget -handle ] interface ] 0 ]
Deputs "default interface:$default_int"
if { $default_int != "" } {
set default_mac [ ixNet getA $default_int/ethernet -macAddress ]
}
if { $default_mac == "::ixNet::OK" } {
Deputs "get mac error"
set default_mac "00:00:01:01:01:01"
}
}
Deputs "default mac:$default_mac"
Deputs "default ip:$default_ip"
global errorInfo
global errNumber
set EMode [ list continuous burst iteration auto custom ]
set ELenType [ list fixed incr random imix ]
set EFillType [ list constant incr decr prbs random ]
set EPayloadType [ list CYCBYTE INCRBYTE DECRBYTE PRBS USERDEFINE ]
set ELoadUnit [ list KBPS MBPS BPS FPS PERCENT ]
set ELatencyType [list lifo lilo filo fifo]
# set load_unit KBPS
# set stream_load 10000
# set frame_len 256
set enable_sig 1
set flag_modify_adv 0
set trafficType ipv4
set bidirection 0
set fullMesh 0
set backbone 0
set selfdst 0
set tos_tracking 0
set no_src_dst_mesh 0
set no_mesh 0
set pdu_index 1
set burst_gap_units "bytes"
#set burst_gap_units "nanoseconds"
set enable_burst_gap "true"
set burst_packet_count 1
set enable_min_frame_size "true"
set regenerate false
set frame_len_type fixed
set to_raw 0
set tag "body Traffic::config [info script]"
Deputs "----- TAG: $tag -----"
#param collection
Deputs "Args:$args "
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-regenerate {
set regenerate $value
}
-name {
ixNet setA $handle -name $value
ixNet commit
}
-precedence {
set precedence $value
}
-precedence_num {
set trans [ UnitTrans $value ]
if { [ string is integer $trans ] } {
set precedence_num $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-precedence_step {
set trans [ UnitTrans $value ]
if { [ string is integer $trans ] } {
set precedence_step $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-precedence_mode {
set precedence_mode [ string tolower $value ]
switch $precedence_mode {
incr {
set precedence_mode increment
}
decr {
set precedence_mode decrement
}
random {
set precedence_mode random
}
list {
set precedence_mode valueList
}
default {
set precedence_mode singleValue
}
}
}
-precedence_fullmesh {
set trans [ BoolTrans $value ]
if { $trans == "1" || $trans == "0" } {
set precedence_fullmesh $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-vlan_priority {
set vlan_priority $value
}
-vlan_priority_num {
set trans [ UnitTrans $value ]
if { [ string is integer $trans ] } {
set vlan_priority_num $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-vlan_priority_step {
set trans [ UnitTrans $value ]
if { [ string is integer $trans ] } {
set vlan_priority_step $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-vlan_priority_mode {
set vlan_priority_mode [ string tolower $value ]
switch $vlan_priority_mode {
incr {
set vlan_priority_mode increment
}
decr {
set vlan_priority_mode decrement
}
random {
set vlan_priority_mode random
}
list {
set vlan_priority_mode valueList
}
default {
set vlan_priority_mode singleValue
}
}
}
-vlan_priority_fullmesh {
set trans [ BoolTrans $value ]
if { $trans == "1" || $trans == "0" } {
set vlan_priority_fullmesh $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-mpls_exp {
set mpls_exp $value
}
-mpls_exp_num {
set trans [ UnitTrans $value ]
if { [ string is integer $trans ] } {
set mpls_exp_num $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-mpls_exp_step {
set trans [ UnitTrans $value ]
if { [ string is integer $trans ] } {
set mpls_exp_step $trans
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-mpls_exp_mode {
set mpls_exp_mode [ string tolower $value ]
switch $mpls_exp_mode {
incr {
set mpls_exp_mode increment
}
decr {
set mpls_exp_mode decrement
}
random {
set mpls_exp_mode random
}
list {
set mpls_exp_mode valueList
}
default {
set mpls_exp_mode singleValue
}
}
}
-mpls_exp_fullmesh {
set trans [ BoolTrans $value ]
if { $trans == "1" || $trans == "0" } {
set mpls_exp_fullmesh $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-frame_ordering_mode {
set root [ixNet getRoot]
if { [string tolower $value] == "rfc2889" } {
ixNet setA $root/traffic -enableStreamOrdering true
ixNet setA $root/traffic -frameOrderingMode RFC2889
} elseif { [string tolower $value] == "none" } {
ixNet setA $root/traffic -enableStreamOrdering fasle
ixNet setA $root/traffic -frameOrderingMode none
} else {
ixNet setA $root/traffic -enableStreamOrdering true
ixNet setA $root/traffic -frameOrderingMode $value
}
ixNet commit
}
-iteration_duration {
set iteration_duration [expr $value * 1000]
}
-resolution {
set resolution $value
}
-location {
set location $value
}
-enable_min_frame_size {
set enable_min_frame_size $value
}
-src {
set src $value
}
-dst {
set dst $value
}
-full_mesh {
set fullMesh $value
}
-pdu {
set pdu $value
Deputs "pdu:$pdu"
}
-modify_stream_pdu {
set modify_pdu $value
Deputs "modify_pdu:$modify_pdu"
}
-bound_stream_pdu {
set boun_pdu $value
Deputs "boun_pdu:$boun_pdu"
}
-pdu_index {
set pdu_index $value
}
-tx_mode {
set value [ string tolower $value ]
if { [ lsearch -exact $EMode $value ] >= 0 } {
set tx_mode $value
} else {
error "$errNumber(1) key:$key value:$value"
}
}
-tx_num {
if { [ string is integer $value ] } {