blob: d173bf0817482a325d6fd54750e6ce35cabc7f1a [file] [log] [blame]
admin844bcb52014-04-15 11:13:14 -07001
2class OnosSanity4nodes :
3
4 def __init__(self) :
5 self.default = ''
6
7#**********************************************************************************************************************************************************************************************
8#Test startup
9#Tests the startup of Zookeeper1, Cassandra1, and ONOS1 to be certain that all started up successfully
10 def CASE1(self,main) : #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version
11 import time
12 main.log.report("Pulling latest code from github to all nodes")
13 main.ONOS1.git_pull()
14 main.ONOS2.git_pull()
15 main.ONOS3.git_pull()
16 main.ONOS4.git_pull()
17 main.Cassandra1.start()
18 main.Cassandra2.start()
19 main.Cassandra3.start()
20 main.Cassandra4.start()
21 time.sleep(20)
22 main.ONOS1.drop_keyspace()
23 main.ONOS1.start()
24 time.sleep(10)
25 main.ONOS2.start()
26 main.ONOS3.start()
27 main.ONOS4.start()
28 main.ONOS1.start_rest()
29 time.sleep(5)
30 test= main.ONOS1.rest_status()
31 if test == main.FALSE:
32 main.ONOS1.start_rest()
33 main.ONOS1.get_version()
34 main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
35 main.case("Checking if the startup was clean...")
36 main.step("Testing startup Zookeeper")
37 data = main.Zookeeper1.isup()
38 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
39 main.step("Testing startup Cassandra")
40 data = main.Cassandra1.isup()
41 if data == main.FALSE:
42 main.Cassandra1.stop()
43 main.Cassandra2.stop()
44 main.Cassandra3.stop()
45 main.Cassandra4.stop()
46
47 time.sleep(5)
48
49 main.Cassandra1.start()
50 main.Cassandra2.start()
51 main.Cassandra3.start()
52 main.Cassandra4.start()
53 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
54 main.step("Testing startup ONOS")
55 data = main.ONOS1.isup()
56 if data == main.FALSE:
57 main.log.report("Something is funny... restarting ONOS")
58 main.ONOS1.stop()
59 time.sleep(3)
60 main.ONOS1.start()
61 time.sleep(5)
62 data = main.ONOS1.isup()
63 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
64
65#**********************************************************************************************************************************************************************************************
66#Assign Controllers
67#This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>).
68#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
69#NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if
70# the controllers already assigned to the switch are not specified.
71
72 def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches
73 import time
74 main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
75 main.case("Checking if one MN host exists")
76 main.step("Host IP Checking using checkIP")
77 result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
78 main.step("Verifying the result")
79 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
80 main.step("assigning ONOS controllers to switches")
81 for i in range(25):
82 if i < 3:
83 j=i+1
84 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
85 time.sleep(1)
86 main.Mininet1.assign_sw_controller(sw=str(j),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'])
87 elif i >= 3 and i < 5:
88 j=i+1
89 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
90 time.sleep(1)
91 main.Mininet1.assign_sw_controller(sw=str(j),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'])
92 elif i >= 5 and i < 15:
93 j=i+1
94 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
95 time.sleep(1)
96 main.Mininet1.assign_sw_controller(sw=str(j),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'])
97 else:
98 j=i+16
99 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
100 time.sleep(1)
101 main.Mininet1.assign_sw_controller(sw=str(j),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'])
102 main.Mininet1.get_sw_controller("s1")
103
104# **********************************************************************************************************************************************************************************************
105#Add Flows
106#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
107#NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on
108
109 def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
110 main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
111 import time
112 main.case("Taking care of these flows!")
113 main.step("Cleaning out any leftover flows...")
114 main.ONOS1.delete_flow("all")
115 strtTime = time.time()
116 main.ONOS1.add_flow(main.params['FLOWDEF'])
117 main.case("Checking flows")
118
119 count = 1
120 i = 6
121 while i < 16 :
122 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
123 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
124 if ping == main.FALSE and count < 9:
125 count = count + 1
126 i = 6
127 main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
128 time.sleep(2)
129 elif ping == main.FALSE and count ==9:
130 main.log.error("Ping test failed")
131 i = 17
132 result = main.FALSE
133 elif ping == main.TRUE:
134 i = i + 1
135 result = main.TRUE
136 endTime = time.time()
137 if result == main.TRUE:
138 main.log.report("\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
139 else:
140 main.log.report("\tFlows failed check")
141
142 result2 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
143 main.step("Verifying the result")
144 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
145
146#**********************************************************************************************************************************************************************************************
147#This test case removes Controllers 2,3, and 4 then performs a ping test.
148#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
149#The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again.
150#If the ping test fails 6 times, then the test case will return false
151
152 def CASE4(self,main) :
153 main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
154 import time
155 for i in range(25):
156 if i < 15:
157 j=i+1
158 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) #Assigning a single controller removes all other controllers
159 else:
160 j=i+16
161 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
162
163 strtTime = time.time()
164 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
165 for i in range(2):
166 if result == main.FALSE:
167 time.sleep(5)
168 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
169 else:
170 break
171
172 count = 1
173 i = 6
174 while i < 16 :
175 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
176 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
177 if ping == main.FALSE and count < 6:
178 count = count + 1
179 i = 6
180 main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
181 time.sleep(2)
182 elif ping == main.FALSE and count ==6:
183 main.log.error("Ping test failed")
184 i = 17
185 result = main.FALSE
186 elif ping == main.TRUE:
187 i = i + 1
188 result = main.TRUE
189 endTime = time.time()
190 if result == main.TRUE:
191 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
192 else:
193 main.log.report("\tPING TEST FAIL")
194 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
195
196# **********************************************************************************************************************************************************************************************
197#This test case restores the controllers removed by Case 4 then performs a ping test.
198
199 def CASE5(self,main) :
200 main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
201 import time
202 for i in range(25):
203 if i < 15:
204 j=i+1
205 main.Mininet1.assign_sw_controller(sw=str(j),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'])
206 else:
207 j=i+16
208 main.Mininet1.assign_sw_controller(sw=str(j),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'])
209
210 strtTime = time.time()
211 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
212 for i in range(2):
213 if result == main.FALSE:
214 time.sleep(5)
215 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
216 else:
217 break
218
219 count = 1
220 i = 6
221 while i < 16 :
222 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
223 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
224 if ping == main.FALSE and count < 6:
225 count = count + 1
226 i = 6
227 main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
228 time.sleep(2)
229 elif ping == main.FALSE and count ==6:
230 main.log.error("Ping test failed")
231 i = 17
232 result = main.FALSE
233 elif ping == main.TRUE:
234 i = i + 1
235 result = main.TRUE
236 endTime = time.time()
237 if result == main.TRUE:
238 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
239 else:
240 main.log.report("\tPING TEST FAILED")
241 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
242
243# **********************************************************************************************************************************************************************************************
244#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
245
246 def CASE6(self,main) :
247 main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
248 import time
249 main.case("Bringing Link down... ")
250 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
251 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
252
253 strtTime = time.time()
254 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
255 for i in range(2):
256 if result == main.FALSE:
257 time.sleep(5)
258 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
259 else:
260 break
261
262 count = 1
263 i = 6
264 while i < 16 :
265 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
266 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
267 if ping == main.FALSE and count < 10:
268 count = count + 1
269 main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
270 i = 6
271 time.sleep(2)
272 elif ping == main.FALSE and count == 10:
273 main.log.error("Ping test failed")
274 i = 17
275 result = main.FALSE
276 elif ping == main.TRUE:
277 i = i + 1
278 result = main.TRUE
279 endTime = time.time()
280 if result == main.TRUE:
281 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
282 else:
283 main.log.report("\tPING TEST FAILED")
284 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
285
286# **********************************************************************************************************************************************************************************************
287#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
288
289 def CASE7(self,main) :
290 main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
291 import time
292 main.case("Bringing Link up... ")
293 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
294 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
295
296 strtTime = time.time()
297 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
298 for i in range(2):
299 if result == main.FALSE:
300 time.sleep(5)
301 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
302 else:
303 break
304
305 strtTime = time.time()
306 count = 1
307 i = 6
308 while i < 16 :
309 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
310 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
311 if ping == main.FALSE and count < 10:
312 count = count + 1
313 main.log.info("Ping failed, making attempt number "+str(count)+" in 2 seconds")
314 i = 6
315 time.sleep(2)
316 elif ping == main.FALSE and count ==10:
317 main.log.error("Ping test failed")
318 i = 17
319 result = main.FALSE
320 elif ping == main.TRUE:
321 i = i + 1
322 result = main.TRUE
323 endTime = time.time()
324 if result == main.TRUE:
325 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
326 else:
327 main.log.report("\tPING TESTS FAILED")
328 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
329
330
331# ******************************************************************************************************************************************************************
332# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
333
334 def CASE21(self,main) :
335 import json
336 from drivers.common.api.onosrestapidriver import *
337 main.log.report("Test device discovery function, by attach, detach, move host h1 from s1->s6->s1. Per mininet naming, switch port the host attaches will remain as 's1-eth1' throughout the test.")
338 main.log.report("Check initially hostMAC/IP exist on the mininet...")
339 host = main.params['YANK']['hostname']
340 mac = main.params['YANK']['hostmac']
341 hostip = main.params['YANK']['hostip']
342 RestIP1 = main.params['RESTCALL']['restIP1']
343 RestPort = main.params['RESTCALL']['restPort']
344 url = main.params['RESTCALL']['restURL']
345
346 t_topowait = 0
347 t_restwait = 10
348 main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
349 main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
350 #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
351 time.sleep(t_topowait)
352 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" )
353 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
354 time.sleep(t_restwait)
355 restcall = OnosRestApiDriver()
356 Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
357 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
358 if Reststatus == 1:
359 main.log.report("\t PASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
360 result1 = main.TRUE
361 elif Reststatus > 1:
362 main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
363 main.log.report("switches are: " + "; ".join(Switch))
364 main.log.report("Ports are: " + "; ".join(Port))
365 main.log.report("MACs are: " + "; ".join(MAC))
366 result1 = main.FALSE
367 else:
368 main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
369 result1 = main.FALSE
370
371
372 ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
373
374 main.log.report("Yank out s1-eth1")
375 main.case("Yankout s6-eth1 (link to h1) from s1")
376 result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
377 time.sleep(t_topowait)
378 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
379
380 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" )
381 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
382 time.sleep(t_restwait)
383 restcall = OnosRestApiDriver()
384 Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
385
386 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
387 if Reststatus == 1:
388 main.log.report("\tFAILED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
389 result2 = main.FALSE
390 elif Reststatus > 1:
391 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
392 main.log.report("switches are: " + "; ".join(Switch))
393 main.log.report("Ports are: " + "; ".join(Port))
394 main.log.report("MACs are: " + "; ".join(MAC))
395 result2 = main.FALSE
396 else:
397 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.")
398 result2 = main.TRUE
399
400 ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ######
401 main.log.report("Plug s1-eth1 into s6")
402 main.case("Plug s1-eth1 to s6")
403 result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
404 time.sleep(t_topowait)
405 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
406 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" )
407
408 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
409 time.sleep(t_restwait)
410 restcall = OnosRestApiDriver()
411 Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
412
413 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
414 if Reststatus == 1:
415 main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
416 result3 = main.TRUE
417 elif Reststatus > 1:
418 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
419 main.log.report("switches are: " + "; ".join(Switch))
420 main.log.report("Ports are: " + "; ".join(Port))
421 main.log.report("MACs are: " + "; ".join(MAC))
422 result3 = main.FALSE
423 else:
424 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
425 result3 = main.FALSE
426
427 ###### Step to put interface "s1-eth1" back to s1"#####
428 main.log.report("Move s1-eth1 back on to s1")
429 main.case("Move s1-eth1 back to s1")
430 result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
431 time.sleep(t_topowait)
432 retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
433 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
434 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" )
435
436 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
437 time.sleep(t_restwait)
438 restcall = OnosRestApiDriver()
439 Reststatus, Switch, Port, MAC = restcall.find_host(RestIP1,RestPort,url, hostip)
440
441 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
442 if Reststatus == 1:
443 main.log.report("\tPASSED - Found host IP = " + hostip + "; MAC = " + "".join(MAC) + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + "".join(Port))
444 result4 = main.TRUE
445 elif Reststatus > 1:
446 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
447 main.log.report("switches are: " + "; ".join(Switch))
448 main.log.report("Ports are: " + "; ".join(Port))
449 main.log.report("MACs are: " + "; ".join(MAC))
450 result4 = main.FALSE
451 else:
452 main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
453 result4 = main.FALSE
454
455 result = result1 and result2 and result3 and result4
456 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
457
458