blob: c0f24156e51b92c078cb82c851e5858d41bbcb62 [file] [log] [blame]
andrewonlabadd2fd62014-11-11 18:37:35 -05001#TopoPerfNext
2#
andrewonlab51b180b2014-11-12 18:19:28 -05003#Topology Convergence scale-out test for ONOS-next
4#NOTE: This test supports up to 7 nodes scale-out scenario
andrewonlabadd2fd62014-11-11 18:37:35 -05005#
andrewonlaba036b402014-11-17 13:47:46 -05006#NOTE: Ensure that you have 'tablet.json' file
7# in the onos/tools/package/config directory
8#NOTE: You must start this test initially with 3 nodes
9#
andrewonlabadd2fd62014-11-11 18:37:35 -050010#andrew@onlab.us
11
12import time
13import sys
14import os
15import re
16
17class TopoConvNext:
18 def __init__(self):
19 self.default = ''
20
andrewonlabadd2fd62014-11-11 18:37:35 -050021 def CASE1(self, main):
22 '''
23 ONOS startup sequence
24 '''
25 import time
andrewonlab54cec4b2014-11-12 13:30:23 -050026
27 #******
28 #Global cluster count for scale-out purposes
29 global cluster_count
andrewonlab7b4e8ba2014-11-20 17:45:04 -050030 global topo_iteration
31 topo_iteration = 1
andrewonlaba036b402014-11-17 13:47:46 -050032 cluster_count = 3
andrewonlab54cec4b2014-11-12 13:30:23 -050033 #******
andrewonlabadd2fd62014-11-11 18:37:35 -050034 cell_name = main.params['ENV']['cellName']
35
36 git_pull = main.params['GIT']['autoPull']
37 checkout_branch = main.params['GIT']['checkout']
38
39 ONOS1_ip = main.params['CTRL']['ip1']
andrewonlab54cec4b2014-11-12 13:30:23 -050040 ONOS2_ip = main.params['CTRL']['ip2']
41 ONOS3_ip = main.params['CTRL']['ip3']
42 ONOS4_ip = main.params['CTRL']['ip4']
43 ONOS5_ip = main.params['CTRL']['ip5']
44 ONOS6_ip = main.params['CTRL']['ip6']
45 ONOS7_ip = main.params['CTRL']['ip7']
andrewonlabadd2fd62014-11-11 18:37:35 -050046 MN1_ip = main.params['MN']['ip1']
47 BENCH_ip = main.params['BENCH']['ip']
48
49 main.case("Setting up test environment")
andrewonlaba036b402014-11-17 13:47:46 -050050 main.log.info("Uninstalling previous instances")
andrewonlab7b4e8ba2014-11-20 17:45:04 -050051 #main.ONOSbench.onos_uninstall(node_ip = ONOS1_ip)
52 #main.ONOSbench.onos_uninstall(node_ip = ONOS2_ip)
53 #main.ONOSbench.onos_uninstall(node_ip = ONOS3_ip)
andrewonlaba036b402014-11-17 13:47:46 -050054 main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip)
55 main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip)
56 main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip)
57 main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip)
58
andrewonlabadd2fd62014-11-11 18:37:35 -050059 main.log.report("Setting up test environment")
60
61 main.step("Creating cell file")
62 cell_file_result = main.ONOSbench.create_cell_file(
andrewonlab81763ee2014-11-13 17:31:34 -050063 BENCH_ip, cell_name, MN1_ip,
andrewonlaba036b402014-11-17 13:47:46 -050064 "onos-core,onos-app-metrics",
65 ONOS1_ip, ONOS2_ip, ONOS3_ip)
andrewonlabadd2fd62014-11-11 18:37:35 -050066
67 main.step("Applying cell file to environment")
68 cell_apply_result = main.ONOSbench.set_cell(cell_name)
69 verify_cell_result = main.ONOSbench.verify_cell()
70
andrewonlab7b4e8ba2014-11-20 17:45:04 -050071 main.step("Removing raft logs")
andrewonlab62749022014-11-19 19:19:58 -050072 main.ONOSbench.onos_remove_raft_logs()
73
andrewonlabadd2fd62014-11-11 18:37:35 -050074 main.step("Git checkout and pull "+checkout_branch)
75 if git_pull == 'on':
76 checkout_result = \
77 main.ONOSbench.git_checkout(checkout_branch)
78 pull_result = main.ONOSbench.git_pull()
79 else:
80 checkout_result = main.TRUE
81 pull_result = main.TRUE
82 main.log.info("Skipped git checkout and pull")
83
andrewonlab62749022014-11-19 19:19:58 -050084 main.log.report("Commit information - ")
85 main.ONOSbench.get_version()
86
andrewonlabadd2fd62014-11-11 18:37:35 -050087 main.step("Using mvn clean & install")
88 #mvn_result = main.ONOSbench.clean_install()
89 mvn_result = main.TRUE
90
91 main.step("Set cell for ONOS cli env")
92 main.ONOS1cli.set_cell(cell_name)
andrewonlab54cec4b2014-11-12 13:30:23 -050093 main.ONOS2cli.set_cell(cell_name)
94 main.ONOS3cli.set_cell(cell_name)
andrewonlab54cec4b2014-11-12 13:30:23 -050095
andrewonlabadd2fd62014-11-11 18:37:35 -050096 main.step("Creating ONOS package")
97 package_result = main.ONOSbench.onos_package()
98
andrewonlab54cec4b2014-11-12 13:30:23 -050099 #Start test with single node only
andrewonlabadd2fd62014-11-11 18:37:35 -0500100 main.step("Installing ONOS package")
101 install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
andrewonlaba036b402014-11-17 13:47:46 -0500102 install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
103 install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
andrewonlabadd2fd62014-11-11 18:37:35 -0500104
105 time.sleep(10)
106
107 main.step("Start onos cli")
108 cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
andrewonlaba036b402014-11-17 13:47:46 -0500109 cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
110 cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
andrewonlabadd2fd62014-11-11 18:37:35 -0500111
112 main.step("Enable metrics feature")
andrewonlab81763ee2014-11-13 17:31:34 -0500113 #main.ONOS1cli.feature_install("onos-app-metrics")
andrewonlabadd2fd62014-11-11 18:37:35 -0500114
115 utilities.assert_equals(expect=main.TRUE,
116 actual= cell_file_result and cell_apply_result and\
117 verify_cell_result and checkout_result and\
118 pull_result and mvn_result and\
andrewonlaba036b402014-11-17 13:47:46 -0500119 install1_result and install2_result and\
120 install3_result,
andrewonlabadd2fd62014-11-11 18:37:35 -0500121 onpass="Test Environment setup successful",
122 onfail="Failed to setup test environment")
123
124 def CASE2(self, main):
125 '''
126 100 Switch discovery latency
127
128 Important:
129 This test case can be potentially dangerous if
130 your machine has previously set iptables rules.
131 One of the steps of the test case will flush
132 all existing iptables rules.
133 Note:
134 You can specify the number of switches in the
135 params file to adjust the switch discovery size
136 (and specify the corresponding topology in Mininet1
137 .topo file)
138 '''
139 import time
140 import subprocess
141 import os
142 import requests
143 import json
andrewonlab51b180b2014-11-12 18:19:28 -0500144 import numpy
andrewonlabadd2fd62014-11-11 18:37:35 -0500145
146 ONOS_ip_list = []
andrewonlab51b180b2014-11-12 18:19:28 -0500147 ONOS_ip_list.append('0')
andrewonlab54cec4b2014-11-12 13:30:23 -0500148 ONOS_ip_list.append(main.params['CTRL']['ip1'])
149 ONOS_ip_list.append(main.params['CTRL']['ip2'])
150 ONOS_ip_list.append(main.params['CTRL']['ip3'])
151 ONOS_ip_list.append(main.params['CTRL']['ip4'])
152 ONOS_ip_list.append(main.params['CTRL']['ip5'])
153 ONOS_ip_list.append(main.params['CTRL']['ip6'])
154 ONOS_ip_list.append(main.params['CTRL']['ip7'])
andrewonlabadd2fd62014-11-11 18:37:35 -0500155 MN1_ip = main.params['MN']['ip1']
156 ONOS_user = main.params['CTRL']['user']
157
158 default_sw_port = main.params['CTRL']['port1']
159
160 #Number of iterations of case
161 num_iter = main.params['TEST']['numIter']
andrewonlab7b4e8ba2014-11-20 17:45:04 -0500162
163 #***********
164 #Global number of switches that change
165 #throughout the test
166 global num_sw
167 global topo_iteration
168 if topo_iteration == 1:
169 num_sw = main.params['TEST']['numSwitch1']
170 elif topo_iteration == 2:
171 num_sw = main.params['TEST']['numSwitch2']
172 elif topo_iteration == 3:
173 num_sw = main.params['TEST']['numSwitch3']
174 #***********
andrewonlabadd2fd62014-11-11 18:37:35 -0500175
176 #Timestamp 'keys' for json metrics output.
177 #These are subject to change, hence moved into params
178 deviceTimestamp = main.params['JSON']['deviceTimestamp']
179 graphTimestamp = main.params['JSON']['graphTimestamp']
180
andrewonlabadd2fd62014-11-11 18:37:35 -0500181 #Threshold for this test case
182 sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold']
183 sw_disc_threshold_obj = sw_disc_threshold_str.split(",")
184 sw_disc_threshold_min = int(sw_disc_threshold_obj[0])
185 sw_disc_threshold_max = int(sw_disc_threshold_obj[1])
186
andrewonlab51b180b2014-11-12 18:19:28 -0500187 assertion = main.TRUE
andrewonlabadd2fd62014-11-11 18:37:35 -0500188 sw_discovery_lat_list = []
andrewonlaba1272172014-11-17 17:30:35 -0500189 syn_ack_delta_list = []
andrewonlabadd2fd62014-11-11 18:37:35 -0500190
andrewonlab7b4e8ba2014-11-20 17:45:04 -0500191 main.case(str(num_sw)+" switches distributed across "+
192 str(cluster_count)+" nodes convergence latency")
andrewonlab0d4478f2014-11-11 20:31:20 -0500193
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500194 main.log.report("Large topology convergence and scale-out test")
andrewonlab0d4478f2014-11-11 20:31:20 -0500195 main.log.report("Currently active ONOS node(s): ")
196 report_str = "Node "
andrewonlab51b180b2014-11-12 18:19:28 -0500197 for node in range(1, cluster_count+1):
198 report_str += (str(node) + " ")
andrewonlab0d4478f2014-11-11 20:31:20 -0500199 main.log.report(report_str)
andrewonlabadd2fd62014-11-11 18:37:35 -0500200
andrewonlab62749022014-11-19 19:19:58 -0500201 main.step("Distributing "+num_sw+" switches to each ONOS")
andrewonlab0d4478f2014-11-11 20:31:20 -0500202 index = 1
andrewonlab51b180b2014-11-12 18:19:28 -0500203 for node in range(1, cluster_count+1):
andrewonlab62749022014-11-19 19:19:58 -0500204 for i in range(index, (int(num_sw)/cluster_count)+index):
andrewonlab0d4478f2014-11-11 20:31:20 -0500205 main.Mininet1.assign_sw_controller(
206 sw=str(i),
207 ip1=ONOS_ip_list[node],
208 port1=default_sw_port)
andrewonlab54cec4b2014-11-12 13:30:23 -0500209 index = i+1
210
211 main.log.info("Please check ptpd configuration to ensure "+\
212 "all nodes' system times are in sync")
andrewonlab54cec4b2014-11-12 13:30:23 -0500213
andrewonlab54cec4b2014-11-12 13:30:23 -0500214 time.sleep(10)
215
andrewonlab51b180b2014-11-12 18:19:28 -0500216 for i in range(0, int(num_iter)):
217 main.step("Set iptables rule to block sw connections")
218
219 #INPUT rules
220 main.ONOS1.handle.sendline(
221 "sudo iptables -A INPUT -p tcp -s "+
222 MN1_ip+" --dport "+default_sw_port+" -j DROP")
223 main.ONOS2.handle.sendline(
224 "sudo iptables -A INPUT -p tcp -s "+
225 MN1_ip+" --dport "+default_sw_port+" -j DROP")
226 main.ONOS3.handle.sendline(
227 "sudo iptables -A INPUT -p tcp -s "+
228 MN1_ip+" --dport "+default_sw_port+" -j DROP")
229 main.ONOS4.handle.sendline(
230 "sudo iptables -A INPUT -p tcp -s "+
231 MN1_ip+" --dport "+default_sw_port+" -j DROP")
232 main.ONOS5.handle.sendline(
233 "sudo iptables -A INPUT -p tcp -s "+
234 MN1_ip+" --dport "+default_sw_port+" -j DROP")
235 main.ONOS6.handle.sendline(
236 "sudo iptables -A INPUT -p tcp -s "+
237 MN1_ip+" --dport "+default_sw_port+" -j DROP")
238 main.ONOS7.handle.sendline(
239 "sudo iptables -A INPUT -p tcp -s "+
240 MN1_ip+" --dport "+default_sw_port+" -j DROP")
241
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500242 #OUTPUT rules
andrewonlab51b180b2014-11-12 18:19:28 -0500243 main.ONOS1.handle.sendline(
244 "sudo iptables -A OUTPUT -p tcp -s "+
245 MN1_ip+" --dport "+default_sw_port+" -j DROP")
246 main.ONOS2.handle.sendline(
247 "sudo iptables -A OUTPUT -p tcp -s "+
248 MN1_ip+" --dport "+default_sw_port+" -j DROP")
249 main.ONOS3.handle.sendline(
250 "sudo iptables -A OUTPUT -p tcp -s "+
251 MN1_ip+" --dport "+default_sw_port+" -j DROP")
252 main.ONOS4.handle.sendline(
253 "sudo iptables -A OUTPUT -p tcp -s "+
254 MN1_ip+" --dport "+default_sw_port+" -j DROP")
255 main.ONOS5.handle.sendline(
256 "sudo iptables -A OUTPUT -p tcp -s "+
257 MN1_ip+" --dport "+default_sw_port+" -j DROP")
258 main.ONOS6.handle.sendline(
259 "sudo iptables -A OUTPUT -p tcp -s "+
260 MN1_ip+" --dport "+default_sw_port+" -j DROP")
261 main.ONOS7.handle.sendline(
262 "sudo iptables -A OUTPUT -p tcp -s "+
263 MN1_ip+" --dport "+default_sw_port+" -j DROP")
andrewonlab0d4478f2014-11-11 20:31:20 -0500264
andrewonlab51b180b2014-11-12 18:19:28 -0500265 main.log.info("Please wait for switch connection to timeout")
andrewonlab62749022014-11-19 19:19:58 -0500266
267
268 #time.sleep(60)
269 #if cluster_count >= 3:
270 # time.sleep(60)
andrewonlab7b4e8ba2014-11-20 17:45:04 -0500271 #if cluster_count >= 5:
272 # time.sleep(30)
273 #if cluster_count >= 6:
274 # time.sleep(30)
andrewonlaba036b402014-11-17 13:47:46 -0500275
276 if cluster_count >= 3:
277 main.ONOS1.tshark_grep("SYN, ACK",
278 "/tmp/syn_ack_onos1_iter"+str(i)+".txt")
279 main.ONOS2.tshark_grep("SYN, ACK",
280 "/tmp/syn_ack_onos2_iter"+str(i)+".txt")
281 main.ONOS3.tshark_grep("SYN, ACK",
282 "/tmp/syn_ack_onos3_iter"+str(i)+".txt")
283 if cluster_count >= 4:
284 main.ONOS4.tshark_grep("SYN, ACK",
285 "/tmp/syn_ack_onos4_iter"+str(i)+".txt")
286 if cluster_count >= 5:
287 main.ONOS5.tshark_grep("SYN, ACK",
288 "/tmp/syn_ack_onos5_iter"+str(i)+".txt")
289 if cluster_count >= 6:
290 main.ONOS6.tshark_grep("SYN, ACK",
291 "/tmp/syn_ack_onos6_iter"+str(i)+".txt")
292 if cluster_count == 7:
293 main.ONOS7.tshark_grep("SYN, ACK",
294 "/tmp/syn_ack_onos7_iter"+str(i)+".txt")
andrewonlab62749022014-11-19 19:19:58 -0500295
296 loop_count = 0
297 device_count = 0
298 while loop_count < 60:
299 main.log.info("Checking devices for device down")
300 device_str = main.ONOS1cli.devices()
301 device_json = json.loads(device_str)
302 for device in device_json:
303 if device['available'] == False:
andrewonlab7b4e8ba2014-11-20 17:45:04 -0500304 #print device_count
andrewonlab62749022014-11-19 19:19:58 -0500305 device_count += 1
306 else:
307 device_count = 0
308 if device_count >= int(num_sw)*int(cluster_count):
309 main.step("Flushing iptables and obtaining t0")
310 t0_system = time.time()*1000
311 main.ONOS1.handle.sendline("sudo iptables -F")
312 main.ONOS2.handle.sendline("sudo iptables -F")
313 main.ONOS3.handle.sendline("sudo iptables -F")
314 main.ONOS4.handle.sendline("sudo iptables -F")
315 main.ONOS5.handle.sendline("sudo iptables -F")
316 main.ONOS6.handle.sendline("sudo iptables -F")
317 main.ONOS7.handle.sendline("sudo iptables -F")
318
319 break
320
321 time.sleep(1)
andrewonlabadd2fd62014-11-11 18:37:35 -0500322
andrewonlab62749022014-11-19 19:19:58 -0500323 main.log.info("System time t0: "+str(t0_system))
andrewonlab51b180b2014-11-12 18:19:28 -0500324
325 counter_loop = 0
326 counter_avail1 = 0
327 counter_avail2 = 0
328 counter_avail3 = 0
329 counter_avail4 = 0
330 counter_avail5 = 0
331 counter_avail6 = 0
332 counter_avail7 = 0
333 onos1_dev = False
334 onos2_dev = False
335 onos3_dev = False
336 onos4_dev = False
337 onos5_dev = False
338 onos6_dev = False
339 onos7_dev = False
340
341 #TODO: Think of a more elegant way to check all
342 # switches across all nodes
343 #Goodluck debugging this loop
344 while counter_loop < 60:
345 for node in range(1, cluster_count+1):
346 if node == 1 and not onos1_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500347 main.log.info("Checking node 1 for device "+
348 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500349 device_str_obj1 = main.ONOS1cli.devices()
andrewonlab51b180b2014-11-12 18:19:28 -0500350 device_json1 = json.loads(device_str_obj1)
351 for device1 in device_json1:
352 if device1['available'] == True:
353 counter_avail1 += 1
354 if counter_avail1 == int(num_sw):
355 onos1_dev = True
356 main.log.info("All devices have been"+
357 " discovered on ONOS1")
andrewonlabfd8325f2014-11-12 19:14:06 -0500358 else:
359 counter_avail1 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500360 if node == 2 and not onos2_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500361 main.log.info("Checking node 2 for device "+
362 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500363 device_str_obj2 = main.ONOS2cli.devices()
364 device_json2 = json.loads(device_str_obj2)
365 for device2 in device_json2:
366 if device2['available'] == True:
367 counter_avail2 += 1
368 if counter_avail2 == int(num_sw):
369 onos2_dev = True
370 main.log.info("All devices have been"+
371 " discovered on ONOS2")
andrewonlabfd8325f2014-11-12 19:14:06 -0500372 else:
373 counter_avail2 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500374 if node == 3 and not onos3_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500375 main.log.info("Checking node 3 for device "+
376 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500377 device_str_obj3 = main.ONOS3cli.devices()
378 device_json3 = json.loads(device_str_obj3)
379 for device3 in device_json3:
380 if device3['available'] == True:
381 counter_avail3 += 1
382 if counter_avail3 == int(num_sw):
383 onos3_dev = True
384 main.log.info("All devices have been"+
385 " discovered on ONOS3")
andrewonlabfd8325f2014-11-12 19:14:06 -0500386 else:
387 counter_avail3 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500388 if node == 4 and not onos4_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500389 main.log.info("Checking node 4 for device "+
390 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500391 device_str_obj4 = main.ONOS4cli.devices()
392 device_json4 = json.loads(device_str_obj4)
393 for device4 in device_json4:
394 if device4['available'] == True:
395 counter_avail4 += 1
396 if counter_avail4 == int(num_sw):
397 onos4_dev = True
398 main.log.info("All devices have been"+
399 " discovered on ONOS4")
andrewonlabfd8325f2014-11-12 19:14:06 -0500400 else:
401 counter_avail4 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500402 if node == 5 and not onos5_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500403 main.log.info("Checking node 5 for device "+
404 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500405 device_str_obj5 = main.ONOS5cli.devices()
406 device_json5 = json.loads(device_str_obj5)
407 for device5 in device_json5:
408 if device5['available'] == True:
409 counter_avail5 += 1
410 if counter_avail5 == int(num_sw):
411 onos5_dev = True
412 main.log.info("All devices have been"+
413 " discovered on ONOS5")
andrewonlabfd8325f2014-11-12 19:14:06 -0500414 else:
415 counter_avail5 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500416 if node == 6 and not onos6_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500417 main.log.info("Checking node 6 for device "+
418 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500419 device_str_obj6 = main.ONOS6cli.devices()
420 device_json6 = json.loads(device_str_obj6)
421 for device6 in device_json6:
422 if device6['available'] == True:
423 counter_avail6 += 1
424 if counter_avail6 == int(num_sw):
425 onos6_dev = True
426 main.log.info("All devices have been"+
427 " discovered on ONOS6")
andrewonlabfd8325f2014-11-12 19:14:06 -0500428 else:
429 counter_avail6 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500430 if node == 7 and not onos7_dev:
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500431 main.log.info("Checking node 7 for device "+
432 "discovery")
andrewonlab51b180b2014-11-12 18:19:28 -0500433 device_str_obj7 = main.ONOS7cli.devices()
434 device_json7 = json.loads(device_str_obj7)
435 for device7 in device_json7:
436 if device7['available'] == True:
437 counter_avail7 += 1
438 if counter_avail7 == int(num_sw):
439 onos7_dev = True
440 main.log.info("All devices have been"+
441 " discovered on ONOS7")
andrewonlabfd8325f2014-11-12 19:14:06 -0500442 else:
443 counter_avail7 = 0
andrewonlab51b180b2014-11-12 18:19:28 -0500444 #END node loop
445
446 #TODO: clean up this mess of an if statements if possible
447 #Treat each if as a separate test case with the given
448 # cluster count. Hence when the cluster count changes
449 # the desired calculations will be made
450 if cluster_count == 1:
451 if onos1_dev:
452 main.log.info("All devices have been discovered"+
453 " on all ONOS instances")
454 json_str_metrics_1 =\
455 main.ONOS1cli.topology_events_metrics()
456 json_obj_1 = json.loads(json_str_metrics_1)
457 graph_timestamp_1 =\
458 json_obj_1[graphTimestamp]['value']
459
460 graph_lat_1 = \
461 int(graph_timestamp_1) - int(t0_system)
462
463 if graph_lat_1 > sw_disc_threshold_min\
464 and graph_lat_1 < sw_disc_threshold_max:
465 sw_discovery_lat_list.append(
466 graph_lat_1)
andrewonlabfd8325f2014-11-12 19:14:06 -0500467 main.log.info("Sw discovery latency of "+
468 str(cluster_count)+" node(s): "+
469 str(graph_lat_1)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500470 else:
471 main.log.info("Switch discovery latency "+
472 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500473 main.log.info(graph_lat_1)
andrewonlab51b180b2014-11-12 18:19:28 -0500474 #Break while loop
475 break
476 if cluster_count == 2:
477 if onos1_dev and onos2_dev:
478 main.log.info("All devices have been discovered"+
andrewonlaba036b402014-11-17 13:47:46 -0500479 " on all "+str(cluster_count)+
480 " ONOS instances")
andrewonlab51b180b2014-11-12 18:19:28 -0500481 json_str_metrics_1 =\
482 main.ONOS1cli.topology_events_metrics()
483 json_str_metrics_2 =\
484 main.ONOS2cli.topology_events_metrics()
485 json_obj_1 = json.loads(json_str_metrics_1)
486 json_obj_2 = json.loads(json_str_metrics_2)
487 graph_timestamp_1 =\
488 json_obj_1[graphTimestamp]['value']
489 graph_timestamp_2 =\
490 json_obj_2[graphTimestamp]['value']
491
492 graph_lat_1 = \
493 int(graph_timestamp_1) - int(t0_system)
494 graph_lat_2 = \
495 int(graph_timestamp_2) - int(t0_system)
496
497 avg_graph_lat = \
498 (int(graph_lat_1) +\
499 int(graph_lat_2)) / 2
500
501 if avg_graph_lat > sw_disc_threshold_min\
502 and avg_graph_lat < sw_disc_threshold_max:
503 sw_discovery_lat_list.append(
504 avg_graph_lat)
andrewonlabfd8325f2014-11-12 19:14:06 -0500505 main.log.info("Sw discovery latency of "+
506 str(cluster_count)+" node(s): "+
507 str(avg_graph_lat)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500508 else:
509 main.log.info("Switch discovery latency "+
510 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500511 main.log.info(avg_graph_lat)
andrewonlab51b180b2014-11-12 18:19:28 -0500512 break
513 if cluster_count == 3:
514 if onos1_dev and onos2_dev and onos3_dev:
515 main.log.info("All devices have been discovered"+
andrewonlaba036b402014-11-17 13:47:46 -0500516 " on all "+str(cluster_count)+
517 " ONOS instances")
518
519 #TODO: Investigate this sleep
520 # added to 'pad' the results with
521 # plenty of time to 'catch up'
andrewonlab62749022014-11-19 19:19:58 -0500522 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500523
andrewonlab51b180b2014-11-12 18:19:28 -0500524 json_str_metrics_1 =\
525 main.ONOS1cli.topology_events_metrics()
526 json_str_metrics_2 =\
527 main.ONOS2cli.topology_events_metrics()
528 json_str_metrics_3 =\
529 main.ONOS3cli.topology_events_metrics()
530 json_obj_1 = json.loads(json_str_metrics_1)
531 json_obj_2 = json.loads(json_str_metrics_2)
532 json_obj_3 = json.loads(json_str_metrics_3)
533 graph_timestamp_1 =\
534 json_obj_1[graphTimestamp]['value']
535 graph_timestamp_2 =\
536 json_obj_2[graphTimestamp]['value']
537 graph_timestamp_3 =\
538 json_obj_3[graphTimestamp]['value']
539
540 graph_lat_1 = \
541 int(graph_timestamp_1) - int(t0_system)
542 graph_lat_2 = \
543 int(graph_timestamp_2) - int(t0_system)
544 graph_lat_3 = \
545 int(graph_timestamp_3) - int(t0_system)
546
andrewonlab62749022014-11-19 19:19:58 -0500547 main.log.info("DEBUG: graph_timestamp_1: "+
548 str(graph_timestamp_1))
549
andrewonlab51b180b2014-11-12 18:19:28 -0500550 avg_graph_lat = \
551 (int(graph_lat_1) +\
552 int(graph_lat_2) +\
553 int(graph_lat_3)) / 3
554
555 if avg_graph_lat > sw_disc_threshold_min\
556 and avg_graph_lat < sw_disc_threshold_max:
557 sw_discovery_lat_list.append(
558 avg_graph_lat)
andrewonlabfd8325f2014-11-12 19:14:06 -0500559 main.log.info("Sw discovery latency of "+
560 str(cluster_count)+" node(s): "+
561 str(avg_graph_lat)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500562 else:
563 main.log.info("Switch discovery latency "+
564 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500565 main.log.info(avg_graph_lat)
andrewonlab51b180b2014-11-12 18:19:28 -0500566
567 break
568 if cluster_count == 4:
569 if onos1_dev and onos2_dev and onos3_dev and\
570 onos4_dev:
571 main.log.info("All devices have been discovered"+
572 " on all ONOS instances")
573 json_str_metrics_1 =\
574 main.ONOS1cli.topology_events_metrics()
575 json_str_metrics_2 =\
576 main.ONOS2cli.topology_events_metrics()
577 json_str_metrics_3 =\
578 main.ONOS3cli.topology_events_metrics()
579 json_str_metrics_4 =\
580 main.ONOS4cli.topology_events_metrics()
581 json_obj_1 = json.loads(json_str_metrics_1)
582 json_obj_2 = json.loads(json_str_metrics_2)
583 json_obj_3 = json.loads(json_str_metrics_3)
584 json_obj_4 = json.loads(json_str_metrics_4)
585 graph_timestamp_1 =\
586 json_obj_1[graphTimestamp]['value']
587 graph_timestamp_2 =\
588 json_obj_2[graphTimestamp]['value']
589 graph_timestamp_3 =\
590 json_obj_3[graphTimestamp]['value']
591 graph_timestamp_4 =\
592 json_obj_4[graphTimestamp]['value']
593
594 graph_lat_1 = \
595 int(graph_timestamp_1) - int(t0_system)
596 graph_lat_2 = \
597 int(graph_timestamp_2) - int(t0_system)
598 graph_lat_3 = \
599 int(graph_timestamp_3) - int(t0_system)
600 graph_lat_4 = \
601 int(graph_timestamp_4) - int(t0_system)
602
603 avg_graph_lat = \
604 (int(graph_lat_1) +\
605 int(graph_lat_2) +\
606 int(graph_lat_3) +\
607 int(graph_lat_4)) / 4
608
609 if avg_graph_lat > sw_disc_threshold_min\
610 and avg_graph_lat < sw_disc_threshold_max:
611 sw_discovery_lat_list.append(
612 avg_graph_lat)
andrewonlabfd8325f2014-11-12 19:14:06 -0500613 main.log.info("Sw discovery latency of "+
614 str(cluster_count)+" node(s): "+
615 str(avg_graph_lat)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500616 else:
617 main.log.info("Switch discovery latency "+
618 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500619 main.log.info(avg_graph_lat)
andrewonlab51b180b2014-11-12 18:19:28 -0500620
621 break
622 if cluster_count == 5:
623 if onos1_dev and onos2_dev and onos3_dev and\
624 onos4_dev and onos5_dev:
625 main.log.info("All devices have been discovered"+
626 " on all ONOS instances")
andrewonlaba036b402014-11-17 13:47:46 -0500627
628 #TODO: Investigate this sleep
629 # added to 'pad' the results with
630 # plenty of time to 'catch up'
andrewonlab62749022014-11-19 19:19:58 -0500631 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500632
andrewonlab51b180b2014-11-12 18:19:28 -0500633 json_str_metrics_1 =\
634 main.ONOS1cli.topology_events_metrics()
635 json_str_metrics_2 =\
636 main.ONOS2cli.topology_events_metrics()
637 json_str_metrics_3 =\
638 main.ONOS3cli.topology_events_metrics()
639 json_str_metrics_4 =\
640 main.ONOS4cli.topology_events_metrics()
641 json_str_metrics_5 =\
642 main.ONOS5cli.topology_events_metrics()
643 json_obj_1 = json.loads(json_str_metrics_1)
644 json_obj_2 = json.loads(json_str_metrics_2)
645 json_obj_3 = json.loads(json_str_metrics_3)
646 json_obj_4 = json.loads(json_str_metrics_4)
647 json_obj_5 = json.loads(json_str_metrics_5)
648 graph_timestamp_1 =\
649 json_obj_1[graphTimestamp]['value']
650 graph_timestamp_2 =\
651 json_obj_2[graphTimestamp]['value']
652 graph_timestamp_3 =\
653 json_obj_3[graphTimestamp]['value']
654 graph_timestamp_4 =\
655 json_obj_4[graphTimestamp]['value']
656 graph_timestamp_5 =\
657 json_obj_5[graphTimestamp]['value']
658
659 graph_lat_1 = \
660 int(graph_timestamp_1) - int(t0_system)
661 graph_lat_2 = \
662 int(graph_timestamp_2) - int(t0_system)
663 graph_lat_3 = \
664 int(graph_timestamp_3) - int(t0_system)
665 graph_lat_4 = \
666 int(graph_timestamp_4) - int(t0_system)
667 graph_lat_5 = \
668 int(graph_timestamp_5) - int(t0_system)
669
670 avg_graph_lat = \
671 (int(graph_lat_1) +\
672 int(graph_lat_2) +\
673 int(graph_lat_3) +\
674 int(graph_lat_4) +\
675 int(graph_lat_5)) / 5
676
677 if avg_graph_lat > sw_disc_threshold_min\
678 and avg_graph_lat < sw_disc_threshold_max:
679 sw_discovery_lat_list.append(
680 avg_graph_lat)
andrewonlabfd8325f2014-11-12 19:14:06 -0500681 main.log.info("Sw discovery latency of "+
682 str(cluster_count)+" node(s): "+
683 str(avg_graph_lat)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500684 else:
685 main.log.info("Switch discovery latency "+
686 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500687 main.log.info(avg_graph_lat)
andrewonlab51b180b2014-11-12 18:19:28 -0500688
689 break
690 if cluster_count == 6:
691 if onos1_dev and onos2_dev and onos3_dev and\
692 onos4_dev and onos5_dev and onos6_dev:
693 main.log.info("All devices have been discovered"+
694 " on all ONOS instances")
695 json_str_metrics_1 =\
696 main.ONOS1cli.topology_events_metrics()
697 json_str_metrics_2 =\
698 main.ONOS2cli.topology_events_metrics()
699 json_str_metrics_3 =\
700 main.ONOS3cli.topology_events_metrics()
701 json_str_metrics_4 =\
702 main.ONOS4cli.topology_events_metrics()
703 json_str_metrics_5 =\
704 main.ONOS5cli.topology_events_metrics()
705 json_str_metrics_6 =\
706 main.ONOS6cli.topology_events_metrics()
707 json_obj_1 = json.loads(json_str_metrics_1)
708 json_obj_2 = json.loads(json_str_metrics_2)
709 json_obj_3 = json.loads(json_str_metrics_3)
710 json_obj_4 = json.loads(json_str_metrics_4)
711 json_obj_5 = json.loads(json_str_metrics_5)
712 json_obj_6 = json.loads(json_str_metrics_6)
713 graph_timestamp_1 =\
714 json_obj_1[graphTimestamp]['value']
715 graph_timestamp_2 =\
716 json_obj_2[graphTimestamp]['value']
717 graph_timestamp_3 =\
718 json_obj_3[graphTimestamp]['value']
719 graph_timestamp_4 =\
720 json_obj_4[graphTimestamp]['value']
721 graph_timestamp_5 =\
722 json_obj_5[graphTimestamp]['value']
723 graph_timestamp_6 =\
724 json_obj_6[graphTimestamp]['value']
725
726 graph_lat_1 = \
727 int(graph_timestamp_1) - int(t0_system)
728 graph_lat_2 = \
729 int(graph_timestamp_2) - int(t0_system)
730 graph_lat_3 = \
731 int(graph_timestamp_3) - int(t0_system)
732 graph_lat_4 = \
733 int(graph_timestamp_4) - int(t0_system)
734 graph_lat_5 = \
735 int(graph_timestamp_5) - int(t0_system)
736 graph_lat_6 = \
737 int(graph_timestamp_6) - int(t0_system)
738
739 avg_graph_lat = \
740 (int(graph_lat_1) +\
741 int(graph_lat_2) +\
742 int(graph_lat_3) +\
743 int(graph_lat_4) +\
744 int(graph_lat_5) +\
745 int(graph_lat_6)) / 6
746
747 if avg_graph_lat > sw_disc_threshold_min\
748 and avg_graph_lat < sw_disc_threshold_max:
749 sw_discovery_lat_list.append(
750 avg_graph_lat)
andrewonlabfd8325f2014-11-12 19:14:06 -0500751 main.log.info("Sw discovery latency of "+
752 str(cluster_count)+" node(s): "+
753 str(avg_graph_lat)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500754 else:
755 main.log.info("Switch discovery latency "+
756 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500757 main.log.info(avg_graph_lat)
andrewonlab51b180b2014-11-12 18:19:28 -0500758
759 break
760 if cluster_count == 7:
761 if onos1_dev and onos2_dev and onos3_dev and\
762 onos4_dev and onos5_dev and onos6_dev and\
763 onos7_dev:
764 main.log.info("All devices have been discovered"+
765 " on all ONOS instances")
andrewonlaba036b402014-11-17 13:47:46 -0500766
767 #TODO: Investigate this sleep
768 # added to 'pad' the results with
769 # plenty of time to 'catch up'
andrewonlab62749022014-11-19 19:19:58 -0500770 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500771
andrewonlab51b180b2014-11-12 18:19:28 -0500772 json_str_metrics_1 =\
773 main.ONOS1cli.topology_events_metrics()
774 json_str_metrics_2 =\
775 main.ONOS2cli.topology_events_metrics()
776 json_str_metrics_3 =\
777 main.ONOS3cli.topology_events_metrics()
778 json_str_metrics_4 =\
779 main.ONOS4cli.topology_events_metrics()
780 json_str_metrics_5 =\
781 main.ONOS5cli.topology_events_metrics()
782 json_str_metrics_6 =\
783 main.ONOS6cli.topology_events_metrics()
784 json_str_metrics_7 =\
785 main.ONOS7cli.topology_events_metrics()
786 json_obj_1 = json.loads(json_str_metrics_1)
787 json_obj_2 = json.loads(json_str_metrics_2)
788 json_obj_3 = json.loads(json_str_metrics_3)
789 json_obj_4 = json.loads(json_str_metrics_4)
790 json_obj_5 = json.loads(json_str_metrics_5)
791 json_obj_6 = json.loads(json_str_metrics_6)
792 json_obj_7 = json.loads(json_str_metrics_7)
793 graph_timestamp_1 =\
794 json_obj_1[graphTimestamp]['value']
795 graph_timestamp_2 =\
796 json_obj_2[graphTimestamp]['value']
797 graph_timestamp_3 =\
798 json_obj_3[graphTimestamp]['value']
799 graph_timestamp_4 =\
800 json_obj_4[graphTimestamp]['value']
801 graph_timestamp_5 =\
802 json_obj_5[graphTimestamp]['value']
803 graph_timestamp_6 =\
804 json_obj_6[graphTimestamp]['value']
805 graph_timestamp_7 =\
806 json_obj_7[graphTimestamp]['value']
807
808 graph_lat_1 = \
809 int(graph_timestamp_1) - int(t0_system)
810 graph_lat_2 = \
811 int(graph_timestamp_2) - int(t0_system)
812 graph_lat_3 = \
813 int(graph_timestamp_3) - int(t0_system)
814 graph_lat_4 = \
815 int(graph_timestamp_4) - int(t0_system)
816 graph_lat_5 = \
817 int(graph_timestamp_5) - int(t0_system)
818 graph_lat_6 = \
819 int(graph_timestamp_6) - int(t0_system)
820 graph_lat_7 = \
821 int(graph_timestamp_7) - int(t0_system)
822
823 avg_graph_lat = \
824 (int(graph_lat_1) +\
825 int(graph_lat_2) +\
826 int(graph_lat_3) +\
827 int(graph_lat_4) +\
828 int(graph_lat_5) +\
829 int(graph_lat_6) +\
830 int(graph_lat_7)) / 7
831
832 if avg_graph_lat > sw_disc_threshold_min\
833 and avg_graph_lat < sw_disc_threshold_max:
834 sw_discovery_lat_list.append(
835 avg_graph_lat)
andrewonlabfd8325f2014-11-12 19:14:06 -0500836 main.log.info("Sw discovery latency of "+
837 str(cluster_count)+" node(s): "+
838 str(avg_graph_lat)+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500839 else:
840 main.log.info("Switch discovery latency "+
841 "exceeded the threshold.")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500842 main.log.info(avg_graph_lat)
andrewonlab51b180b2014-11-12 18:19:28 -0500843
844 break
845
846 counter_loop += 1
847 time.sleep(3)
848 #END WHILE LOOP
andrewonlaba036b402014-11-17 13:47:46 -0500849
850 main.ONOS1.tshark_stop()
andrewonlaba1272172014-11-17 17:30:35 -0500851 syn_ack_timestamp_list = []
andrewonlaba036b402014-11-17 13:47:46 -0500852
853 if cluster_count >= 3:
854 main.ONOS2.tshark_stop()
855 main.ONOS3.tshark_stop()
andrewonlaba1272172014-11-17 17:30:35 -0500856 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500857 os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500858 "/tmp/syn_ack_onos1_iter"+str(i)+".txt /tmp/")
andrewonlaba036b402014-11-17 13:47:46 -0500859 os.system("scp "+ONOS_user+"@"+ONOS2_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500860 "/tmp/syn_ack_onos2_iter"+str(i)+".txt /tmp/")
andrewonlaba036b402014-11-17 13:47:46 -0500861 os.system("scp "+ONOS_user+"@"+ONOS3_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500862 "/tmp/syn_ack_onos3_iter"+str(i)+".txt /tmp/")
863 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500864 #Read each of the files and append all
865 #SYN / ACK timestamps to the list
andrewonlaba1272172014-11-17 17:30:35 -0500866 with open("/tmp/syn_ack_onos1_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500867 f_onos1:
868 for line in f_onos1:
869 line = line.split(" ")
870 syn_ack_timestamp_list.append(line[1])
andrewonlaba1272172014-11-17 17:30:35 -0500871 with open("/tmp/syn_ack_onos2_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500872 f_onos2:
873 for line in f_onos2:
874 line = line.split(" ")
875 syn_ack_timestamp_list.append(line[1])
andrewonlaba1272172014-11-17 17:30:35 -0500876 with open("/tmp/syn_ack_onos3_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500877 f_onos3:
878 for line in f_onos3:
879 line = line.split(" ")
880 syn_ack_timestamp_list.append(line[1])
881 if cluster_count >= 4:
882 main.ONOS4.tshark_stop()
andrewonlaba1272172014-11-17 17:30:35 -0500883 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500884 os.system("scp "+ONOS_user+"@"+ONOS4_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500885 "/tmp/syn_ack_onos4_iter"+str(i)+".txt /tmp/")
886 time.sleep(5)
887 with open("/tmp/syn_ack_onos4_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500888 f_onos4:
889 for line in f_onos4:
890 line = line.split(" ")
891 syn_ack_timestamp_list.append(line[1])
892 if cluster_count >= 5:
893 main.ONOS5.tshark_stop()
andrewonlaba1272172014-11-17 17:30:35 -0500894 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500895 os.system("scp "+ONOS_user+"@"+ONOS5_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500896 "/tmp/syn_ack_onos5_iter"+str(i)+".txt /tmp/")
897 time.sleep(5)
898 with open("/tmp/syn_ack_onos5_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500899 f_onos5:
900 for line in f_onos5:
901 line = line.split(" ")
902 syn_ack_timestamp_list.append(line[1])
903 if cluster_count >= 6:
904 main.ONOS6.tshark_stop()
andrewonlaba1272172014-11-17 17:30:35 -0500905 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500906 os.system("scp "+ONOS_user+"@"+ONOS6_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500907 "/tmp/syn_ack_onos6_iter"+str(i)+".txt /tmp/")
908 time.sleep(5)
909 with open("/tmp/syn_ack_onos6_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500910 f_onos6:
911 for line in f_onos6:
912 line = line.split(" ")
913 syn_ack_timestamp_list.append(line[1])
914 if cluster_count == 7:
915 main.ONOS7.tshark_stop()
andrewonlaba1272172014-11-17 17:30:35 -0500916 time.sleep(5)
andrewonlaba036b402014-11-17 13:47:46 -0500917 os.system("scp "+ONOS_user+"@"+ONOS7_ip+":"+
andrewonlaba1272172014-11-17 17:30:35 -0500918 "/tmp/syn_ack_onos7_iter"+str(i)+".txt /tmp/")
919 time.sleep(5)
920 with open("/tmp/syn_ack_onos7_iter"+str(i)+".txt") as\
andrewonlaba036b402014-11-17 13:47:46 -0500921 f_onos7:
922 for line in f_onos7:
923 line = line.split(" ")
924 syn_ack_timestamp_list.append(line[1])
925
926 #Sort the list by timestamp
927 syn_ack_timestamp_list = sorted(syn_ack_timestamp_list)
andrewonlaba1272172014-11-17 17:30:35 -0500928
929 syn_ack_delta =\
930 int(float(syn_ack_timestamp_list[-1])*1000) -\
931 int(float(syn_ack_timestamp_list[0])*1000)
andrewonlaba036b402014-11-17 13:47:46 -0500932
andrewonlaba1272172014-11-17 17:30:35 -0500933 main.log.info("Switch connection attempt delta iteration "+
934 str(i)+": "+str(syn_ack_delta))
935 syn_ack_delta_list.append(syn_ack_delta)
andrewonlab51b180b2014-11-12 18:19:28 -0500936 #END ITERATION LOOP
937 #REPORT HERE
938
939 if len(sw_discovery_lat_list) > 0:
940 sw_lat_avg = sum(sw_discovery_lat_list) / \
941 len(sw_discovery_lat_list)
andrewonlabfd8325f2014-11-12 19:14:06 -0500942 sw_lat_dev = numpy.std(sw_discovery_lat_list)
andrewonlab51b180b2014-11-12 18:19:28 -0500943 else:
944 assertion = main.FALSE
andrewonlaba1272172014-11-17 17:30:35 -0500945
946 main.log.report("Switch connection attempt time avg "+
andrewonlabd784d4f2014-11-17 17:47:32 -0500947 "(last sw SYN/ACK time - first sw SYN/ACK time) "+
andrewonlaba1272172014-11-17 17:30:35 -0500948 str(sum(syn_ack_delta_list)/len(syn_ack_delta_list)) +
949 " ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500950 main.log.report("Switch discovery lat for "+\
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500951 str(cluster_count)+" instance(s), 100 sw each: ")
andrewonlab51b180b2014-11-12 18:19:28 -0500952 main.log.report("Avg: "+str(sw_lat_avg)+" ms")
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500953 main.log.report("Std Deviation: "+
954 str(round(sw_lat_dev,1))+" ms")
andrewonlab51b180b2014-11-12 18:19:28 -0500955
956 utilities.assert_equals(expect=main.TRUE, actual=assertion,
957 onpass="Switch discovery convergence latency" +\
andrewonlabfd8325f2014-11-12 19:14:06 -0500958 " for "+str(cluster_count)+" nodes successful",
andrewonlab51b180b2014-11-12 18:19:28 -0500959 onfail="Switch discovery convergence latency" +\
960 " test failed")
961
andrewonlabadd2fd62014-11-11 18:37:35 -0500962 def CASE3(self, main):
963 '''
andrewonlab54cec4b2014-11-12 13:30:23 -0500964 Increase number of nodes and initiate CLI
andrewonlabadd2fd62014-11-11 18:37:35 -0500965 '''
966 import time
967 import subprocess
968 import os
969 import requests
970 import json
971
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500972 ONOS1_ip = main.params['CTRL']['ip1']
973 ONOS2_ip = main.params['CTRL']['ip2']
974 ONOS3_ip = main.params['CTRL']['ip3']
975 ONOS4_ip = main.params['CTRL']['ip4']
976 ONOS5_ip = main.params['CTRL']['ip5']
977 ONOS6_ip = main.params['CTRL']['ip6']
978 ONOS7_ip = main.params['CTRL']['ip7']
979
980 cell_name = main.params['ENV']['cellName']
981
andrewonlabadd2fd62014-11-11 18:37:35 -0500982 MN1_ip = main.params['MN']['ip1']
983 BENCH_ip = main.params['BENCH']['ip']
andrewonlab0cfc7ad2014-11-13 16:29:26 -0500984
andrewonlaba036b402014-11-17 13:47:46 -0500985 #NOTE:We start with cluster_count at 3. The first
andrewonlabadd2fd62014-11-11 18:37:35 -0500986 #case already initialized ONOS1. Increase the
andrewonlaba036b402014-11-17 13:47:46 -0500987 #cluster count and start from 3.
andrewonlabadd2fd62014-11-11 18:37:35 -0500988 #You can optionally change the increment to
andrewonlaba036b402014-11-17 13:47:46 -0500989 #test steps of node sizes, such as 3,5,7
andrewonlabadd2fd62014-11-11 18:37:35 -0500990
991 global cluster_count
andrewonlab54cec4b2014-11-12 13:30:23 -0500992 cluster_count += 2
andrewonlab7b4e8ba2014-11-20 17:45:04 -0500993
andrewonlaba036b402014-11-17 13:47:46 -0500994 install_result = main.FALSE
andrewonlabadd2fd62014-11-11 18:37:35 -0500995 #Supports up to 7 node configuration
andrewonlab81763ee2014-11-13 17:31:34 -0500996 #TODO: Cleanup this ridiculous repetitive code
andrewonlaba036b402014-11-17 13:47:46 -0500997 if cluster_count == 4:
998 main.log.info("Installing ONOS on node 4")
999 install_result = \
1000 main.ONOSbench.onos_install(node=ONOS4_ip)
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001001 time.sleep(5)
andrewonlab81763ee2014-11-13 17:31:34 -05001002 main.log.info("Starting CLI")
andrewonlab81763ee2014-11-13 17:31:34 -05001003 main.ONOS4cli.start_onos_cli(ONOS4_ip)
andrewonlaba036b402014-11-17 13:47:46 -05001004 main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
1005
andrewonlab81763ee2014-11-13 17:31:34 -05001006 elif cluster_count == 5:
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001007 main.log.info("Installing ONOS on nodes 4 and 5")
andrewonlaba036b402014-11-17 13:47:46 -05001008 install_result1 = \
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001009 main.ONOSbench.onos_install(node=ONOS4_ip)
andrewonlaba036b402014-11-17 13:47:46 -05001010 install_result2 = \
1011 main.ONOSbench.onos_install(node=ONOS5_ip)
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001012 time.sleep(5)
andrewonlab81763ee2014-11-13 17:31:34 -05001013 main.log.info("Starting CLI")
andrewonlab81763ee2014-11-13 17:31:34 -05001014 main.ONOS4cli.start_onos_cli(ONOS4_ip)
1015 main.ONOS5cli.start_onos_cli(ONOS5_ip)
andrewonlaba036b402014-11-17 13:47:46 -05001016 main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
1017 main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
1018 install_result = install_result1 and install_result2
1019
andrewonlab81763ee2014-11-13 17:31:34 -05001020 elif cluster_count == 6:
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001021 main.log.info("Installing ONOS on nodes 4, 5,and 6")
andrewonlaba036b402014-11-17 13:47:46 -05001022 install_result1 = \
1023 main.ONOSbench.onos_install(options="",node=ONOS4_ip)
1024 install_result2 = \
1025 main.ONOSbench.onos_install(options="",node=ONOS5_ip)
1026 install_result3 = \
1027 main.ONOSbench.onos_install(node=ONOS6_ip)
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001028 time.sleep(5)
andrewonlab81763ee2014-11-13 17:31:34 -05001029 main.log.info("Starting CLI")
andrewonlab81763ee2014-11-13 17:31:34 -05001030 main.ONOS4cli.start_onos_cli(ONOS4_ip)
1031 main.ONOS5cli.start_onos_cli(ONOS5_ip)
1032 main.ONOS6cli.start_onos_cli(ONOS6_ip)
andrewonlaba036b402014-11-17 13:47:46 -05001033 main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
1034 main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
1035 main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip)
1036 install_result = install_result1 and install_result2 and\
1037 install_result3
1038
andrewonlab81763ee2014-11-13 17:31:34 -05001039 elif cluster_count == 7:
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001040 main.log.info("Installing ONOS on nodes 4, 5, 6,and 7")
andrewonlaba036b402014-11-17 13:47:46 -05001041 install_result1 = \
1042 main.ONOSbench.onos_install(options="",node=ONOS4_ip)
1043 install_result2 = \
1044 main.ONOSbench.onos_install(options="",node=ONOS5_ip)
1045 install_result3 = \
1046 main.ONOSbench.onos_install(options="",node=ONOS6_ip)
1047 install_result4 = \
1048 main.ONOSbench.onos_install(node=ONOS7_ip)
andrewonlab81763ee2014-11-13 17:31:34 -05001049 main.log.info("Starting CLI")
andrewonlab81763ee2014-11-13 17:31:34 -05001050 main.ONOS4cli.start_onos_cli(ONOS4_ip)
1051 main.ONOS5cli.start_onos_cli(ONOS5_ip)
1052 main.ONOS6cli.start_onos_cli(ONOS6_ip)
1053 main.ONOS7cli.start_onos_cli(ONOS7_ip)
andrewonlaba036b402014-11-17 13:47:46 -05001054 main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
1055 main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
1056 main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip)
1057 main.ONOS1cli.add_node(ONOS7_ip, ONOS7_ip)
andrewonlab81763ee2014-11-13 17:31:34 -05001058
andrewonlaba036b402014-11-17 13:47:46 -05001059 install_result = install_result1 and install_result2 and\
1060 install_result3 and install_result4
andrewonlab81763ee2014-11-13 17:31:34 -05001061
1062 time.sleep(5)
andrewonlabadd2fd62014-11-11 18:37:35 -05001063
andrewonlab0cfc7ad2014-11-13 16:29:26 -05001064 if install_result == main.TRUE:
1065 assertion = main.TRUE
1066 else:
1067 assertion = main.FALSE
1068
1069 utilities.assert_equals(expect=main.TRUE, actual=assertion,
1070 onpass="Scale out to "+str(cluster_count)+\
1071 " nodes successful",
1072 onfail="Scale out to "+str(cluster_count)+\
1073 " nodes failed")
andrewonlab7b4e8ba2014-11-20 17:45:04 -05001074
1075
1076 def CASE4(self, main):
1077 '''
1078 Cleanup ONOS nodes and Increase topology size
1079 '''
1080
1081 ONOS1_ip = main.params['CTRL']['ip1']
1082 ONOS2_ip = main.params['CTRL']['ip2']
1083 ONOS3_ip = main.params['CTRL']['ip3']
1084 ONOS4_ip = main.params['CTRL']['ip4']
1085 ONOS5_ip = main.params['CTRL']['ip5']
1086 ONOS6_ip = main.params['CTRL']['ip6']
1087 ONOS7_ip = main.params['CTRL']['ip7']
1088 MN1_ip = main.params['MN']['ip1']
1089 BENCH_ip = main.params['BENCH']['ip']
1090
1091 main.log.info("Uninstalling previous instances")
1092 main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip)
1093 main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip)
1094 main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip)
1095 main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip)
1096
1097 global topo_iteration
1098 global cluster_count
1099 cluster_count = 3
1100 topo_iteration += 1
1101
1102