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