blob: 48dc3db44df8f08d40c166507d6d41707e09b377 [file] [log] [blame]
admin844bcb52014-04-15 11:13:14 -07001
2
3class JamesTest :
4
5 def __init__(self) :
6 self.default = ''
7
8
9
10
11#***************************************************************************************************************
12
13
14 def CASE1(self,main) :
15 main.case("\nStart-Up of Zookeeper, RAMCloud, ONOS, and Mininet")
16 import time
17 main.step("\n**********************Git pulls and Rebuilds******************")
18 for i in range(2):
19 main.log.report("ONOS1 Git Pull")
20 uptodate = main.ONOS1.git_pull()
21 ver1 = main.ONOS1.get_version()
22 main.log.report("ONOS2 Git Pull")
23 main.ONOS2.git_pull()
24 main.log.report("ONOS3 Git Pull")
25 main.ONOS3.git_pull()
26 main.log.report("ONOS4 Git Pull")
27 main.ONOS4.git_pull()
28 ver2 = main.ONOS4.get_version()
29 if ver1==ver2:
30 break
31 elif i==1:
32 main.log.report("Versions differ. Doing Git pulls from ONOS1")
33 main.ONOS2.git_pull("ONOS1 master")
34 main.ONOS3.git_pull("ONOS1 master")
35 main.ONOS4.git_pull("ONOS1 master")
36 if uptodate==0:
37 main.log.report("Building ONOS1")
38 main.ONOS1.git_compile()
39 main.log.report("Building ONOS2")
40 main.ONOS2.git_compile()
41 main.log.report("Building ONOS3")
42 main.ONOS3.git_compile()
43 main.log.report("Building ONOS4")
44 main.ONOS4.git_compile()
45
46
47 main.step("\n********************Testing Zookeeper Startup**************")
48 data1 = main.Zookeeper1.isup()
49 utilities.assert_equals(expect=main.TRUE,actual=data1,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
50 if data1==main.FALSE:
51 main.log.report("Zookeeper is Down, Exiting the Test!")
52 main.cleanup()
53 main.exit()
54
55 main.step("\n********************Starting Up RAMCloud*********************")
56 main.RamCloud1.start_coor()
57 time.sleep(2)
58 main.RamCloud1.start_serv()
59 main.RamCloud2.start_serv()
60 main.RamCloud3.start_serv()
61 main.RamCloud4.start_serv()
62 time.sleep(5)
63
64 main.step("\n********************Testing RAMCloud Startup**************")
65 data2 = main.RamCloud1.status_serv()
66 print(data2)
67 for i in range(3):
68 if data2 == main.FALSE:
69 main.RamCloud1.stop_serv()
70 main.RamCloud2.stop_serv()
71 main.RamCloud3.stop_serv()
72 main.RamCloud4.stop_serv()
73 main.RamCloud1.stop_coor()
74 main.RamCloud1.start_coor()
75 time.sleep(2)
76 main.RamCloud1.start_serv()
77 main.RamCloud2.start_serv()
78 main.RamCloud3.start_serv()
79 main.RamCloud4.start_serv()
80 time.sleep(5)
81 data2 = main.RamCloud1.status_serv()
82 else:
83 break
84 utilities.assert_equals(expect=main.TRUE,actual=data2,onpass="RAMCloud is up!",onfail="RAMCloud is down...")
85 if data2==main.FALSE:
86 main.log.report("RAMCloud is Down, Exiting the Test!")
87 main.cleanup()
88 main.exit()
89
90 main.step("\n************************Starting Up ONOS and Rest*****************")
91 main.ONOS1.start()
92 time.sleep(10)
93 main.ONOS2.start()
94 main.ONOS3.start()
95 main.ONOS4.start()
96 main.ONOS1.start_rest()
97 time.sleep(5)
98 test = main.ONOS1.rest_status()
99 for i in range(3):
100 if test == main.FALSE:
101 main.ONOS1.start_rest()
102 time.sleep(5)
103 test = main.ONOS1.rest_status()
104 else:
105 break
106
107 main.step("\n************************Testing ONOS Startup***************")
108 data3 = main.ONOS1.isup()
109 for i in range(3):
110 if data3 == main.FALSE:
111 main.log.report("ONOS did not start, restarting ONOS")
112 main.ONOS1.stop()
113 main.ONOS2.stop()
114 main.ONOS3.stop()
115 main.ONOS4.stop()
116 time.sleep(2)
117 main.ONOS1.start()
118 time.sleep(10)
119 main.ONOS2.start()
120 main.ONOS3.start()
121 main.ONOS4.start()
122 data3 = main.ONOS1.isup()
123 else:
124 break
125 utilities.assert_equals(expect=main.TRUE,actual=data3,onpass="ONOS is up!",onfail="ONOS is down...")
126 if data3==main.FALSE:
127 main.log.report("ONOS did not START!! Exiting the Test")
128 main.cleanup()
129 main.exit()
130
131 main.step("\n****************************Testing Mininet Startup***************")
132 data4 = main.Mininet1.checkIP(main.params['CASE1']['destination'])
133 utilities.assert_equals(expect=main.TRUE,actual=data4,onpass="Host IP address configured",onfail="Host IP address not configured")
134
135 finalAssert = data1 and data2 and data3
136 utilities.assert_equals(expect=main.TRUE,actual=finalAssert,onpass="Good to Go!",onfail="NO GO FOR LAUNCH")
137
138#*****************************************************************************************
139
140 def CASE2(self,main) :
141 import time
142 main.case("\nAssign ONOS Controllers to Switches and run Initial Ping Test")
143 main.step("\n**********************Assign initial master controller to switches**********************")
144 for i in range(25):
145 if i < 3:
146 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
147 time.sleep(1)
148 elif i>=3 and i <5:
149 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
150 time.sleep(1)
151 elif i>=5 and i<15:
152 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
153 time.sleep(1)
154 else:
155 main.Mininet1.assign_sw_controller(sw=str(i+16),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
156 time.sleep(1)
157
158 main.step("\n**********************Assign all ONOS instances to all Switches*************************")
159 for i in range(25):
160 if i < 15:
161 main.Mininet1.assign_sw_controller(sw=str(i+1),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
162 time.sleep(1)
163 else:
164 main.Mininet1.assign_sw_controller(sw=str(i+16),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4'])
165
166
167 def CASE3(self,main):
168 main.case("\nPerforming Initial Ping Test")
169 main.step("\n**********************Initial Ping Test***************")
170 count = 1
171 i = 6
172 while i < 16:
173 main.log.info("\n\t\t\th" + str(i) + " IS PINGING h" + str(i+25) )
174 strtTime = time.time()
175 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
176 if ping == main.FALSE and count<6:
177 count+=1
178 i = 6
179 main.log.info("Ping failed, making attempt number " + str(count)+" in 2 seconds")
180 time.sleep(2)
181 elif ping == main.FALSE and count==6:
182 main.log.error("Ping test failed")
183 i = 17
184 result = main.FALSE
185 elif ping == main.TRUE:
186 i += 1
187 result = main.TRUE
188 endTime = time.time()
189 if result == main.TRUE:
190 main.log.report("\tTime to complete ping test: " + str(round(endTime-strtTime,2))+ " seconds")
191 else:
192 main.log.report("\tPING TEST FAILED!")
193 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOSS!!!! HOST IS NOT REACHABLE!!!!!!")
194
195
196
197 def CASE4(self,main):
198 main.case("\nWhat happens when 3 of the ONOS instances die?")
199 main.step("\n********************Removing 3 ONOS instances****************************")
200 main.ONOS2.stop()
201 main.ONOS3.stop()
202 main.ONOS4.stop()
203 main.step("\n*******************Checking for the correct topology*********************")
204 data1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
205 print("%s" % data1)
206 for i in range(10):
207 if data1 == main.FALSE:
208 time.sleep(5)
209 data1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
210 else:
211 break
212 main.step("\n********************Running PING Test****************************")
213 count = 1
214 i = 6
215 while i < 16:
216 main.log.info("\n\t\t\tH" + str(i) + " is PINGING H" + str(i+25))
217 strtTime = time.time()
218 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
219 if ping == main.FALSE and count<6:
220 count+=1
221 i = 6
222 main.log.info("Ping failed, making attempt number " + str(count)+" in 2 seconds")
223 time.sleep(2)
224 elif ping == main.FALSE and count==6:
225 main.log.error("Ping test failed")
226 i = 17
227 result2 = main.FALSE
228 elif ping == main.TRUE:
229 i += 1
230 result2 = main.TRUE
231 endTime = time.time()
232 if result2 == main.TRUE:
233 main.log.report("\tTime to complete ping test: " + str(round(endTime-strtTime,2))+ " seconds")
234 else:
235 main.log.report("\tPING TEST FAILED!")
236 finalResult = data1 and result2
237 utilities.assert_equals(expect=main.TRUE,actual=finalResult,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOSS!!!! HOST IS NOT REACHABLE!!!!!!")
238 time.sleep(5)
239
240
241 def CASE5(self,main):
242 main.case("\nRestart the 3 ONOS instances and run a PING test")
243 main.step("\n************************Bringing Back up ONOS Instances*****************************")
244 main.ONOS2.start()
245 main.ONOS3.start()
246 main.ONOS4.start()
247 time.sleep(4)
248 main.step("\n********************Running PING Test****************************")
249 count = 1
250 i = 6
251 while i < 16:
252 main.log.info("\n\t\t\tH" + str(i) + " is PINGING H" + str(i+25))
253 strtTime = time.time()
254 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
255 if ping == main.FALSE and count<6:
256 count+=1
257 i = 6
258 main.log.info("Ping failed, making attempt number " + str(count)+" in 2 seconds")
259 time.sleep(2)
260 elif ping == main.FALSE and count==6:
261 main.log.error("Ping test failed")
262 i = 17
263 result2 = main.FALSE
264 elif ping == main.TRUE:
265 i += 1
266 result2 = main.TRUE
267 endTime = time.time()
268 if result2 == main.TRUE:
269 main.log.report("\tTime to complete ping test: " + str(round(endTime-strtTime,2))+ " seconds")
270 else:
271 main.log.report("\tPING TEST FAILED!")
272 finalResult = result2
273 utilities.assert_equals(expect=main.TRUE,actual=finalResult,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOSS!!!! HOST IS NOT REACHABLE!!!!!!")
274 time.sleep(5)
275
276
277 def CASE6(self,main):
278 main.case("Bring links between S1 and S2 down, then ping untill all hosts are reachable or fail after 10 attempts")
279 import time
280 main.step("\n*****************Bringing Link DOWN!!!************************")
281 data1 = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
282 utilities.assert_equals(expect=main.TRUE,actual=data1,onpass="Link Brought DOWN!",onfail="Link still up...")
283 main.step("\n******************Waiting for Topology Convergence****************")
284 strtTime = time.time()
285 data2 = main.FALSE
286 data2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
287 print("hello world")
288 for i in range(2):
289 if data2 == main.FALSE:
290 time.sleep(5)
291 data2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
292 else:
293 break
294 utilities.assert_equals(expect=main.TRUE,actual=data2,onpass="Topology Converged",onfail="Topology FAILED to Converge")
295 main.case("\n*******************Ping Test***********************")
296 count = 1
297 i = 6
298 while i < 16:
299 main.log.info("\n\t\t\tH" + str(i) + " is PINGING H" + str(i+25))
300 strtTime = time.time()
301 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
302 if ping == main.FALSE and count<6:
303 count+=1
304 i = 6
305 main.log.info("Ping failed, making attempt number " + str(count)+" in 2 seconds")
306 time.sleep(2)
307 elif ping == main.FALSE and count==6:
308 main.log.error("Ping test failed")
309 i = 17
310 data3 = main.FALSE
311 elif ping == main.TRUE:
312 i += 1
313 data3 = main.TRUE
314 endTime = time.time()
315 if data3 == main.TRUE:
316 main.log.report("\tTime to complete ping test: " + str(round(endTime-strtTime,2))+ " seconds")
317 else:
318 main.log.report("\tPING TEST FAILED!")
319 utilities.assert_equals(expect=main.TRUE,actual=data3,onpass="Ping test PASSED!",onfail="Ping Test FAILED!!!!")
320 finalResult = data1 and data2 and data3
321 utilities.assert_equals(expect=main.TRUE,actual=finalResult,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOSS!!!! HOST IS NOT REACHABLE!!!!!!")
322 time.sleep(5)
323
324 def CASE31(self,main) :
325 import time
326 main.case("\nClear out flows, then add flows from FLOWDEF file")
327 main.step("\n\n***************Cleaning out OLD flows!*************")
328 main.ONOS1.delete_flow("all")
329 main.step("\n\n***************Adding Flows from FLOWDEF File**********")
330 strtTime = time.time()
331 main.ONOS1.add_flow(main.params['FLOWDEF'])
332 main.step("\n\n**************Checking Flows***********************")
333 count = 1
334 i = 6
335 while i <16:
336 main.log.info("\n\t\t\t\th" + str(i) + " IS PINGING h" + str(i+25))
337 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
338 if ping == main.FALSE and count < 9:
339 count +=1
340 i = 6
341 main.log.info("Ping failed, making attempt number " + str(count) + " in 2 seconds")
342 time.sleep(2)
343 elif ping == main.FALSE and count == 9:
344 main.log.error("Ping test failed")
345 i = 17
346 result = main.FALSE
347 elif ping == main.TRUE:
348 i = i+1
349 result = main.TRUE
350 endTime = time.time()
351 if result == main.TRUE:
352 main.log.report("\tTime to add flows: " + str(round(endTime-strtTime,2))+" seconds")
353 else:
354 main.log.report("\tFlows failed check")
355 result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
356 finalResult = result and result2
357 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flows added and Checked!",onfail="Flows did not add properly")
358
359
360
361 def CASE21(self,main) :
362 import json
363 main.case("Test device discovery function by attaching, metaching, moving host1 from s1 -> s6 -> s1. Per mininet naming, when switching ports, the host attaches will still remain as 's1-eth1' throughout the entire test")
364 main.step("\n\n******Checking that the initial host MAC/IP exists on the mininet******")
365 host = main.params['YANK']['hostname']
366 mac = main.params['YANK']['hostmac']
367 hostip = main.params['YANK']['hostip']
368 RestIP1 = main.params['RESTCALL']['restIP1']
369 RestPort = main.params['RESTCALL']['restPort']
370 url = main.params['RESTCALL']['restURL']
371 t_topowait = 0
372 t_restwait = 10
373 main.log.report("Wait time from topo change to ping set to " + str(t_topowait))
374 main.log.report("Wait time from ping to rest call set to " + str(t_restwait))
375 time.sleep(t_topowait)
376 main.log.info("\n\t\t\t\t Ping: Issue 1 ping from " + str(host) + " to generate arp to switch. Ping result is not important")
377 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
378 time.sleep(t_restwait)
379 Reststatus, Swtich, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url,hostip)
380 main.log.report("Number of hosts with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
381 if Reststatus ==1:
382 main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC)+"; attached to switchDPPID = " + "".join(Switch)+ "; at port = " + "".join(Port))
383 result1 = main.TRUE
384 elif Reststatus >1:
385 main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
386 main.log.report("switches are: " + "; ".join(Switch))
387 main.log.report("Ports are: " + "; ".join(Port))
388 main.log.report("MACS are: " + "; ".join(MAC))
389 result1 = main.FALSE
390 else:
391 main.log.report("\]t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
392 result1 = main.FALSE
393
394#*****************Step to yank out s1-eth1 from s1
395
396 main.step("Yank out s1-eth1")
397 main.log.report("Yankout s6-eth1 (link to h1) from s1")
398 result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
399 time.sleep(t_topowait)
400 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
401
402 main.step("\n\n Ping: Issue 1 ping from " + str(host) + " to generate arp to switch. Ping result is not important")
403 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
404 time.sleep(t_restwait)
405 Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url,hostip)
406 main.log.report("Number of hosts with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
407 if Reststatus ==1:
408 main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "".join(Port))
409 result2 = main.FALSE
410 elif Reststatus >1:
411 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
412 main.log.report("Switches are: " + "; ".join(Switch))
413 main.log.report("Ports are: " + "; ".join(Port))
414 main.log.report("MACs are: " + "; ".join(MAC))
415 result2 = main.FALSE
416 else:
417 main.log.report("\t PASSED - Host" + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
418 result2 = main.TRUE
419 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="s1-eth1 yanked!",onfail="s1-eth1 failed to be yanked!")
420
421# Step to plug "s1-eth1" to s6
422 main.step("Plug s1-eth1 into s6")
423 result3 = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
424 time.sleep(t_topowait)
425 utilities.assert_equals(expect=main.TRUE,actual=result3,onpass="Plug command suceeded",onfail="Plug command failed ... ")
426 main.step("\n\nPing issue one ping from " + str(host) + "to generate arp to switch. Ping result is not important")
427 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
428 time.sleep(t_restwait)
429 Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url,hostip)
430
431 main.log.report("Number of hosts with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
432 if Reststatus ==1:
433 main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
434 result4 = main.TRUE
435 elif Reststatus >1:
436 main.log.report("\t FAILED - Host " + host + " with MAC: " + str(mac) + " has " + str(Reststatus) + "duplicated IP addresses. FAILED")
437 main.log.report("switches are: " + "; ".join(Switch))
438 main.log.report("Ports are: " + "; ".join(Port))
439 main.log.report("MACs are: " + "; ".join(MAC))
440 result4 = main.FALSE
441 else:
442 main.log.report("\t FAILED - Host " + host + " with MAC: " + str(mac) + " does not exist. FAILED")
443 result4 = main.FALSE
444
445# Step to put "s1-eth1" back to s1
446 main.step("Move s1-eth1 back to s1")
447 result5 = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
448 time.sleep(t_topowait)
449 result6 = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
450 utilities.assert_equals(expect=main.TRUE,actual=(result5 and result6),onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
451 main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" )
452 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
453 time.sleep(t_restwait)
454 Reststatus, Switch, Port, MAC = main.ONOS1.find_host(RestIP1,RestPort,url, hostip)
455
456 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
457 if Reststatus == 1:
458 main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
459 result7 = main.TRUE
460 elif Reststatus > 1:
461 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
462 main.log.report("switches are: " + "; ".join(Switch))
463 main.log.report("Ports are: " + "; ".join(Port))
464 main.log.report("MACs are: " + "; ".join(MAC))
465 result7 = main.FALSE
466 else:
467 main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
468 result7 = main.FALSE
469
470 result = result1 and result2 and result3 and result4 and result5 and result6 and result7
471 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
472
473 def CASE7(self, main) :
474 import time
475 main.case("Bring Link between s1 and s2 up, then ping untill all hosts are reachable or fail after 10 attemtps!")
476 main.step("Bringing Link up... " )
477 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
478 utilities.assert_equlas(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
479 main.step("\n\n\t\tPing Test!")
480 strtTime = time.time()
481 result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
482 for i in range(2):
483 if result2 == main.FALSE:
484 time.sleep(5)
485 result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
486 else:
487 break
488 strtTime = time.time()
489 count = 1
490 i = 6
491 while i <16 :
492 main.log.info("\n\t\t\t\th" + str(i) + " IS PINGING h" + str(i+25))
493 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
494 if ping ==main.FALSE and count<10:
495 count +=1
496 main.log.info("Ping failed, making attempt number " + str(count) + " in 2 seconds")
497 i = 6
498 time.sleep(2)
499 elif ping ==main.FALSE and count==10:
500 main.log.error("Ping test failed")
501 i = 17
502 result3 = main.FALSE
503 elif ping ==main.TRUE:
504 i += 1
505 result3 = main.TRUE
506 endTime = time.time()
507 if result3 ==main.TRUE:
508 main.log.report("\t Time to complete ping test: " + str(round(endTime-strtTime,2)) + " seconds")
509 else:
510 main.log.report("\tPing Tests FAILED!!")
511 finalResult = result and result2 and result3 and result4
512 utilities.assert_equals(expect=main.TRUE,actual=finalResult,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
513
514
515