-
Notifications
You must be signed in to change notification settings - Fork 1
/
vtmsIxiaUtils.lib
9316 lines (7744 loc) · 384 KB
/
vtmsIxiaUtils.lib
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
# $Id: vtmsIxiaUtils.lib,v 1.9 2010/07/21 22:39:40 kvieira Exp $
# Copyright (c) 2005 by Cisco Systems, Inc.
#
# Author: Michael Fingleton
#
# Support Alias:
#
# Usage:
# set auto_path [linsert $auto_path 0 \
# [file join $env(AUTOTEST) regression lib mid_range_routing]]
# package require VtmsIxiaUtils
# namespace import vtmsIxiaUtils::*
#
#
# Purpose / Description :
# This file contains common procedures used in VTMS test scripts
# It also contains the definitions for various MyMIX distributions
# These are variations on the IMIX theme - sequences of packets with
# various average datagram lengths from 100 bytes -> 700 bytes
#
# Any changes to procedures in this file must be cleared with
# [email protected] and/or [email protected]
#
# Note:
# This library contains a lot of functionality that should now
# be available through the HLTAPI.
# I am committing this library so I can start to commit VTMS
# scripts that have been sitting around for a while.
# New users should look to use the IXIA HLTAPI rather than procedures
# in this library to avoid future support issues.
#
#
# List of Procedures in this file:
#
# For Receiving Port
# ------------------
# IXIA_GE_Basic_Config
# IXIA_POS_Basic_Config
#
#
# For Sending Port
# ----------------
# IXIA_Create_IMIX_GE
# IXIA_Update_IPG_IMIX_GE
#
# IXIA_Create_Bursty_GE
# IXIA_Update_IBG_Bursty_GE
#
# IXIA_Create_BasicStream_GE
# IXIA_Add_BasicStream_GE
# IXIA_Update_IPG_BasicStream_GE
# IXIA_Simply_Update_IPG_BasicStream_GE
#
# IXIA_Create_IMIX_POS
# IXIA_Update_IPG_IMIX_POS
#
# IXIA_Create_BasicStream_POS
# IXIA_Update_IPG_BasicStream_POS
#
# IXIA_Create_MyMIX_GE
# IXIA_Update_IPG_MyMIX_GE
#
# Filters / Rates and Stats
# -------------------------
# ixia_measure_rates
# ixia_measure_vc_rates
# ixia_add_rx_filter
# ixia_read_stats
# pps2bps
#
namespace eval vtmsIxiaUtils {
namespace export *
}
##########################################################################
#MyMIX Definitions
set Definition(MyMIX335) {46 138 167 412 992 94 239 418 691 83 142 671 50 \
263 416 288 1500 876 312 57 93 241 52 102 52}
set Definition(MyMIX100) {46 52 70 52 62 54 101 72 51 56 72 51 50 \
45 52 89 1100 76 52 47 53 46 47 52 52}
set Definition(MyMIX200) {46 72 91 412 62 94 201 52 571 83 142 71 50 \
63 312 189 1500 76 312 67 93 241 46 102 52}
set Definition(MyMIX300) {46 172 91 592 162 94 501 52 871 53 176 91 120 \
163 311 188 1500 274 342 167 93 841 146 302 152}
set Definition(MyMIX400) {46 272 91 792 131 64 591 52 1071 153 176 191 170 \
263 371 288 1500 774 342 637 193 841 446 393 152}
set Definition(MyMIX500) {46 472 91 828 331 64 591 352 1371 253 176 191 170 \
477 371 488 1500 774 592 837 193 1041 546 393 352}
set Definition(MyMIX600) {46 609 93 951 311 162 591 391 1301 503 106 391 291 \
499 632 688 1500 1074 504 891 293 1412 596 483 682}
set Definition(MyMIX700) {46 812 203 1051 311 162 591 409 1250 782 191 492 491 \
499 1002 688 1500 1074 819 891 503 1412 596 813 912}
set Definition(IMIX_A) {46 46 46 46 46 46 46 552 552 552 552 1500}
set Definition(IMIX_B) {46 46 46 552 552 552 552 46 46 46 46 1500}
set Definition(IMIX_C) {46 46 46 46 46 46 46 552 552 1500 552 552}
set Definition(MyMIX_PQ) {59 64 59 63 63 55 64 62 62 69 59 65}
set Definition(MyMIX_BT) {46 46 552 552 1500 46 46 46 552 1500 552 46 1500}
##########################################################################
procDescr vtmsIxiaUtils::get_avg_mymix_length {
Description:
Returns the average datagram length for a given mymix distribution.
Usage: get_avg_mymix_length <mymix_definition>
}
proc vtmsIxiaUtils::get_avg_mymix_length {mymix_definition} {
set total_length 0
set number_of_packets [llength $mymix_definition]
foreach packet_length $mymix_definition {
set total_length [expr $total_length + $packet_length]
}
set avg_length [mpexpr $total_length.0 / $number_of_packets.0]
return $avg_length
}
##########################################################################
procDescr vtmsIxiaUtils::getmaskfromBits {
Procedure pulled from pimlib.exp - thanks..
Duplicated here to ensure it's always available in it's current
form for VTMS scripts.
Description:
Converts a mask from a number of bits format to a dotted decimal format.
Usage: gatmaskfromBits <number of bits>
Returns: mask in dotted decimal format
}
proc vtmsIxiaUtils::getmaskfromBits { bits } {
if { $bits >= 24 } {
set byte1 255
set byte2 255
set byte3 255
set byte4 [expr [expr 0xff << [expr 32 - $bits]] & 0xff]
} elseif { $bits >= 16 } {
set byte1 255
set byte2 255
set byte3 [expr [expr 0xff << [expr 24 - $bits]] & 0xff]
set byte4 0
} elseif { $bits >= 8 } {
set byte1 255
set byte2 [expr [expr 0xff << [expr 16 - $bits]] & 0xff]
set byte3 0
set byte4 0
} else {
set byte1 [expr [expr 0xff << [expr 8 - $bits]] & 0xff]
set byte2 0
set byte3 0
set byte4 0
}
return "$byte1.$byte2.$byte3.$byte4"
}
##########################################################################
procDescr vtmsIxiaUtils::IXIA_Create_IMIX_GE {
Description:
This procedure creates an IMIX stream on an IXIA GE port
It will start by resetting the port to ensure we're starting
with a clean slate.
Usage:
IXIA_Create_IMIX_GE $port -dstIp <destination IP addr> \
-dstMac <destination mac addr> \
-isg <inter stream gap in nanoseconds> \
[-srcIp <source IP addr>] \
[-srcMac <source mac addr>] \
[-prec <0|1|2|3|4|5|6|7|ATM>] \
[-latencyStamp <true|false>] \
[-autoNegotiation <true|false>] \
[-mediaType <GBIC|RJ45>]
Example:
IXIA_Create_IMIX_GE {1 5 1} -srcIp 10.0.0.2 -dstIp 12.2.1.2 \
-isg 10000000 \
-srcMac {00 c0 10 00 00 02} \
-dstMac {22 22 22 22 22 22} -prec 4
Arguments are self explainatory except for -prec
If this is set to ATM then each packet size in an IMIX distribution is
marked with a different precedence value.
This is required to when figuring how many of each size packets were
received / dropped when the interface under test is ATM.
If set to a numeric value all packets are marked with that same
precedence.
The value configured for ISG is not that important - it should be modified
later by IXIA_Update_IPG_IMIX_GE.
Returns: Nothing
}
proc vtmsIxiaUtils::IXIA_Create_IMIX_GE {IXIA_Port args} {
#Source IP
if {[lsearch $args -srcIp] != -1} {
set variable_position [lsearch $args -srcIp]
set SourceIP [lindex $args [expr $variable_position +1]]
} else {
#Source IP doesn't really matter so I'll arbitrarily pick a default
set SourceIP 10.10.10.1
}
#Destination IP
if {[lsearch $args -dstIp] != -1} {
set variable_position [lsearch $args -dstIp]
set DestinationIP [lindex $args [expr $variable_position +1]]
}
#Source MAC Address
if {[lsearch $args -srcMac] != -1} {
set variable_position [lsearch $args -srcMac]
set SourceMAC [lindex $args [expr $variable_position +1]]
} else {
#Source MAC doesn't really matter so I'll arbitrarily pick a default
set SourceMAC "00 c0 01 01 01 01"
}
#Destination MAC Address
if {[lsearch $args -dstMac] != -1} {
set variable_position [lsearch $args -dstMac]
set DestinationMAC [lindex $args [expr $variable_position +1]]
}
#Inter Stream Gap
if {[lsearch $args -isg] != -1} {
set variable_position [lsearch $args -isg]
set InterStreamGap [lindex $args [expr $variable_position +1]]
}
#IP Precedence
#For ATM IMIX Tests Precedence is used to differentiate number of packet of
#each size that are received - this is necessary as the cell tax
#(L2 overhead) is different for each packet size.
if {[lsearch $args -prec] != -1} {
set variable_position [lsearch $args -prec]
set IPprecedence [lindex $args [expr $variable_position +1]]
} else {
set IPprecedence 0
}
#Enable_Latency
if {[lsearch $args -latencyStamp] != -1} {
set variable_position [lsearch $args -latencyStamp]
set enable_latency [lindex $args [expr $variable_position +1]]
} else {
set enable_latency false
}
#GE Autonegotiation
if {[lsearch $args -autoNegotiation] != -1} {
set variable_position [lsearch $args -autoNegotiation]
set autonegotiation [lindex $args [expr $variable_position +1]]
} else {
#Negotiation will usually
set autonegotiation false
}
#Media Type - GBIC or RJ45
#Need to keep autonegotiation enabled for RJ45 / limit speed to 1000
if {[lsearch $args -mediaType] != -1} {
set variable_position [lsearch $args -mediaType]
set mediaType [lindex $args [expr $variable_position +1]]
} else {
set mediaType GBIC
}
set Chassis [lindex $IXIA_Port 0]
set Card [lindex $IXIA_Port 1]
set Port [lindex $IXIA_Port 2]
#IMIX Packet Lengths on GE
#0 is just so lengths are in positions 1 - 12
set IMIX_Packet_Length { 0 64 64 570 64 64 570 64 1518 570 64 64 570 }
set ATM_Precedence_Distribution { 0 1 1 2 1 1 2 1 3 2 1 1 2 }
#Return the Ports to Factory Defaults
if {$tgen_app == "IxExplorer"} {
port setFactoryDefaults $Chassis $Card $Port
sleep 2
# #For new dual phy mode interfaces set phy mode first
# if {[string match $mediaType "fiber"]} {
# port setPhyMode portPhyModeFiber $chassis $card $port
# }
if {([string match $mediaType "GBIC"]) || \
([string match $mediaType "fiber"]) } {
port setPhyMode portPhyModeFiber $Chassis $Card $Port
port config -autonegotiate $autonegotiation
port config -duplex full
} else {
port config -autonegotiate true
port config -advertise1000FullDuplex true
port config -advertise100FullDuplex false
port config -advertise100HalfDuplex false
port config -advertise10FullDuplex false
port config -advertise10HalfDuplex false
}
port config -numAddresses 1
port config -MacAddress $SourceMAC
port set $Chassis $Card $Port
port write $Chassis $Card $Port
for {set looper 1} {$looper <= 12} {incr looper} {
ip config -sourceIpAddr $SourceIP
ip config -destIpAddr $DestinationIP
ip config -destClass classA
ip config -sourceClass classA
if {[string match $IPprecedence "ATM"]} {
ip config -precedence [lindex $ATM_Precedence_Distribution $looper]
} else {
ip config -precedence $IPprecedence
}
ip set $Chassis $Card $Port
protocol config -ethernetType EthernetII
protocol config -name ipV4
stream config -sa $SourceMAC
stream config -da $DestinationMAC
stream config -name IMIX_Stream
stream config -framesize [lindex $IMIX_Packet_Length $looper]
if {$looper < 12} {
stream config -dma advance
} else {
stream config -dma gotoFirst
}
stream config -numFrames 1
stream config -gapUnit gapNanoSeconds
stream config -enableIbg false
stream config -enableIsg true
stream config -isg $InterStreamGap
if {[string match $enable_latency "true"]} {
stream config -enableTimestamp true
}
stream config -patternType repeat
stream config -dataPattern xAAAA
stream set $Chassis $Card $Port $looper
stream write $Chassis $Card $Port $looper
if {[string match $enable_latency "true"]} {
#Enable TimeStamps for latency measurements
# - using same groupID for all streams
packetGroup setDefault
packetGroup config -insertSignature true
packetGroup config -groupId 1
packetGroup setTx $Chassis $Card $Port $looper
}
}
}
if {$tgen_app == "IxNetwork"} {
set vports [interp eval $::ixia::TclInterp " ixNet getList [ixNet getRoot] vport "]
foreach vportHdl $vports {
set vportObj [interp eval $::ixia::TclInterp " ixNet getA $vportHdl -connectedTo "]
if {[regexp -nocase ".*card:$Card\/port:$Port" $vportObj match]} {
set vportHandle $vportHdl
}
}
if {([string match $mediaType "GBIC"]) || \
([string match $mediaType "fiber"]) } {
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -media fiber "
set setPhyMode [interp eval $::ixia::TclInterp " ixNet getA $vportHandle/l1Config/ethernet -media "]
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -autoNegotiate $autonegotiation "
interp eval $::ixia::TclInterp " ixNet setA $vportHandle/l1Config/ethernet -speedAuto all "
interp eval $::ixia::TclInterp " ixNet commit "
} else {
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -autoNegotiate true "
interp eval $::ixia::TclInterp " ixNet setA $vportHandle/l1Config/ethernet -speedAuto speed1000 "
interp eval $::ixia::TclInterp " ixNet commit "
}
set interfaceObj [interp eval $::ixia::TclInterp " ixNet getL $vportHandle interface "]
interp eval $::ixia::TclInterp " ixNet setA [lindex $interfaceObj 0]/ethernet -macAddress $SourceMAC "
interp eval $::ixia::TclInterp " ixNet commit "
set port1 $Chassis/$Card/$Port
for {set looper 1} {$looper <= 12} {incr looper} {
if {[string match $IPprecedence "ATM"]} {
#ip config -precedence [lindex $ATM_Precedence_Distribution $looper]
set IpPrecedence [lindex $ATM_Precedence_Distribution $looper]
} else {
#ip config -precedence $IPprecedence
set IpPrecedence $IPprecedence
}
if {[string match $enable_latency "true"]} {
#stream config -enableTimestamp true
set enableTimestamp 1
} else {
set enableTimestamp 0
}
if {[string match $enable_latency "true"]} {
#Enable TimeStamps for latency measurements
# - using same groupID for all streams
#packetGroup setDefault
#packetGroup config -insertSignature true
#packetGroup config -groupId 1
#packetGroup setTx $Chassis $Card $Port $looper
puts "Not required"
}
set frameSize [lindex $IMIX_Packet_Length $looper]
if {[regexp {(\.)} $SourceIP matched]} {
set trafficConfig [::ixia::traffic_config -mode create -port_handle $port1 -l3_protocol ipv4 -ip_src_addr $SourceIP -ip_dst_addr $DestinationIP -ip_precedence $IpPrecedence \
-ethernet_type ethernetII -mac_src $SourceMAC -mac_dst $DestinationMAC -frame_size $frameSize -length_mode imix -inter_burst_gap $InterStreamGap -inter_stream_gap 1 \
-transmit_mode continuous_burst -enable_time_stamp $enableTimestamp -data_pattern_mode repeating -data_pattern xAAAA]
}
if {[regexp {(\:)} $SourceIP matched]} {
set trafficConfig [::ixia::traffic_config -mode create -port_handle $port1 -l3_protocol ipv6 -ipv6_src_addr $SourceIP -ipv6_dst_addr $DestinationIP -ip_precedence $IpPrecedence \
-ethernet_type ethernetII -mac_src $SourceMAC -mac_dst $DestinationMAC -frame_size $frameSize -length_mode imix -inter_burst_gap $InterStreamGap -inter_stream_gap 1 \
-transmit_mode continuous_burst -enable_time_stamp $enableTimestamp -data_pattern_mode repeating -data_pattern xAAAA]
}
}
}
}
##########################################################################
procDescr vtmsIxiaUtils::IXIA_Update_IPG_IMIX_GE {
Description:
This procedure changes the ISG for each stream in an IMIX
packet distribution on a GE port based on the required packets
per second.
The stream should first be configured using IXIA_Create_IMIX_GE
Usage: IXIA_Update_IPG_IMIX_GE $port -sendPps <required tx pps rate>
Example: IXIA_Update_IPG_IMIX_GE {1 1 2} -sendPps 100
Returns: Nothing
}
proc vtmsIxiaUtils::IXIA_Update_IPG_IMIX_GE {IXIA_Port args} {
#Desired PPS send rate
if {[lsearch $args -sendPps] != -1} {
set variable_position [lsearch $args -sendPps]
set SendPPS [lindex $args [expr $variable_position +1]]
}
set Chassis [lindex $IXIA_Port 0]
set Card [lindex $IXIA_Port 1]
set Port [lindex $IXIA_Port 2]
#Need to calculate the Inter Stream Gap for IMIX Traffic
set AvgIMIXDatagramSize 335.83
#Knowing how many pps translate this to GE bps (note on GE it takes 1 nS to
#transmit 1 bit.
#For some reason with IMIX calculation are not acheiving the rates I desire
#The 60 in the equation below is a penalty to make things work properly
#This effectively decreases the IPG on IXIA - seems to make everything work
#as expected.
#The value 60 was achieved through experimentation
#
#Also note that with IMIX IXIA can't send more than 83% linerate on IXIA
#Removing 60 byte penalty doesn't get you beyond 83%
set GESendBPS [expr $SendPPS * ($AvgIMIXDatagramSize + 38 + 60) * 8]
#Calculate the GE Gaps (ie time not being used by above
set GETotalGap [expr 1000000000.0 - $GESendBPS]
#Need to avoid /0 errors when a stream has 0 percent load
if {$SendPPS == 0 } {
set SendPPS .001
}
#Inter Packet Gap
set IPG [expr $GETotalGap / $SendPPS]
if {$tgen_app == "IxExplorer"} {
for {set StreamID 1} {$StreamID <= 12} {incr StreamID} {
stream get $Chassis $Card $Port $StreamID
stream config -isg $IPG
stream set $Chassis $Card $Port $StreamID
stream write $Chassis $Card $Port $StreamID
}
}
if {$tgen_app == "IxNetwork"} {
set port1 $Chassis/$Card/$Port
for {set StreamID 1} {$StreamID <= 12} {incr StreamID} {
set trafficConfig [::ixia::traffic_config -mode modify -port_handle $port1 -inter_burst_gap $IPG -stream_id $StreamID]
}
}
}
##########################################################################
procDescr vtmsIxiaUtils::IXIA_GE_Basic_Config {
Description:
This procedure creates resets a GE port to it's basic config
and then removes autonegotiation / sets duplex etc.
Creates basic config needed to bring GE up so it can be used
to count pkts.
Usage:
IXIA_GE_Basic_Config port [-autoNegotiation <true|false>] \
[-macAddress <addr for this port>] \
[-qosStatsMode <true|false>] \
[-packetGroupMode <true|false>] \
[-mediaType <GBIC|RJ45>]
Defaults:
-autonegotiation : false = no autonegotiation
-macAddress : {00 c0 ab ad ca fe} - doesn't really matter what this is
-qosStatsMode : false
-packetGroupMode : false
-mediaType : GBIC
Example:
IXIA_GE_Basic_Config {1 1 2} -MACaddress {00 c0 12 01 00 02} \
-packetgroupmode true
Returns: Nothing
}
proc vtmsIxiaUtils::IXIA_GE_Basic_Config {IXIA_Port args} {
#IXIA MAC Address
if {[lsearch $args -macAddress] != -1} {
set variable_position [lsearch $args -macAddress]
set IXIA_MAC [lindex $args [expr $variable_position +1]]
} else {
#Makey upey address
set IXIA_MAC {00 c0 ab ad ca fe}
}
#Enable Packet Groups Mode
if {[lsearch $args -packetGroupMode] != -1} {
set variable_position [lsearch $args -packetGroupMode]
set EnablePacketGroupMode [lindex $args [expr $variable_position +1]]
} else {
set EnablePacketGroupMode false
}
#Enable QOS Stats Mode
if {[lsearch $args -qosStatsMode] != -1} {
set variable_position [lsearch $args -qosStatsMode]
set EnableQOSStatsMode [lindex $args [expr $variable_position +1]]
} else {
set EnableQOSStatsMode false
}
#GE Autonegotiation
if {[lsearch $args -autoNegotiation] != -1} {
set variable_position [lsearch $args -autoNegotiation]
set autonegotiation [lindex $args [expr $variable_position +1]]
} else {
#Negotiation will usually
set autonegotiation false
}
#Media Type - GBIC or RJ45
#Need to keep autonegotiation enabled for RJ45 / limit speed to 1000
if {[lsearch $args -mediaType] != -1} {
set variable_position [lsearch $args -mediaType]
set mediaType [lindex $args [expr $variable_position +1]]
} else {
set mediaType GBIC
}
set Chassis [lindex $IXIA_Port 0]
set Card [lindex $IXIA_Port 1]
set Port [lindex $IXIA_Port 2]
if {$tgen_app == "IxExplorer"} {
port setFactoryDefaults $Chassis $Card $Port
sleep 2
#Configure the Receiving GE Port
if {([string match $mediaType "GBIC"]) || \
([string match $mediaType "fiber"]) } {
port setPhyMode portPhyModeFiber $Chassis $Card $Port
port config -autonegotiate $autonegotiation
port config -duplex full
} else {
port config -autonegotiate true
port config -advertise1000FullDuplex true
port config -advertise100FullDuplex false
port config -advertise100HalfDuplex false
port config -advertise10FullDuplex false
port config -advertise10HalfDuplex false
}
port config -numAddresses 1
port config -MacAddress $IXIA_MAC
port set $Chassis $Card $Port
port write $Chassis $Card $Port
if {[string match $EnablePacketGroupMode "true"]} {
packetGroup setDefault
packetGroup config -latencyControl cutThrough
packetGroup setRx $Chassis $Card $Port
port setReceiveMode portPacketGroup $Chassis $Card $Port
port set $Chassis $Card $Port
}
if {[string match $EnableQOSStatsMode "true"]} {
port setReceiveMode portCapture $Chassis $Card $Port
port set $Chassis $Card $Port
stat config -mode statQos
stat set $Chassis $Card $Port
stat write $Chassis $Card $Port
}
stream set $Chassis $Card $Port 1
stream write $Chassis $Card $Port 1
}
if {$tgen_app == "IxNetwork"} {
#port setFactoryDefaults $Chassis $Card $Port
#sleep 2
#Configure the Receiving GE Port
set vports [interp eval $::ixia::TclInterp " ixNet getList [ixNet getRoot] vport "]
foreach vportHdl $vports {
set vportObj [interp eval $::ixia::TclInterp " ixNet getA $vportHdl -connectedTo "]
if {[regexp -nocase ".*card:$card\/port:$port" $vportObj match]} {
set vportHandle $vportHdl
}
}
if {([string match $mediaType "GBIC"]) || \
([string match $mediaType "fiber"]) } {
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -media fiber "
set setPhyMode [interp eval $::ixia::TclInterp " ixNet getA $vportHandle/l1Config/ethernet -media "]
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -autoNegotiate $autonegotiation "
interp eval $::ixia::TclInterp " ixNet setA $vportHandle/l1Config/ethernet -speedAuto all "
interp eval $::ixia::TclInterp " ixNet commit "
#port setPhyMode portPhyModeFiber $Chassis $Card $Port
#port config -autonegotiate $autonegotiation
#port config -duplex full
} else {
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -autoNegotiate true "
interp eval $::ixia::TclInterp " ixNet setA $vportHandle/l1Config/ethernet -speedAuto speed1000 "
interp eval $::ixia::TclInterp " ixNet commit "
#port config -autonegotiate true
#port config -advertise1000FullDuplex true
#port config -advertise100FullDuplex false
#port config -advertise100HalfDuplex false
#port config -advertise10FullDuplex false
#port config -advertise10HalfDuplex false
}
set interfaceObj [interp eval $::ixia::TclInterp " ixNet getL $vportHandle interface "]
interp eval $::ixia::TclInterp " ixNet setA [lindex $interfaceObj 0]/ethernet -macAddress $IXIA_MAC "
interp eval $::ixia::TclInterp " ixNet commit "
#port config -numAddresses 1
#port config -MacAddress $IXIA_MAC
#port set $Chassis $Card $Port
#port write $Chassis $Card $Port
if {[string match $EnablePacketGroupMode "true"]} {
interp eval $::ixia::TclInterp " ixNet setA $vportHdl -rxMode captureAndMeasure "
interp eval $::ixia::TclInterp " ixNet commit "
#packetGroup setDefault
#packetGroup config -latencyControl cutThrough
#packetGroup setRx $Chassis $Card $Port
#port setReceiveMode portPacketGroup $Chassis $Card $Port
#port set $Chassis $Card $Port
}
if {[string match $EnableQOSStatsMode "true"]} {
interp eval $::ixia::TclInterp " ixNet setA $vportHdl -rxMode captureAndMeasure "
interp eval $::ixia::TclInterp " ixNet commit "
#port setReceiveMode portCapture $Chassis $Card $Port
#port set $Chassis $Card $Port
#stat config -mode statQos
#stat set $Chassis $Card $Port
#stat write $Chassis $Card $Port
}
#stream set $Chassis $Card $Port 1
#stream write $Chassis $Card $Port 1
}
}
##########################################################################
procDescr vtmsIxiaUtils::IXIA_Create_Bursty_GE {
Description:
This procedure creates an Bursty stream on an IXIA GE port
It will start by resetting the port to ensure we're starting
with a clean slate.
Usage:
IXIA_Create_Bursty_GE $port -dstIp <destination IP> \
-dstMac <destination mac addr> \
[-srcIp <source IP>] \
[-srcMac <source mac addr>] \
[-ibg <inter burst gap -nanosecs>] \
[-prec <IP Precedence>] \
[-latencyStamp <true|false>] \
[-datagramLength <length in bytes>] \
[-packetsPerBurst <num>] \
[-autoNegotiation <true|false>] \
[-mediaType <GBIC|RJ45>]
Defaults:
-srcMac : "00 c0 01 01 01 01" - generally doesn't matter what this is
-srcIp : 10.10.10.1 - often doesn't matter what this is
-ibg : 200000000 - will be changed later using IXIA_Update_IBG_Bursty_GE
-prec : 0
-latencyStamp : false
-datagramLength : 62 (80 byte GE frame)
-packetsPerBurst : 20
-autoNegotiation : false => no autonegotiation
-mediaType : GBIC
Example:
IXIA_Create_Bursty_GE {1 1 1} -srcIP 10.1.0.2 -dstIP 12.1.0.2 \
-ibg 200000000 -latency_stamp true \
-srcMAC {00 c0 10 01 00 02} \
-dstMAC {00 c0 10 01 00 01} -prec 5 \
-Packets_Per_Burst 20 \
-DatagramLength 100
Returns: Nothing
}
proc vtmsIxiaUtils::IXIA_Create_Bursty_GE {IXIA_Port args} {
#Source IP
if {[lsearch $args -srcIp] != -1} {
set variable_position [lsearch $args -srcIp]
set SourceIP [lindex $args [expr $variable_position +1]]
} else {
#Source IP doesn't really matter so I'll arbitrarily pick a default
set SourceIP 10.10.10.1
}
#Destination IP
if {[lsearch $args -dstIp] != -1} {
set variable_position [lsearch $args -dstIp]
set DestinationIP [lindex $args [expr $variable_position +1]]
}
#Source MAC Address
if {[lsearch $args -srcMac] != -1} {
set variable_position [lsearch $args -srcMac]
set SourceMAC [lindex $args [expr $variable_position +1]]
} else {
#Source MAC doesn't really matter so I'll arbitrarily pick a default
set SourceMAC "00 c0 01 01 01 01"
}
#Destination MAC Address
if {[lsearch $args -dstMac] != -1} {
set variable_position [lsearch $args -dstMac]
set DestinationMAC [lindex $args [expr $variable_position +1]]
}
#Inter Burst Gap
if {[lsearch $args -ibg] != -1} {
set variable_position [lsearch $args -ibg]
set InterBurstGap [lindex $args [expr $variable_position +1]]
} else {
set InterBurstGap 200000000
}
#IP Precedence
if {[lsearch $args -prec] != -1} {
set variable_position [lsearch $args -prec]
set IPprecedence [lindex $args [expr $variable_position +1]]
} else {
set IPprecedence 0
}
#Enable_Latency
if {[lsearch $args -latencyStamp] != -1} {
set variable_position [lsearch $args -latencyStamp]
set enable_latency [lindex $args [expr $variable_position +1]]
} else {
set enable_latency false
}
#How Many Packets Should be in each Burst
if {[lsearch $args -packetsPerBurst] != -1} {
set variable_position [lsearch $args -packetsPerBurst]
set PacketsPerBurst [lindex $args [expr $variable_position +1]]
} else {
set PacketsPerBurst 20
}
#Datagram Length for all packets to be used in burst
if {[lsearch $args -datagramLength] != -1} {
set variable_position [lsearch $args -datagramLength]
set DatagramLength [lindex $args [expr $variable_position +1]]
set GE_PacketSize [expr $DatagramLength + 18]
} else {
set GE_PacketSize 80
}
#GE Autonegotiation
if {[lsearch $args -autoNegotiation] != -1} {
set variable_position [lsearch $args -autoNegotiation]
set autonegotiation [lindex $args [expr $variable_position +1]]
} else {
#Negotiation will usually
set autonegotiation false
}
#Media Type - GBIC or RJ45
#Need to keep autonegotiation enabled for RJ45 / limit speed to 1000
if {[lsearch $args -mediaType] != -1} {
set variable_position [lsearch $args -mediaType]
set mediaType [lindex $args [expr $variable_position +1]]
} else {
set mediaType GBIC
}
set Chassis [lindex $IXIA_Port 0]
set Card [lindex $IXIA_Port 1]
set Port [lindex $IXIA_Port 2]
#Return the Ports to Factory Defaults
if {$tgen_app == "IxExplorer"} {
port setFactoryDefaults $Chassis $Card $Port
sleep 2
if {([string match $mediaType "GBIC"]) || \
([string match $mediaType "fiber"]) } {
port setPhyMode portPhyModeFiber $Chassis $Card $Port
port config -autonegotiate $autonegotiation
port config -duplex full
} else {
port config -autonegotiate true
port config -advertise1000FullDuplex true
port config -advertise100FullDuplex false
port config -advertise100HalfDuplex false
port config -advertise10FullDuplex false
port config -advertise10HalfDuplex false
}
port config -numAddresses 1
port config -MacAddress $SourceMAC
port set $Chassis $Card $Port
port write $Chassis $Card $Port
#Create 1 Streams with 0 IPG and calculated ISG
ip config -sourceIpAddr $SourceIP
ip config -destIpAddr $DestinationIP
ip config -destClass classA
ip config -sourceClass classA
ip config -precedence $IPprecedence
ip set $Chassis $Card $Port
protocol config -ethernetType EthernetII
protocol config -name ipV4
stream config -sa $SourceMAC
stream config -da $DestinationMAC
stream config -name Bursty_Stream
stream config -framesize $GE_PacketSize
stream config -dma gotoFirst
stream config -numFrames 20
stream config -gapUnit gapNanoSeconds
stream config -enableIbg false
stream config -enableIsg true
stream config -rateMode useGap
stream config -ifg 1
stream config -isg $InterBurstGap
if {[string match $enable_latency "true"]} {
stream config -enableTimestamp true
}
stream config -patternType repeat
stream config -dataPattern xAAAA
stream set $Chassis $Card $Port 1
stream write $Chassis $Card $Port 1
if {[string match $enable_latency "true"]} {
#Enable TimeStamps for latency measurements
# - using same groupID for all streams
packetGroup setDefault
packetGroup config -insertSignature true
packetGroup config -groupId 1
packetGroup setTx $Chassis $Card $Port 1
}
}
if {$tgen_app == "IxNetwork"} {
#port setFactoryDefaults $Chassis $Card $Port
#sleep 2
set vports [interp eval $::ixia::TclInterp " ixNet getList [ixNet getRoot] vport "]
foreach vportHdl $vports {
set vportObj [interp eval $::ixia::TclInterp " ixNet getA $vportHdl -connectedTo "]
if {[regexp -nocase ".*card:$Card\/port:$Port" $vportObj match]} {
set vportHandle $vportHdl
}
}
if {([string match $mediaType "GBIC"]) || \
([string match $mediaType "fiber"]) } {
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -media fiber "
set setPhyMode [interp eval $::ixia::TclInterp " ixNet getA $vportHandle/l1Config/ethernet -media "]
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -autoNegotiate $autonegotiation "
interp eval $::ixia::TclInterp " ixNet setA $vportHandle/l1Config/ethernet -speedAuto all "
interp eval $::ixia::TclInterp " ixNet commit "
#port setPhyMode portPhyModeFiber $Chassis $Card $Port
#port config -autonegotiate $autonegotiation
#port config -duplex full
} else {
interp eval $::ixia::TclInterp " ixNet setAttribute $vportHandle/l1Config/ethernet -autoNegotiate true "
interp eval $::ixia::TclInterp " ixNet setA $vportHandle/l1Config/ethernet -speedAuto speed1000 "
interp eval $::ixia::TclInterp " ixNet commit "
#port config -autonegotiate true
#port config -advertise1000FullDuplex true
#port config -advertise100FullDuplex false
#port config -advertise100HalfDuplex false
#port config -advertise10FullDuplex false
#port config -advertise10HalfDuplex false
}
set interfaceObj [interp eval $::ixia::TclInterp " ixNet getL $vportHandle interface "]
interp eval $::ixia::TclInterp " ixNet setA [lindex $interfaceObj 0]/ethernet -macAddress $SourceMAC "
interp eval $::ixia::TclInterp " ixNet commit "
#port config -numAddresses 1
#port config -MacAddress $SourceMAC
#port set $Chassis $Card $Port
#port write $Chassis $Card $Port
#Create 1 Streams with 0 IPG and calculated ISG
set port1 $Chassis/$Card/$Port
set enableTimestamp 1
#ip config -sourceIpAddr $SourceIP
#ip config -destIpAddr $DestinationIP
#ip config -destClass classA
#ip config -sourceClass classA
#ip config -precedence $IPprecedence
#ip set $Chassis $Card $Port
#protocol config -ethernetType EthernetII
#protocol config -name ipV4
#stream config -sa $SourceMAC
#stream config -da $DestinationMAC
#stream config -name Bursty_Stream
#stream config -framesize $GE_PacketSize
#stream config -dma gotoFirst
#stream config -numFrames 20
#stream config -gapUnit gapNanoSeconds
#stream config -enableIbg false
#stream config -enableIsg true
#stream config -rateMode useGap
#stream config -ifg 1
#stream config -isg $InterBurstGap
if {[string match $enable_latency "true"]} {
#stream config -enableTimestamp true