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