-
Notifications
You must be signed in to change notification settings - Fork 1
/
TestingScenario2920.py
256 lines (218 loc) · 11 KB
/
TestingScenario2920.py
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
import logging
from Configurations import SwitchParameters
from ExternalTools.DelayThread import DelayMonitor
from ExternalTools.IperfThread import BandwidthMeter
from Models.HPSDNController import HPSDNController
from Models.SwitchMonitor import SwitchMonitor
from datetime import datetime
import time
import threading
class TestingScenario3500:
def __init__(self):
self.logger = logging.getLogger("Monitor.TestScenario")
self.logger.setLevel(logging.DEBUG)
self.switch2920 = SwitchMonitor("00:64:38:63:bb:58:eb:00")
self.controller = HPSDNController("10.1.3.16")
#self.Iperf = BandwidthMeter("10.1.3.17", "marian", "descartes",
# "10.1.3.11", "marian", "descartes",
# 'iperf -c 10.100.3.17 -i 1 -y C', 'iperf -s')
#self.Iperf.setTestDuraton(10000)
#self.Ping = DelayMonitor("10.1.3.11", "marian", "descartes", "10.100.3.17", 1000)
#self.Ping.setPingCount(10000)
def start(self):
# print "=================== Test 1:Measuring Hardware Processing Performance =========================="
# self.hardwareProcessingPerformance()
# print "==============================================================================================="
# print "=================== Test 2:Measuring Rules Insertion Performance =============================="
# flow = SwitchParameters.switch3500_rule_9_OF10
# self.measureRuleInsertionPerformance(flow,100,100)
# print "==============================================================================================="
#print "=================== Test 3:Measuring Max Rule Count ==========================================="
#self.switch2920.cli.setPolicyEngineUsageLimit(10)
#self.measureTableSizeForDifferentRules()
#print "==============================================================================================="
# print "=================== Test 4:Flow Pull Performance =============================="
# flow = SwitchParameters.switch3500_rule_9_OF13
# self.measureGetFlowsImpact(flow,100,512)
# print "==============================================================================================="
#In order to work only with SF table OF policy usage resource should equal 0
print "=================== Test 5:OpenFlow Policy Engine dependency =============================="
self.openflowPolicyEngineDependency()
print "==============================================================================================="
#self.switch3500.cli.setPolicyEngineUsageLimit(0)
# print "=================== Test 1:Measuring Software Processing Performance =========================="
# self.switch3500.cli.resetOpenflowInstance()
# self.installPingRules(200)
# self.softwareProcessingPerformance()
# print "==============================================================================================="
# print "=================== Test 2:Measuring Rules Insertion Performance =============================="
# flow = SwitchParameters.switch3500_rule_9_OF13
# self.measureRuleInsertionPerformance(flow,200,1000)
# print "==============================================================================================="
# print "=================== Test 3:Flow Pull Performance =============================="
# flow = SwitchParameters.switch3500_rule_9_OF13
# self.measureGetFlowsImpact(flow,10,200)
# print "==============================================================================================="
# print "=================== Test 4:PPS change =============================="
# self.switch3500.cli.setPolicyEngineUsageLimit(100)
# self.softwarePPSChange()
# print "==============================================================================================="
def installPingRules(self,table_id):
flow1 = SwitchParameters.testbed_ping_rule_1
flow2 = SwitchParameters.testbed_ping_rule_2
flow1["flow"]["table_id"]=table_id
flow2["flow"]["table_id"]=table_id
self.controller.addFlow(self.switch3500.getDPID(),flow1)
time.sleep(1)
self.controller.addFlow(self.switch3500.getDPID(),flow2)
#========================================= Hardware Processing Perfoemance performance =========================
def hardwareProcessingPerformance(self):
self.switch3500.cli.resetOpenflowInstance()
self.installPingRules(100)
p1 = self.Iperf.startCapturingThroughput()
p2 = self.Ping.startCapturingDelay()
time.sleep(15)
self.Iperf.stopCapturingThroughput()
self.Ping.stopCapturingDelay()
time.sleep(5)
#========================================= Software Processing Perfoemance performance =========================
def softwareProcessingPerformance(self):
cpus = []
p1 = self.Iperf.startCapturingThroughput()
p2 = self.Ping.startCapturingDelay()
for i in range(0,15,1):
time.sleep(1)
cpus.append(self.switch3500.getCurrentCPU())
self.Iperf.stopCapturingThroughput()
self.Ping.stopCapturingDelay()
time.sleep(5)
print "[Switch3500-CPU] ",cpus
def softwarePPSChange(self):
for i in range(1000,10000,1000):
self.switch3500.cli.setSoftwareFlowTableRateLimit(i)
self.installSFPingRules(200)
self.softwareProcessingPerformance()
def installSFPingRules(self,table_id):
flow1 = SwitchParameters.switch3500_ping_rule_1
flow2 = SwitchParameters.switch3500_ping_rule_2
flow1["flow"]["table_id"]=200
flow2["flow"]["table_id"]=200
while(self.switch3500.getSoftwareFlowsCount()<3):
self.controller.addFlow(self.switch3500.getDPID(),flow1)
self.controller.addFlow(self.switch3500.getDPID(),flow2)
#========================================= Rule insetion performance =========================
def measureRuleInsertionPerformance(self,flow,table_id,max_rule_count):
cpus = {}
flow_insertion_delays = {}
flow_insertion_moments = {}
flow = flow
flow["flow"]["table_id"]=table_id
self.switch3500.cli.resetOpenflowInstance()
self.installPingRules(100)
self.Iperf.startCapturingThroughput()
self.Ping.startCapturingDelay()
rules_count = self.switch3500.getHardwareFlowsCount()
start_time = datetime.now()
while rules_count<max_rule_count:
print "\r Rules = {0}".format(rules_count),
flow = self.controller.buildDummyFlow(flow)
flow["flow"]["priority"]=rules_count+1
a = datetime.now()
self.controller.addFlow(self.switch3500.getDPID(),flow)
b = datetime.now()
c = (b-a).microseconds
flow_insertion_delays[rules_count]= c
flow_insertion_moments[rules_count]= c
if(rules_count%10)==0:
cpus[rules_count]= self.switch3500.getCurrentCPU()
else:
cpus[rules_count]= 0
rules_count+=1
print
end_time = datetime.now()
duration = end_time - start_time
self.Iperf.stopCapturingThroughput()
self.Ping.stopCapturingDelay()
time.sleep(5)
print "Experiment duration = "+str(duration)
f = open("3500_RuleInsertionPerformance_"+str(table_id)+".txt","w")
f.write("Rule\tMoment\tDelay\tCPU\n")
for key in flow_insertion_moments.keys():
f.write(str(key)+"\t"+
str(flow_insertion_moments[key])+"\t"+
str(flow_insertion_delays[key])+"\t"+
str(cpus[key])+"\t\n")
#========================================= Policy Engine Dependencie =========================
def openflowPolicyEngineDependency(self):
results = {}
table_id = 0
flow = SwitchParameters.switch2920_rule_10
flow["flow"]["table_id"]=table_id
for i in range(100,105,5):
self.switch2920.cli.setPolicyEngineUsageLimit(i)
time.sleep(3)
results[i]=self.measureMaxRuleCountInHardware(flow)
for key in results.keys():
print "\r",key,"\t",results[key]
#========================================= MAX TABLE SIZES =========================
def measureTableSizeForDifferentRules(self):
table_id = 0
for flow in SwitchParameters.switch_compatible_rules["2920"]:
self.switch2920.cli.resetOpenflowInstance()
time.sleep(3)
flow["flow"]["table_id"]=table_id
self.measureMaxRuleCountInHardware(flow)
print "========================================================="
def measureMaxRuleCountInHardware(self,flow):
print "Flow Pattern:", flow
print "Number of wildcards: ",int(13-len(flow["flow"]["match"]))
hw_table_size = self.switch2920.getHardwareFlowsCount()
while True:
print "\r Rules = {0}".format(hw_table_size),
for i in range(0,10,1):
flow["flow"]["priority"]=hw_table_size+i
flow = self.controller.buildDummyFlow(flow)
self.controller.addFlow(self.switch2920.getDPID(),flow)
current_count = self.switch2920.getHardwareFlowsCount()
if hw_table_size==current_count:
break
hw_table_size = current_count
print
print "Rules number limit = ",str(hw_table_size)
return hw_table_size
#=========================================================================================
#mac-ip aware enabled
def measureGetFlowsImpact(self, flow, table_id, max_table_size):
self.switch3500.cli.resetOpenflowInstance()
self.installPingRules(table_id)
self.Iperf.startCapturingThroughput()
self.Ping.startCapturingDelay()
time.sleep(5)
flow = flow
flow["flow"]["table_id"] = table_id
rules_count = self.switch3500.getHardwareFlowsCount()
while rules_count<=50:
flow = self.controller.buildDummyFlow(flow)
flow["flow"]["priority"]=rules_count+1
self.controller.addFlow(self.switch3500.getDPID(),flow)
if(rules_count%10)==0:
for i in range(0,10,1):
self.controller.getTableFlowsCount(self.switch3500.getDPID(),table_id)
rules_count+=1
print "\r",rules_count,
time.sleep(5)
self.Iperf.stopCapturingThroughput()
self.Ping.stopCapturingDelay()
def fillHWTableWithDummyRules(self):
flow = SwitchParameters.switch3500_rule_9_OF13
flow["flow"]["table_id"]=100
for i in range(0,1527,1):
flow["flow"]["priority"]=i+1
print "\r",i,
self.controller.addFlow(self.switch3500.getDPID(),flow)
print "HW is full!"
def main():
test = TestingScenario3500()
test.start()
if __name__ == '__main__':
main()