blob: 03fcfe71f6e224feb2925b44182099ad648c1250 [file] [log] [blame]
Jon Hallb1290e82014-11-18 16:17:48 -05001'''
2Description: This test is to determine if the HA test setup is
3 working correctly. There are no failures so this test should
4 have a 100% pass rate
5
6List of test cases:
7CASE1: Compile ONOS and push it to the test machines
8CASE2: Assign mastership to controllers
9CASE3: Assign intents
10CASE4: Ping across added host intents
11CASE5: Reading state of ONOS
12CASE6: The Failure case. Since this is the Sanity test, we do nothing.
Jon Hall368769f2014-11-19 15:43:35 -080013CASE7: Check state after control plane failure
Jon Hallb1290e82014-11-18 16:17:48 -050014CASE8: Compare topo
15CASE9: Link s3-s28 down
16CASE10: Link s3-s28 up
17CASE11: Switch down
18CASE12: Switch up
19CASE13: Clean up
20'''
21class HATestSanity:
22
23 def __init__(self) :
24 self.default = ''
25
26 def CASE1(self,main) :
27 '''
28 CASE1 is to compile ONOS and push it to the test machines
29
30 Startup sequence:
31 git pull
32 mvn clean install
33 onos-package
34 cell <name>
35 onos-verify-cell
36 NOTE: temporary - onos-remove-raft-logs
37 onos-install -f
38 onos-wait-for-start
39 '''
40 import time
Jon Hall368769f2014-11-19 15:43:35 -080041 main.log.report("ONOS HA Sanity test - initialization")
Jon Hallb1290e82014-11-18 16:17:48 -050042 main.case("Setting up test environment")
43
44 # load some vairables from the params file
45 PULL_CODE = False
46 if main.params['Git'] == 'True':
47 PULL_CODE = True
48 cell_name = main.params['ENV']['cellName']
49
50 #set global variables
51 global ONOS1_ip
52 global ONOS1_port
53 global ONOS2_ip
54 global ONOS2_port
55 global ONOS3_ip
56 global ONOS3_port
57 global ONOS4_ip
58 global ONOS4_port
59 global ONOS5_ip
60 global ONOS5_port
61 global ONOS6_ip
62 global ONOS6_port
63 global ONOS7_ip
64 global ONOS7_port
65
66 ONOS1_ip = main.params['CTRL']['ip1']
67 ONOS1_port = main.params['CTRL']['port1']
68 ONOS2_ip = main.params['CTRL']['ip2']
69 ONOS2_port = main.params['CTRL']['port2']
70 ONOS3_ip = main.params['CTRL']['ip3']
71 ONOS3_port = main.params['CTRL']['port3']
72 ONOS4_ip = main.params['CTRL']['ip4']
73 ONOS4_port = main.params['CTRL']['port4']
74 ONOS5_ip = main.params['CTRL']['ip5']
75 ONOS5_port = main.params['CTRL']['port5']
76 ONOS6_ip = main.params['CTRL']['ip6']
77 ONOS6_port = main.params['CTRL']['port6']
78 ONOS7_ip = main.params['CTRL']['ip7']
79 ONOS7_port = main.params['CTRL']['port7']
80
81
82 main.step("Applying cell variable to environment")
83 cell_result = main.ONOSbench.set_cell(cell_name)
84 verify_result = main.ONOSbench.verify_cell()
Jon Hall368769f2014-11-19 15:43:35 -080085
86 main.ONOSbench.onos_stop(ONOS1_ip)
87 main.ONOSbench.onos_stop(ONOS2_ip)
88 main.ONOSbench.onos_stop(ONOS3_ip)
89 main.ONOSbench.onos_stop(ONOS4_ip)
90 main.ONOSbench.onos_stop(ONOS5_ip)
91 main.ONOSbench.onos_stop(ONOS6_ip)
92 main.ONOSbench.onos_stop(ONOS7_ip)
Jon Hallb1290e82014-11-18 16:17:48 -050093 #FIXME:this is short term fix
94 main.ONOSbench.onos_remove_raft_logs()
95
96 clean_install_result = main.TRUE
97 git_pull_result = main.TRUE
98
99 main.step("Compiling the latest version of ONOS")
100 if PULL_CODE:
101 main.step("Git checkout and pull master")
102 main.ONOSbench.git_checkout("master")
103 git_pull_result = main.ONOSbench.git_pull()
104
105 main.step("Using mvn clean & install")
106 clean_install_result = main.TRUE
107 if git_pull_result == main.TRUE:
108 clean_install_result = main.ONOSbench.clean_install()
109 else:
Jon Hall368769f2014-11-19 15:43:35 -0800110 main.log.warn("Did not pull new code so skipping mvn "+ \
Jon Hallb1290e82014-11-18 16:17:48 -0500111 "clean install")
112 main.ONOSbench.get_version(report=True)
113
114 main.step("Creating ONOS package")
115 package_result = main.ONOSbench.onos_package()
116
117 main.step("Installing ONOS package")
118 onos1_install_result = main.ONOSbench.onos_install(options="-f",
119 node=ONOS1_ip)
120 onos2_install_result = main.ONOSbench.onos_install(options="-f",
121 node=ONOS2_ip)
122 onos3_install_result = main.ONOSbench.onos_install(options="-f",
123 node=ONOS3_ip)
124 onos4_install_result = main.ONOSbench.onos_install(options="-f",
125 node=ONOS4_ip)
126 onos5_install_result = main.ONOSbench.onos_install(options="-f",
127 node=ONOS5_ip)
128 onos6_install_result = main.ONOSbench.onos_install(options="-f",
129 node=ONOS6_ip)
130 onos7_install_result = main.ONOSbench.onos_install(options="-f",
131 node=ONOS7_ip)
132 onos_install_result = onos1_install_result and onos2_install_result\
133 and onos3_install_result and onos4_install_result\
134 and onos5_install_result and onos6_install_result\
135 and onos7_install_result
136
137
138 main.step("Checking if ONOS is up yet")
139 onos1_isup = main.ONOSbench.isup(ONOS1_ip)
140 onos2_isup = main.ONOSbench.isup(ONOS2_ip)
141 onos3_isup = main.ONOSbench.isup(ONOS3_ip)
142 onos4_isup = main.ONOSbench.isup(ONOS4_ip)
143 onos5_isup = main.ONOSbench.isup(ONOS5_ip)
144 onos6_isup = main.ONOSbench.isup(ONOS6_ip)
145 onos7_isup = main.ONOSbench.isup(ONOS7_ip)
146 onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
147 and onos4_isup and onos5_isup and onos6_isup and onos7_isup
148 # TODO: if it becomes an issue, we can retry this step a few times
149
150
151 main.ONOScli1.start_onos_cli(ONOS1_ip)
152 main.ONOScli2.start_onos_cli(ONOS2_ip)
153 main.ONOScli3.start_onos_cli(ONOS3_ip)
154 main.ONOScli4.start_onos_cli(ONOS4_ip)
155 main.ONOScli5.start_onos_cli(ONOS5_ip)
156 main.ONOScli6.start_onos_cli(ONOS6_ip)
157 main.ONOScli7.start_onos_cli(ONOS7_ip)
158
Jon Hall368769f2014-11-19 15:43:35 -0800159 main.step("Start Packet Capture MN")
160 main.Mininet2.start_tcpdump(
161 str(main.params['MNtcpdump']['folder'])+str(main.TEST)+"-MN.pcap",
162 intf = main.params['MNtcpdump']['intf'],
163 port = main.params['MNtcpdump']['port'])
Jon Hallb1290e82014-11-18 16:17:48 -0500164
165
166 case1_result = (clean_install_result and package_result and
167 cell_result and verify_result and onos_install_result and
168 onos_isup_result)
169
170 utilities.assert_equals(expect=main.TRUE, actual=case1_result,
171 onpass="Test startup successful",
172 onfail="Test startup NOT successful")
173
174
175 #if case1_result==main.FALSE:
176 # main.cleanup()
177 # main.exit()
178
179 def CASE2(self,main) :
180 '''
181 Assign mastership to controllers
182 '''
183 import time
184 import json
185 import re
186
187
188 '''
189 ONOS1_ip = main.params['CTRL']['ip1']
190 ONOS1_port = main.params['CTRL']['port1']
191 ONOS2_ip = main.params['CTRL']['ip2']
192 ONOS2_port = main.params['CTRL']['port2']
193 ONOS3_ip = main.params['CTRL']['ip3']
194 ONOS3_port = main.params['CTRL']['port3']
195 ONOS4_ip = main.params['CTRL']['ip4']
196 ONOS4_port = main.params['CTRL']['port4']
197 ONOS5_ip = main.params['CTRL']['ip5']
198 ONOS5_port = main.params['CTRL']['port5']
199 ONOS6_ip = main.params['CTRL']['ip6']
200 ONOS6_port = main.params['CTRL']['port6']
201 ONOS7_ip = main.params['CTRL']['ip7']
202 ONOS7_port = main.params['CTRL']['port7']
203 '''
204
205
206 main.log.report("Assigning switches to controllers")
207 main.case("Assigning Controllers")
208 main.step("Assign switches to controllers")
209
210 for i in range (1,29):
211 main.Mininet1.assign_sw_controller(sw=str(i),count=7,
212 ip1=ONOS1_ip,port1=ONOS1_port,
213 ip2=ONOS2_ip,port2=ONOS2_port,
214 ip3=ONOS3_ip,port3=ONOS3_port,
215 ip4=ONOS4_ip,port4=ONOS4_port,
216 ip5=ONOS5_ip,port5=ONOS5_port,
217 ip6=ONOS6_ip,port6=ONOS6_port,
218 ip7=ONOS7_ip,port7=ONOS7_port)
219
220 mastership_check = main.TRUE
221 for i in range (1,29):
222 response = main.Mininet1.get_sw_controller("s"+str(i))
223 main.log.info(str(response))
224 if re.search("tcp:"+ONOS1_ip,response)\
225 and re.search("tcp:"+ONOS2_ip,response)\
226 and re.search("tcp:"+ONOS3_ip,response)\
227 and re.search("tcp:"+ONOS4_ip,response)\
228 and re.search("tcp:"+ONOS5_ip,response)\
229 and re.search("tcp:"+ONOS6_ip,response)\
230 and re.search("tcp:"+ONOS7_ip,response):
231 mastership_check = mastership_check and main.TRUE
232 else:
233 mastership_check = main.FALSE
234 if mastership_check == main.TRUE:
235 main.log.report("Switch mastership assigned correctly")
236 utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
237 onpass="Switch mastership assigned correctly",
238 onfail="Switches not assigned correctly to controllers")
239
240 #TODO: If assign roles is working reliably then manually
241 # assign mastership to the controller we want
242
243
244 def CASE3(self,main) :
245 """
246 Assign intents
247
248 """
249 import time
250 import json
251 import re
252 main.log.report("Adding host intents")
253 main.case("Adding host Intents")
254
255 main.step("Discovering Hosts( Via pingall for now)")
256 #FIXME: Once we have a host discovery mechanism, use that instead
257
258 #REACTIVE FWD test
259 ping_result = main.FALSE
260 time1 = time.time()
261 ping_result = main.Mininet1.pingall()
262 time2 = time.time()
263 main.log.info("Time for pingall: %2f seconds" % (time2 - time1))
264
265 #uninstall onos-app-fwd
266 main.log.info("Uninstall reactive forwarding app")
267 main.ONOScli1.feature_uninstall("onos-app-fwd")
268 main.ONOScli2.feature_uninstall("onos-app-fwd")
269 main.ONOScli3.feature_uninstall("onos-app-fwd")
270 main.ONOScli4.feature_uninstall("onos-app-fwd")
271 main.ONOScli5.feature_uninstall("onos-app-fwd")
272 main.ONOScli6.feature_uninstall("onos-app-fwd")
273 main.ONOScli7.feature_uninstall("onos-app-fwd")
274
275 main.step("Add host intents")
276 #TODO: move the host numbers to params
277 import json
278 intents_json= json.loads(main.ONOScli1.hosts())
279 intent_add_result = main.FALSE
280 for i in range(8,18):
281 main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
282 host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
283 host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
284 #NOTE: get host can return None
285 #TODO: handle this
286 host1_id = main.ONOScli1.get_host(host1)['id']
287 host2_id = main.ONOScli1.get_host(host2)['id']
288 tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
289 intent_add_result = intent_add_result and tmp_result
290 #TODO Check if intents all exist in datastore
291 #NOTE: Do we need to print this once the test is working?
292 #main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
293 # sort_keys=True, indent=4, separators=(',', ': ') ) )
294
295 def CASE4(self,main) :
296 """
297 Ping across added host intents
298 """
Jon Hall368769f2014-11-19 15:43:35 -0800299 description = " Ping across added host intents"
300 main.log.report(description)
301 main.case(description)
Jon Hallb1290e82014-11-18 16:17:48 -0500302 Ping_Result = main.TRUE
303 for i in range(8,18):
304 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
305 Ping_Result = Ping_Result and ping
306 if ping==main.FALSE:
307 main.log.warn("Ping failed between h"+str(i)+" and h" + str(i+10))
308 elif ping==main.TRUE:
309 main.log.info("Ping test passed!")
310 Ping_Result = main.TRUE
311 if Ping_Result==main.FALSE:
312 main.log.report("Intents have not been installed correctly, pings failed.")
313 if Ping_Result==main.TRUE:
Jon Hall368769f2014-11-19 15:43:35 -0800314 main.log.report("Intents have been installed correctly and verified by pings")
Jon Hallb1290e82014-11-18 16:17:48 -0500315 utilities.assert_equals(expect = main.TRUE,actual=Ping_Result,
Jon Hall368769f2014-11-19 15:43:35 -0800316 onpass="Intents have been installed correctly and pings work",
317 onfail ="Intents have not been installed correctly, pings failed." )
Jon Hallb1290e82014-11-18 16:17:48 -0500318
319 def CASE5(self,main) :
320 '''
321 Reading state of ONOS
322 '''
323 import time
324 import json
325 from subprocess import Popen, PIPE
326 from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
327
328 main.log.report("Setting up and gathering data for current state")
329 main.case("Setting up and gathering data for current state")
330 #The general idea for this test case is to pull the state of (intents,flows, topology,...) from each ONOS node
331 #We can then compare them with eachother and also with past states
332
333 main.step("Get the Mastership of each switch from each controller")
334 global mastership_state
335 ONOS1_mastership = main.ONOScli1.roles()
336 ONOS2_mastership = main.ONOScli2.roles()
337 ONOS3_mastership = main.ONOScli3.roles()
338 ONOS4_mastership = main.ONOScli4.roles()
339 ONOS5_mastership = main.ONOScli5.roles()
340 ONOS6_mastership = main.ONOScli6.roles()
341 ONOS7_mastership = main.ONOScli7.roles()
342 #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
343 if ONOS1_mastership == ONOS2_mastership\
344 and ONOS1_mastership == ONOS3_mastership\
345 and ONOS1_mastership == ONOS4_mastership\
346 and ONOS1_mastership == ONOS5_mastership\
347 and ONOS1_mastership == ONOS6_mastership\
348 and ONOS1_mastership == ONOS7_mastership:
349 mastership_state = ONOS1_mastership
350 consistent_mastership = main.TRUE
351 main.log.report("Switch roles are consistent across all ONOS nodes")
352 else:
353 main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
354 sort_keys=True, indent=4, separators=(',', ': ')))
355 main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
356 sort_keys=True, indent=4, separators=(',', ': ')))
357 main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
358 sort_keys=True, indent=4, separators=(',', ': ')))
359 main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
360 sort_keys=True, indent=4, separators=(',', ': ')))
361 main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
362 sort_keys=True, indent=4, separators=(',', ': ')))
363 main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
364 sort_keys=True, indent=4, separators=(',', ': ')))
365 main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
366 sort_keys=True, indent=4, separators=(',', ': ')))
367 consistent_mastership = main.FALSE
368 utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
369 onpass="Switch roles are consistent across all ONOS nodes",
370 onfail="ONOS nodes have different views of switch roles")
371
372
373 main.step("Get the intents from each controller")
374 global intent_state
375 ONOS1_intents = main.ONOScli1.intents( json_format=True )
376 ONOS2_intents = main.ONOScli2.intents( json_format=True )
377 ONOS3_intents = main.ONOScli3.intents( json_format=True )
378 ONOS4_intents = main.ONOScli4.intents( json_format=True )
379 ONOS5_intents = main.ONOScli5.intents( json_format=True )
380 ONOS6_intents = main.ONOScli6.intents( json_format=True )
381 ONOS7_intents = main.ONOScli7.intents( json_format=True )
382 intent_check = main.FALSE
383 if "Error" in ONOS1_intents\
384 or "Error" in ONOS2_intents\
385 or "Error" in ONOS3_intents\
386 or "Error" in ONOS4_intents\
387 or "Error" in ONOS5_intents\
388 or "Error" in ONOS6_intents\
389 or "Error" in ONOS7_intents:
390 main.log.error("Error in getting ONOS intents")
391 main.log.warn("ONOS1 intents response: " + str(ONOS1_intents))
392 main.log.warn("ONOS2 intents response: " + str(ONOS2_intents))
393 main.log.warn("ONOS3 intents response: " + str(ONOS3_intents))
394 main.log.warn("ONOS4 intents response: " + str(ONOS4_intents))
395 main.log.warn("ONOS5 intents response: " + str(ONOS5_intents))
396 main.log.warn("ONOS6 intents response: " + str(ONOS6_intents))
397 main.log.warn("ONOS7 intents response: " + str(ONOS7_intents))
398 elif ONOS1_intents == ONOS2_intents\
399 and ONOS1_intents == ONOS3_intents\
400 and ONOS1_intents == ONOS4_intents\
401 and ONOS1_intents == ONOS5_intents\
402 and ONOS1_intents == ONOS6_intents\
403 and ONOS1_intents == ONOS7_intents:
404 intent_state = ONOS1_intents
405 intent_check = main.TRUE
406 main.log.report("Intents are consistent across all ONOS nodes")
407 else:
408 main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
409 sort_keys=True, indent=4, separators=(',', ': ')))
410 main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
411 sort_keys=True, indent=4, separators=(',', ': ')))
412 main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
413 sort_keys=True, indent=4, separators=(',', ': ')))
414 main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
415 sort_keys=True, indent=4, separators=(',', ': ')))
416 main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
417 sort_keys=True, indent=4, separators=(',', ': ')))
418 main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
419 sort_keys=True, indent=4, separators=(',', ': ')))
420 main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
421 sort_keys=True, indent=4, separators=(',', ': ')))
422 utilities.assert_equals(expect = main.TRUE,actual=intent_check,
423 onpass="Intents are consistent across all ONOS nodes",
424 onfail="ONOS nodes have different views of intents")
425
426
427 main.step("Get the flows from each controller")
428 global flow_state
429 ONOS1_flows = main.ONOScli1.flows( json_format=True )
430 ONOS2_flows = main.ONOScli2.flows( json_format=True )
431 ONOS3_flows = main.ONOScli3.flows( json_format=True )
432 ONOS4_flows = main.ONOScli4.flows( json_format=True )
433 ONOS5_flows = main.ONOScli5.flows( json_format=True )
434 ONOS6_flows = main.ONOScli6.flows( json_format=True )
435 ONOS7_flows = main.ONOScli7.flows( json_format=True )
436 flow_check = main.FALSE
437 if "Error" in ONOS1_flows\
438 or "Error" in ONOS2_flows\
439 or "Error" in ONOS3_flows\
440 or "Error" in ONOS4_flows\
441 or "Error" in ONOS5_flows\
442 or "Error" in ONOS6_flows\
443 or "Error" in ONOS7_flows:
444 main.log.error("Error in getting ONOS intents")
445 main.log.warn("ONOS1 flows repsponse: "+ ONOS1_flows)
446 main.log.warn("ONOS2 flows repsponse: "+ ONOS2_flows)
447 main.log.warn("ONOS3 flows repsponse: "+ ONOS3_flows)
448 main.log.warn("ONOS4 flows repsponse: "+ ONOS4_flows)
449 main.log.warn("ONOS5 flows repsponse: "+ ONOS5_flows)
450 main.log.warn("ONOS6 flows repsponse: "+ ONOS6_flows)
451 main.log.warn("ONOS7 flows repsponse: "+ ONOS7_flows)
452 elif len(json.loads(ONOS1_flows)) == len(json.loads(ONOS2_flows))\
453 and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS3_flows))\
454 and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS4_flows))\
455 and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS5_flows))\
456 and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS6_flows))\
457 and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS7_flows)):
458 #TODO: Do a better check, maybe compare flows on switches?
459 flow_state = ONOS1_flows
460 flow_check = main.TRUE
461 main.log.report("Flow count is consistent across all ONOS nodes")
462 else:
463 main.log.warn("ONOS1 flows: "+ json.dumps(json.loads(ONOS1_flows),
464 sort_keys=True, indent=4, separators=(',', ': ')))
465 main.log.warn("ONOS2 flows: "+ json.dumps(json.loads(ONOS2_flows),
466 sort_keys=True, indent=4, separators=(',', ': ')))
467 main.log.warn("ONOS3 flows: "+ json.dumps(json.loads(ONOS3_flows),
468 sort_keys=True, indent=4, separators=(',', ': ')))
469 main.log.warn("ONOS4 flows: "+ json.dumps(json.loads(ONOS4_flows),
470 sort_keys=True, indent=4, separators=(',', ': ')))
471 main.log.warn("ONOS5 flows: "+ json.dumps(json.loads(ONOS5_flows),
472 sort_keys=True, indent=4, separators=(',', ': ')))
473 main.log.warn("ONOS6 flows: "+ json.dumps(json.loads(ONOS6_flows),
474 sort_keys=True, indent=4, separators=(',', ': ')))
475 main.log.warn("ONOS7 flows: "+ json.dumps(json.loads(ONOS7_flows),
476 sort_keys=True, indent=4, separators=(',', ': ')))
477 utilities.assert_equals(expect = main.TRUE,actual=flow_check,
478 onpass="The flow count is consistent across all ONOS nodes",
479 onfail="ONOS nodes have different flow counts")
480
481
482 main.step("Get the OF Table entries")
483 global flows
484 flows=[]
485 for i in range(1,29):
486 flows.append(main.Mininet2.get_flowTable("s"+str(i),1.0))
487
488 #TODO: Compare switch flow tables with ONOS flow tables
489
490 main.step("Start continuous pings")
491 main.Mininet2.pingLong(src=main.params['PING']['source1'],
492 target=main.params['PING']['target1'],pingTime=500)
493 main.Mininet2.pingLong(src=main.params['PING']['source2'],
494 target=main.params['PING']['target2'],pingTime=500)
495 main.Mininet2.pingLong(src=main.params['PING']['source3'],
496 target=main.params['PING']['target3'],pingTime=500)
497 main.Mininet2.pingLong(src=main.params['PING']['source4'],
498 target=main.params['PING']['target4'],pingTime=500)
499 main.Mininet2.pingLong(src=main.params['PING']['source5'],
500 target=main.params['PING']['target5'],pingTime=500)
501 main.Mininet2.pingLong(src=main.params['PING']['source6'],
502 target=main.params['PING']['target6'],pingTime=500)
503 main.Mininet2.pingLong(src=main.params['PING']['source7'],
504 target=main.params['PING']['target7'],pingTime=500)
505 main.Mininet2.pingLong(src=main.params['PING']['source8'],
506 target=main.params['PING']['target8'],pingTime=500)
507 main.Mininet2.pingLong(src=main.params['PING']['source9'],
508 target=main.params['PING']['target9'],pingTime=500)
509 main.Mininet2.pingLong(src=main.params['PING']['source10'],
510 target=main.params['PING']['target10'],pingTime=500)
511
512 main.step("Create TestONTopology object")
513 ctrls = []
514 count = 1
515 while True:
516 temp = ()
517 if ('ip' + str(count)) in main.params['CTRL']:
518 temp = temp + (getattr(main,('ONOS' + str(count))),)
519 temp = temp + ("ONOS"+str(count),)
520 temp = temp + (main.params['CTRL']['ip'+str(count)],)
521 temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
522 ctrls.append(temp)
523 count = count + 1
524 else:
525 break
526 MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
527
528 main.step("Collecting topology information from ONOS")
529 devices = []
530 devices.append( main.ONOScli1.devices() )
531 devices.append( main.ONOScli2.devices() )
532 devices.append( main.ONOScli3.devices() )
533 devices.append( main.ONOScli4.devices() )
534 devices.append( main.ONOScli5.devices() )
535 devices.append( main.ONOScli6.devices() )
536 devices.append( main.ONOScli7.devices() )
537 '''
538 hosts = []
539 hosts.append( main.ONOScli1.hosts() )
540 hosts.append( main.ONOScli2.hosts() )
541 hosts.append( main.ONOScli3.hosts() )
542 hosts.append( main.ONOScli4.hosts() )
543 hosts.append( main.ONOScli5.hosts() )
544 hosts.append( main.ONOScli6.hosts() )
545 hosts.append( main.ONOScli7.hosts() )
546 '''
547 ports = []
548 ports.append( main.ONOScli1.ports() )
549 ports.append( main.ONOScli2.ports() )
550 ports.append( main.ONOScli3.ports() )
551 ports.append( main.ONOScli4.ports() )
552 ports.append( main.ONOScli5.ports() )
553 ports.append( main.ONOScli6.ports() )
554 ports.append( main.ONOScli7.ports() )
555 links = []
556 links.append( main.ONOScli1.links() )
557 links.append( main.ONOScli2.links() )
558 links.append( main.ONOScli3.links() )
559 links.append( main.ONOScli4.links() )
560 links.append( main.ONOScli5.links() )
561 links.append( main.ONOScli6.links() )
562 links.append( main.ONOScli7.links() )
563
564
565 main.step("Comparing ONOS topology to MN")
566 devices_results = main.TRUE
567 ports_results = main.TRUE
568 links_results = main.TRUE
569 for controller in range(7): #TODO parameterize the number of controllers
570 current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
571 utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
572 onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
573 onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
574
575 current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
576 utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
577 onpass="ONOS"+str(int(controller+1))+" ports view is correct",
578 onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
579
580 current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
581 utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
582 onpass="ONOS"+str(int(controller+1))+" links view is correct",
583 onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
584
585 devices_results = devices_results and current_devices_result
586 ports_results = ports_results and current_ports_result
587 links_results = links_results and current_links_result
588
589 topo_result = devices_results and ports_results and links_results
590 utilities.assert_equals(expect=main.TRUE, actual=topo_result,
591 onpass="Topology Check Test successful",
592 onfail="Topology Check Test NOT successful")
593
594 final_assert = main.TRUE
595 final_assert = final_assert and topo_result and flow_check \
596 and intent_check and consistent_mastership
597 utilities.assert_equals(expect=main.TRUE, actual=final_assert,
598 onpass="State check successful",
599 onfail="State check NOT successful")
600
601
602 def CASE6(self,main) :
603 '''
604 The Failure case. Since this is the Sanity test, we do nothing.
605 '''
Jon Hall368769f2014-11-19 15:43:35 -0800606 import time
607 time.sleep(60)
608 utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
609 onpass="Sleeping 60 seconds",
610 onfail="Something is terribly wrong with my math")
Jon Hallb1290e82014-11-18 16:17:48 -0500611
612 def CASE7(self,main) :
613 '''
Jon Hall368769f2014-11-19 15:43:35 -0800614 Check state after ONOS failure
Jon Hallb1290e82014-11-18 16:17:48 -0500615 '''
616 import os
617 import json
618 main.case("Running ONOS Constant State Tests")
619
620 main.step("Check if switch roles are consistent across all nodes")
621 ONOS1_mastership = main.ONOScli1.roles()
622 ONOS2_mastership = main.ONOScli2.roles()
623 ONOS3_mastership = main.ONOScli3.roles()
624 ONOS4_mastership = main.ONOScli4.roles()
625 ONOS5_mastership = main.ONOScli5.roles()
626 ONOS6_mastership = main.ONOScli6.roles()
627 ONOS7_mastership = main.ONOScli7.roles()
628 #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
629 if ONOS1_mastership == ONOS2_mastership\
630 and ONOS1_mastership == ONOS3_mastership\
631 and ONOS1_mastership == ONOS4_mastership\
632 and ONOS1_mastership == ONOS5_mastership\
633 and ONOS1_mastership == ONOS6_mastership\
634 and ONOS1_mastership == ONOS7_mastership:
635 #mastership_state = ONOS1_mastership
636 consistent_mastership = main.TRUE
637 main.log.report("Switch roles are consistent across all ONOS nodes")
638 else:
639 main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
640 sort_keys=True, indent=4, separators=(',', ': ')))
641 main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
642 sort_keys=True, indent=4, separators=(',', ': ')))
643 main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
644 sort_keys=True, indent=4, separators=(',', ': ')))
645 main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
646 sort_keys=True, indent=4, separators=(',', ': ')))
647 main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
648 sort_keys=True, indent=4, separators=(',', ': ')))
649 main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
650 sort_keys=True, indent=4, separators=(',', ': ')))
651 main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
652 sort_keys=True, indent=4, separators=(',', ': ')))
653 consistent_mastership = main.FALSE
654 utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
655 onpass="Switch roles are consistent across all ONOS nodes",
656 onfail="ONOS nodes have different views of switch roles")
657
658
659 description2 = "Compare switch roles from before failure"
660 main.step(description2)
661
Jon Hallb1290e82014-11-18 16:17:48 -0500662 current_json = json.loads(ONOS1_mastership)
663 old_json = json.loads(mastership_state)
664 mastership_check = main.TRUE
665 for i in range(1,29):
666 switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
667
668 current = [switch['master'] for switch in current_json if switchDPID in switch['id']]
669 old = [switch['master'] for switch in old_json if switchDPID in switch['id']]
670 if current == old:
671 mastership_check = mastership_check and main.TRUE
672 else:
673 main.log.warn("Mastership of switch %s changed" % switchDPID)
674 mastership_check = main.FALSE
675 if mastership_check == main.TRUE:
676 main.log.report("Mastership of Switches was not changed")
677 utilities.assert_equals(expect=main.TRUE,actual=mastership_check,
678 onpass="Mastership of Switches was not changed",
679 onfail="Mastership of some switches changed")
680 mastership_check = mastership_check and consistent_mastership
681
682
683
684 main.step("Get the intents and compare across all nodes")
685 ONOS1_intents = main.ONOScli1.intents( json_format=True )
686 ONOS2_intents = main.ONOScli2.intents( json_format=True )
687 ONOS3_intents = main.ONOScli3.intents( json_format=True )
688 ONOS4_intents = main.ONOScli4.intents( json_format=True )
689 ONOS5_intents = main.ONOScli5.intents( json_format=True )
690 ONOS6_intents = main.ONOScli6.intents( json_format=True )
691 ONOS7_intents = main.ONOScli7.intents( json_format=True )
692 intent_check = main.FALSE
693 if "Error" in ONOS1_intents\
694 or "Error" in ONOS2_intents\
695 or "Error" in ONOS3_intents\
696 or "Error" in ONOS4_intents\
697 or "Error" in ONOS5_intents\
698 or "Error" in ONOS6_intents\
699 or "Error" in ONOS7_intents:
700 main.log.error("Error in getting ONOS intents")
701 main.log.warn("ONOS1 intents response: " + str(ONOS1_intents))
702 main.log.warn("ONOS2 intents response: " + str(ONOS2_intents))
703 main.log.warn("ONOS3 intents response: " + str(ONOS3_intents))
704 main.log.warn("ONOS4 intents response: " + str(ONOS4_intents))
705 main.log.warn("ONOS5 intents response: " + str(ONOS5_intents))
706 main.log.warn("ONOS6 intents response: " + str(ONOS6_intents))
707 main.log.warn("ONOS7 intents response: " + str(ONOS7_intents))
708 elif ONOS1_intents == ONOS2_intents\
709 and ONOS1_intents == ONOS3_intents\
710 and ONOS1_intents == ONOS4_intents\
711 and ONOS1_intents == ONOS5_intents\
712 and ONOS1_intents == ONOS6_intents\
713 and ONOS1_intents == ONOS7_intents:
714 intent_state = ONOS1_intents
715 intent_check = main.TRUE
716 main.log.report("Intents are consistent across all ONOS nodes")
717 else:
718 main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
719 sort_keys=True, indent=4, separators=(',', ': ')))
720 main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
721 sort_keys=True, indent=4, separators=(',', ': ')))
722 main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
723 sort_keys=True, indent=4, separators=(',', ': ')))
724 main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
725 sort_keys=True, indent=4, separators=(',', ': ')))
726 main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
727 sort_keys=True, indent=4, separators=(',', ': ')))
728 main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
729 sort_keys=True, indent=4, separators=(',', ': ')))
730 main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
731 sort_keys=True, indent=4, separators=(',', ': ')))
732 utilities.assert_equals(expect = main.TRUE,actual=intent_check,
733 onpass="Intents are consistent across all ONOS nodes",
734 onfail="ONOS nodes have different views of intents")
735
736 main.step("Compare current intents with intents before the failure")
737 if intent_state == ONOS1_intents:
738 same_intents = main.TRUE
739 main.log.report("Intents are consistent with before failure")
740 #TODO: possibly the states have changed? we may need to figure out what the aceptable states are
741 else:
742 same_intents = main.FALSE
743 utilities.assert_equals(expect = main.TRUE,actual=same_intents,
744 onpass="Intents are consistent with before failure",
745 onfail="The Intents changed during failure")
746 intent_check = intent_check and same_intents
747
748
749
750 main.step("Get the OF Table entries and compare to before component failure")
751 Flow_Tables = main.TRUE
752 flows2=[]
753 for i in range(28):
754 main.log.info("Checking flow table on s" + str(i+1))
755 tmp_flows = main.Mininet2.get_flowTable("s"+str(i+1),1.0)
756 flows2.append(tmp_flows)
757 Flow_Tables = Flow_Tables and main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
758 if Flow_Tables == main.FALSE:
759 main.log.info("Differences in flow table for switch: "+str(i+1))
760 break
761 if Flow_Tables == main.TRUE:
762 main.log.report("No changes were found in the flow tables")
763 utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
764 onpass="No changes were found in the flow tables",
765 onfail="Changes were found in the flow tables")
766
767 main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
768 #FIXME: This check is always failing. Investigate cause
769 #NOTE: this may be something to do with file permsissions
770 # or slight change in format
771 main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
772 Loss_In_Pings = main.FALSE
773 #NOTE: checkForLoss returns main.FALSE with 0% packet loss
774 for i in range(8,18):
775 main.log.info("Checking for a loss in pings along flow from s" + str(i))
776 Loss_In_Pings = Loss_In_Pings or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i))
777 if Loss_In_Pings == main.TRUE:
778 main.log.info("Loss in ping detected")
779 elif Loss_In_Pings == main.ERROR:
780 main.log.info("There are multiple mininet process running")
781 elif Loss_In_Pings == main.FALSE:
782 main.log.info("No Loss in the pings")
783 main.log.report("No loss of dataplane connectivity")
784 utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings,
785 onpass="No Loss of connectivity",
786 onfail="Loss of dataplane connectivity detected")
787
788
789 #TODO:add topology to this or leave as a seperate case?
790 result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings)
791 result = int(result)
792 if result == main.TRUE:
793 main.log.report("Constant State Tests Passed")
794 utilities.assert_equals(expect=main.TRUE,actual=result,
795 onpass="Constant State Tests Passed",
796 onfail="Constant state tests failed")
797
798 def CASE8 (self,main):
799 '''
800 Compare topo
801 '''
802 import sys
803 sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
804 from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
805 import json
806
807 description ="Compare ONOS Topology view to Mininet topology"
808 main.case(description)
809 main.log.report(description)
810 main.step("Create TestONTopology object")
811 ctrls = []
812 count = 1
813 while True:
814 temp = ()
815 if ('ip' + str(count)) in main.params['CTRL']:
816 temp = temp + (getattr(main,('ONOS' + str(count))),)
817 temp = temp + ("ONOS"+str(count),)
818 temp = temp + (main.params['CTRL']['ip'+str(count)],)
819 temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
820 ctrls.append(temp)
821 count = count + 1
822 else:
823 break
824 MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
825
826 main.step("Collecting topology information from ONOS")
827 devices = []
828 devices.append( main.ONOScli1.devices() )
829 devices.append( main.ONOScli2.devices() )
830 devices.append( main.ONOScli3.devices() )
831 devices.append( main.ONOScli4.devices() )
832 devices.append( main.ONOScli5.devices() )
833 devices.append( main.ONOScli6.devices() )
834 devices.append( main.ONOScli7.devices() )
835 '''
836 hosts = []
837 hosts.append( main.ONOScli1.hosts() )
838 hosts.append( main.ONOScli2.hosts() )
839 hosts.append( main.ONOScli3.hosts() )
840 hosts.append( main.ONOScli4.hosts() )
841 hosts.append( main.ONOScli5.hosts() )
842 hosts.append( main.ONOScli6.hosts() )
843 hosts.append( main.ONOScli7.hosts() )
844 '''
845 ports = []
846 ports.append( main.ONOScli1.ports() )
847 ports.append( main.ONOScli2.ports() )
848 ports.append( main.ONOScli3.ports() )
849 ports.append( main.ONOScli4.ports() )
850 ports.append( main.ONOScli5.ports() )
851 ports.append( main.ONOScli6.ports() )
852 ports.append( main.ONOScli7.ports() )
853 links = []
854 links.append( main.ONOScli1.links() )
855 links.append( main.ONOScli2.links() )
856 links.append( main.ONOScli3.links() )
857 links.append( main.ONOScli4.links() )
858 links.append( main.ONOScli5.links() )
859 links.append( main.ONOScli6.links() )
860 links.append( main.ONOScli7.links() )
861
862
863 main.step("Comparing ONOS topology to MN")
864 devices_results = main.TRUE
865 ports_results = main.TRUE
866 links_results = main.TRUE
867 for controller in range(7): #TODO parameterize the number of controllers
868 current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
869 utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
870 onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
871 onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
872
873 current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
874 utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
875 onpass="ONOS"+str(int(controller+1))+" ports view is correct",
876 onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
877
878 current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
879 utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
880 onpass="ONOS"+str(int(controller+1))+" links view is correct",
881 onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
882
883 devices_results = devices_results and current_devices_result
884 ports_results = ports_results and current_ports_result
885 links_results = links_results and current_links_result
886
887 topo_result = devices_results and ports_results and links_results
888 utilities.assert_equals(expect=main.TRUE, actual=topo_result,
889 onpass="Topology Check Test successful",
890 onfail="Topology Check Test NOT successful")
891 if topo_result == main.TRUE:
892 main.log.report("ONOS topology view matches Mininet topology")
893
894
895 def CASE9 (self,main):
896 '''
897 Link s3-s28 down
898 '''
899 #NOTE: You should probably run a topology check after this
900
901 link_sleep = int(main.params['timers']['LinkDiscovery'])
902
903 description = "Turn off a link to ensure that Link Discovery is working properly"
904 main.log.report(description)
905 main.case(description)
906
907
908 main.step("Kill Link between s3 and s28")
909 Link_Down = main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
910 main.log.info("Waiting " + str(link_sleep) + " seconds for link down to be discovered")
911 time.sleep(link_sleep)
912 utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
913 onpass="Link down succesful",
914 onfail="Failed to bring link down")
915 #TODO do some sort of check here
916
917 def CASE10 (self,main):
918 '''
919 Link s3-s28 up
920 '''
921 #NOTE: You should probably run a topology check after this
922
923 link_sleep = int(main.params['timers']['LinkDiscovery'])
924
925 description = "Restore a link to ensure that Link Discovery is working properly"
926 main.log.report(description)
927 main.case(description)
928
929 main.step("Bring link between s3 and s28 back up")
930 Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
931 main.log.info("Waiting " + str(link_sleep) + " seconds for link up to be discovered")
932 time.sleep(link_sleep)
933 utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
934 onpass="Link up succesful",
935 onfail="Failed to bring link up")
936 #TODO do some sort of check here
937
938
939 def CASE11 (self, main) :
940 '''
941 Switch Down
942 '''
943 #NOTE: You should probably run a topology check after this
944 import time
945
946 switch_sleep = int(main.params['timers']['SwitchDiscovery'])
947
948 description = "Killing a switch to ensure it is discovered correctly"
949 main.log.report(description)
950 main.case(description)
951
952 #TODO: Make this switch parameterizable
953 main.step("Kill s28 ")
954 main.log.report("Deleting s28")
955 #FIXME: use new dynamic topo functions
956 main.Mininet1.del_switch("s28")
957 main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
958 time.sleep(switch_sleep)
959 #Peek at the deleted switch
960 main.log.warn(main.ONOScli1.get_device(dpid="0028"))
961 #TODO do some sort of check here
962
963 def CASE12 (self, main) :
964 '''
965 Switch Up
966 '''
967 #NOTE: You should probably run a topology check after this
968 import time
969 #FIXME: use new dynamic topo functions
970 description = "Adding a switch to ensure it is discovered correctly"
971 main.log.report(description)
972 main.case(description)
973
974 main.step("Add back s28")
975 main.log.report("Adding back s28")
976 main.Mininet1.add_switch("s28", dpid = '0000000000002800')
977 #TODO: New dpid or same? Ask Thomas?
978 main.Mininet1.add_link('s28', 's3')
979 main.Mininet1.add_link('s28', 's6')
980 main.Mininet1.add_link('s28', 'h28')
981 main.Mininet1.assign_sw_controller(sw="28",count=7,
982 ip1=ONOS1_ip,port1=ONOS1_port,
983 ip2=ONOS2_ip,port2=ONOS2_port,
984 ip3=ONOS3_ip,port3=ONOS3_port,
985 ip4=ONOS4_ip,port4=ONOS4_port,
986 ip5=ONOS5_ip,port5=ONOS5_port,
987 ip6=ONOS6_ip,port6=ONOS6_port,
988 ip7=ONOS7_ip,port7=ONOS7_port)
989 main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
990 time.sleep(switch_sleep)
991 #Peek at the added switch
992 main.log.warn(main.ONOScli1.get_device(dpid="0028"))
993 #TODO do some sort of check here
994
995 def CASE13 (self, main) :
996 '''
997 Clean up
998 '''
Jon Hall368769f2014-11-19 15:43:35 -0800999 description = "Test Cleanup"
1000 main.log.report(description)
1001 main.case(description)
Jon Hallb1290e82014-11-18 16:17:48 -05001002 main.step("Killing tcpdumps")
1003 main.Mininet2.stop_tcpdump()
1004
1005 #TODO: Enable once test is ready
1006 '''
1007 main.step("Copying pcap files to test station")
1008 testname = main.TEST
1009 #FIXME: Do the mininet pcap get archived?
1010 #FIXME: also, make sure karaf logs are saved
1011
1012 #sleep so scp can finish
1013 time.sleep(10)
1014 main.step("Packing and rotating pcap archives")
1015 import os
1016 os.system("~/TestON/dependencies/rotate.sh "+ str(testname))
1017 '''
1018
1019 import time
1020
1021 #Stopping ONOS
1022 main.step("Stopping ONOS")
1023 main.ONOScli1.disconnect()
1024 main.ONOScli2.disconnect()
1025 main.ONOScli3.disconnect()
1026 main.ONOScli4.disconnect()
1027 main.ONOScli5.disconnect()
1028 main.ONOScli6.disconnect()
1029 main.ONOScli7.disconnect()
1030 main.ONOSbench.onos_stop(ONOS1_ip)
1031 main.ONOSbench.onos_stop(ONOS2_ip)
1032 main.ONOSbench.onos_stop(ONOS3_ip)
1033 main.ONOSbench.onos_stop(ONOS4_ip)
1034 main.ONOSbench.onos_stop(ONOS5_ip)
1035 main.ONOSbench.onos_stop(ONOS6_ip)
1036 main.ONOSbench.onos_stop(ONOS7_ip)
Jon Hall368769f2014-11-19 15:43:35 -08001037
1038 #TODO: actually check something here
1039 utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
1040 onpass="Test cleanup successful",
1041 onfail="Test cleanup NOT successful")