-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIxia_NetNgpfDot1xRate.tcl
More file actions
246 lines (212 loc) · 6.27 KB
/
Ixia_NetNgpfDot1xRate.tcl
File metadata and controls
246 lines (212 loc) · 6.27 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
# Copyright (c) Ixia technologies 2010-2011, Inc.
# Release Version 1.0
#===============================================================================
# Change made
# Version 1.0
# 1. Create
class Dot1xRate {
inherit NetNgpfObject
constructor {} {}
method reborn {} {}
method config { args } {}
method unconfig {} {
chain
}
}
body Dot1xRate::reborn {} {
if { [ info exists handle ] == 0 || $handle == "" } {
set root [ixNet getRoot]
set handle [ ixNet add $root/quickTest dot1xRate ]
ixNet setA $handle -name $this -mode existingMode
ixNet commit
set handle [lindex [ixNet remapIds $handle] 0]
ixNet commit
}
}
body Dot1xRate::constructor {} {
set tag "body Dot1xRate::ctor [info script]"
Deputs "----- TAG: $tag -----"
reborn
}
body Dot1xRate::config { args } {
global errorInfo
global errNumber
set tag "body Dot1xRate::config [info script]"
Deputs "----- TAG: $tag -----"
set algorithmtype "custom"
set maxoutstandingreq 10
set numofsupplicants 1000
set no_run 0
foreach { key value } $args {
set key [string tolower $key]
switch -exact -- $key {
-test_ports {
set testendpoints $value
}
-max_outstanding_req {
set maxoutstandingreq $value
}
-num_of_supplicants {
set numofsupplicants $value
}
-trial {
set trial $value
}
-algorithm_type {
set algorithmtype $value
}
-custom_list {
set customlist $value
}
-wait_time {
set waittime $value
}
-resultdir {
set resultdir $value
}
-resultfile {
set resultfile $value
}
-no_run {
set no_run $value
}
default {
error "$errNumber(3) key:$key value:$value"
}
}
}
# reborn
if { $handle == "" } {
Deputs "Step10"
reborn
}
Deputs "Step20"
if { [ info exists testendpoints ] == 0 } {
Deputs "Step30"
error "$errNumber(2) key:test_endpoints"
}
foreach testport $testendpoints {
set hPort [$testport cget -handle]
#set protocolhandle [ixNet getL $hPort/protocolStack dot1xOptions]
set protocolhandle [ixNet add $hPort/protocolStack dot1xOptions]
ixNet commit
set protocolhandle [ixNet remapIds $protocolhandle]
if { $protocolhandle != "" } {
set pshandle [lindex [ixNet getL $hPort protocolStack] 0]
set sg_resource [ixNet add $handle resource]
ixNet setMultiAttr $sg_resource \
-groupId {StackManager} \
-id $pshandle
ixNet commit
set sg_resource [lindex [ixNet remapIds $sg_resource] 0]
} else {
error "err:port:$testport does not have dot1x range "
}
}
Deputs "Step110"
if { [ info exists maxoutstandingreq ] } {
set sg_parameter [ixNet add $handle/controlPlane "parameter"]
ixNet setMultiAttribute $sg_parameter \
-maxValue 1024 \
-minValue 1 \
-parameterId session:Dot1xPlugin:maxOutstandingRequests \
-parameterName "Max\ Outstanding\ Requests" \
-parameterValue $maxoutstandingreq \
-type kInteger \
-unit requests
ixNet commit
set sg_parameter [lindex [ixNet remapIds $sg_parameter] 0]
}
Deputs "Step120"
if { [ info exists numofsupplicants ] } {
set sg_parameter [ixNet add $handle/controlPlane "parameter"]
ixNet setMultiAttribute $sg_parameter \
-maxValue 32000 \
-minValue 1 \
-parameterId distributed:targetRange.count \
-parameterName "No.\ of\ Supplicants" \
-parameterValue $numofsupplicants \
-type kInteger \
-unit supplicants
ixNet commit
set sg_parameter [lindex [ixNet remapIds $sg_parameter] 0]
}
Deputs "Step130"
if { [ info exists trial ] } {
ixNet setMultiA $handle/testConfig/testRun -trials $trial
ixNet commit
}
Deputs "Step140"
if { [ info exists algorithmtype ] } {
ixNet setMultiAttribute $handle/testConfig/iterations \
-algoType $algorithmtype \
-parameterId session:Dot1xPlugin:maxClientsPerSecond \
-parameterName "Request\ Rate"
ixNet commit
}
if { $algorithmtype == "custom" && [ info exists customlist ] } {
ixNet setA $handle/testConfig/iterations/custom \
-valueList $customlist
ixNet commit
}
if { [ info exists waittime ] } {
ixNet setA $handle/testConfig/iterations \
-waitTime $waittime
ixNet commit
}
Deputs "Step150"
# enable latency
set sg_stat [ixNet add $handle/testConfig "stat"]
ixNet setMultiAttribute $sg_stat \
-statName "Supplicants\ Succeeded" \
-inCsv true \
-id "802.1x:Sessions\ Succeeded"
ixNet commit
set sg_stat [ixNet remapIds $sg_stat]
set sg_stat [ixNet add $handle/testConfig "stat"]
ixNet setMultiAttribute $sg_stat \
-statName "Supplicants\ Failed" \
-inCsv true \
-id "802.1x:Sessions\ Failed"
ixNet commit
set sg_stat [ixNet remapIds $sg_stat]
if { !$no_run } {
ixNet exec apply $handle
ixNet exec run $handle
ixNet exec waitForTest $handle
}
if { [ info exists resultdir ] } {
set path [ ixNet getA $handle/results -resultPath ]
Deputs "path:$path"
if { [ catch {
file copy $path $resultdir
} err ] } {
Deputs "err:$err"
}
if { [ info exists resultfile ] } {
if { [file exists $resultdir/$resultfile ] } {
if { [ catch {
set rfile [ open $resultdir/$resultfile r ]
set rpattern [ read -nonewline $rfile ]
close $rfile
file delete $resultdir/$resultfile
file copy $path/results.csv $resultdir/$resultfile
set apdfile [ open $resultdir/$resultfile a ]
puts $apdfile "\n"
puts $apdfile $rpattern
flush $apdfile
close $apdfile
} err ] } {
return [GetErrorReturnHeader $err]
}
} else {
if { [ catch {
file copy $path/results.csv $resultdir/$resultfile
} err ] } {
return [GetErrorReturnHeader $err]
}
}
}
}
return [GetStandardReturnHeader]
}