blob: 1da2ac4619e600d4bf1e91a5306ca7539247a262 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -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()
admine0ae8202013-08-28 11:51:43 -070017 main.Cassandra1.start()
18 main.Cassandra2.start()
19 main.Cassandra3.start()
20 main.Cassandra4.start()
21 time.sleep(20)
adminbae64d82013-08-01 10:50:15 -070022 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()
admin530b4c92013-08-14 16:54:35 -070029 time.sleep(5)
30 test= main.ONOS1.rest_status()
31 if test == main.FALSE:
32 main.ONOS1.start_rest()
adminbae64d82013-08-01 10:50:15 -070033 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")
admin530b4c92013-08-14 16:54:35 -070040 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()
adminbae64d82013-08-01 10:50:15 -070053 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
admin530b4c92013-08-14 16:54:35 -070084 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
adminbae64d82013-08-01 10:50:15 -070085 time.sleep(1)
admin530b4c92013-08-14 16:54:35 -070086 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'])
adminbae64d82013-08-01 10:50:15 -070087 elif i >= 3 and i < 5:
88 j=i+1
admin530b4c92013-08-14 16:54:35 -070089 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
adminbae64d82013-08-01 10:50:15 -070090 time.sleep(1)
admin530b4c92013-08-14 16:54:35 -070091 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'])
adminbae64d82013-08-01 10:50:15 -070092 elif i >= 5 and i < 15:
93 j=i+1
admin530b4c92013-08-14 16:54:35 -070094 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
adminbae64d82013-08-01 10:50:15 -070095 time.sleep(1)
admin530b4c92013-08-14 16:54:35 -070096 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'])
adminbae64d82013-08-01 10:50:15 -070097 else:
98 j=i+16
admin530b4c92013-08-14 16:54:35 -070099 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
adminbae64d82013-08-01 10:50:15 -0700100 time.sleep(1)
admin530b4c92013-08-14 16:54:35 -0700101 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'])
adminbae64d82013-08-01 10:50:15 -0700102 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 time.sleep(5)
116 strtTime = time.time()
117 main.ONOS1.add_flow(main.params['FLOWDEF'])
118 main.case("Checking flows")
119 tmp = main.FALSE
120 count = 1
admine0ae8202013-08-28 11:51:43 -0700121 main.log.info("Wait for flows to be pushed to the switches, then check")
adminbae64d82013-08-01 10:50:15 -0700122 while tmp == main.FALSE:
123 main.step("Waiting")
124 time.sleep(10)
125 main.step("Checking")
126 tmp = main.ONOS1.check_flow()
127 if tmp == main.FALSE and count < 6:
128 count = count + 1
129 main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
130 elif tmp == main.FALSE and count == 6:
admin530b4c92013-08-14 16:54:35 -0700131 result1 = main.FALSE
adminbae64d82013-08-01 10:50:15 -0700132 break
133 else:
admin530b4c92013-08-14 16:54:35 -0700134 result1 = main.TRUE
adminbae64d82013-08-01 10:50:15 -0700135 break
136 endTime = time.time()
admin530b4c92013-08-14 16:54:35 -0700137 if result1 == main.TRUE:
adminbae64d82013-08-01 10:50:15 -0700138 main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
139 else:
140 main.log.report("\tFlows failed check")
admin530b4c92013-08-14 16:54:35 -0700141
adminbae64d82013-08-01 10:50:15 -0700142 strtTime = time.time()
143 count = 1
144 i = 6
145 while i < 16 :
146 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
147 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
148 if ping == main.FALSE and count < 3:
149 count = count + 1
150 i = 6
151 main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
152 time.sleep(10)
153 elif ping == main.FALSE and count ==3:
154 main.log.error("Ping test failed")
155 i = 17
admin530b4c92013-08-14 16:54:35 -0700156 result2 = main.FALSE
157 elif ping == main.TRUE:
158 i = i + 1
159 result2 = main.TRUE
160 endTime = time.time()
161 if result2 == main.TRUE:
162 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
163 else:
164 main.log.report("\tPING TEST FAIL")
165
166 result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
167 main.step("Verifying the result")
168 utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
169
170#**********************************************************************************************************************************************************************************************
171#This test case removes Controllers 2,3, and 4 then performs a ping test.
172#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
173#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.
174#If the ping test fails 6 times, then the test case will return false
175
176 def CASE4(self,main) :
177 main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
178 import time
179 for i in range(25):
180 if i < 15:
181 j=i+1
182 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
183 else:
184 j=i+16
185 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
admine0ae8202013-08-28 11:51:43 -0700186
187 strtTime = time.time()
admin530b4c92013-08-14 16:54:35 -0700188 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
189 for i in range(2):
190 if result == main.FALSE:
191 time.sleep(5)
192 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
193 else:
194 break
195
admin530b4c92013-08-14 16:54:35 -0700196 count = 1
197 i = 6
198 while i < 16 :
199 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
200 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
201 if ping == main.FALSE and count < 6:
202 count = count + 1
203 i = 6
204 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
205 time.sleep(5)
206 elif ping == main.FALSE and count ==6:
207 main.log.error("Ping test failed")
208 i = 17
adminbae64d82013-08-01 10:50:15 -0700209 result = main.FALSE
210 elif ping == main.TRUE:
211 i = i + 1
212 result = main.TRUE
213 endTime = time.time()
214 if result == main.TRUE:
215 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
216 else:
217 main.log.report("\tPING TEST FAIL")
218 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
219
220# **********************************************************************************************************************************************************************************************
221#This test case restores the controllers removed by Case 4 then performs a ping test.
222
223 def CASE5(self,main) :
admin530b4c92013-08-14 16:54:35 -0700224 main.log.report("Restore ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
adminbae64d82013-08-01 10:50:15 -0700225 import time
226 for i in range(25):
227 if i < 15:
228 j=i+1
admin530b4c92013-08-14 16:54:35 -0700229 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'])
adminbae64d82013-08-01 10:50:15 -0700230 else:
231 j=i+16
admin530b4c92013-08-14 16:54:35 -0700232 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'])
admine0ae8202013-08-28 11:51:43 -0700233
234 strtTime = time.time()
admin530b4c92013-08-14 16:54:35 -0700235 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
236 for i in range(2):
237 if result == main.FALSE:
238 time.sleep(5)
239 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
240 else:
241 break
242
adminbae64d82013-08-01 10:50:15 -0700243 count = 1
244 i = 6
245 while i < 16 :
246 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
247 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
admin530b4c92013-08-14 16:54:35 -0700248 if ping == main.FALSE and count < 6:
adminbae64d82013-08-01 10:50:15 -0700249 count = count + 1
250 i = 6
admin530b4c92013-08-14 16:54:35 -0700251 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
252 time.sleep(5)
253 elif ping == main.FALSE and count ==6:
adminbae64d82013-08-01 10:50:15 -0700254 main.log.error("Ping test failed")
255 i = 17
256 result = main.FALSE
257 elif ping == main.TRUE:
258 i = i + 1
259 result = main.TRUE
260 endTime = time.time()
261 if result == main.TRUE:
262 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
263 else:
264 main.log.report("\tPING TEST FAILED")
265 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
266
267# **********************************************************************************************************************************************************************************************
268#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
269
270 def CASE6(self,main) :
admine0ae8202013-08-28 11:51:43 -0700271 main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
adminbae64d82013-08-01 10:50:15 -0700272 import time
273 main.case("Bringing Link down... ")
274 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
adminbae64d82013-08-01 10:50:15 -0700275 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
admine0ae8202013-08-28 11:51:43 -0700276
277 strtTime = time.time()
admin530b4c92013-08-14 16:54:35 -0700278 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
279 for i in range(2):
280 if result == main.FALSE:
281 time.sleep(5)
282 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
283 else:
284 break
285
adminbae64d82013-08-01 10:50:15 -0700286 count = 1
287 i = 6
288 while i < 16 :
289 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
290 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
admine0ae8202013-08-28 11:51:43 -0700291 if ping == main.FALSE and count < 10:
adminbae64d82013-08-01 10:50:15 -0700292 count = count + 1
admin530b4c92013-08-14 16:54:35 -0700293 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
adminbae64d82013-08-01 10:50:15 -0700294 i = 6
admin530b4c92013-08-14 16:54:35 -0700295 time.sleep(5)
admine0ae8202013-08-28 11:51:43 -0700296 elif ping == main.FALSE and count == 10:
adminbae64d82013-08-01 10:50:15 -0700297 main.log.error("Ping test failed")
298 i = 17
299 result = main.FALSE
300 elif ping == main.TRUE:
301 i = i + 1
302 result = main.TRUE
303 endTime = time.time()
304 if result == main.TRUE:
305 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
306 else:
307 main.log.report("\tPING TEST FAILED")
308 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
309
310# **********************************************************************************************************************************************************************************************
311#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
312
313 def CASE7(self,main) :
admine0ae8202013-08-28 11:51:43 -0700314 main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
adminbae64d82013-08-01 10:50:15 -0700315 import time
316 main.case("Bringing Link up... ")
317 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
adminbae64d82013-08-01 10:50:15 -0700318 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
admine0ae8202013-08-28 11:51:43 -0700319
320 strtTime = time.time()
admin530b4c92013-08-14 16:54:35 -0700321 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
322 for i in range(2):
323 if result == main.FALSE:
324 time.sleep(5)
325 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
326 else:
327 break
328
adminbae64d82013-08-01 10:50:15 -0700329 strtTime = time.time()
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))
admine0ae8202013-08-28 11:51:43 -0700335 if ping == main.FALSE and count < 10:
adminbae64d82013-08-01 10:50:15 -0700336 count = count + 1
admin530b4c92013-08-14 16:54:35 -0700337 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
adminbae64d82013-08-01 10:50:15 -0700338 i = 6
admin530b4c92013-08-14 16:54:35 -0700339 time.sleep(5)
admine0ae8202013-08-28 11:51:43 -0700340 elif ping == main.FALSE and count ==10:
adminbae64d82013-08-01 10:50:15 -0700341 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 TESTS 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
admin530b4c92013-08-14 16:54:35 -0700354
355# ******************************************************************************************************************************************************************
356# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
357
358 def CASE21(self,main) :
359 import json
360 from drivers.common.api.onosrestapidriver import *
361 main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
362 main.log.report("Check initially hostMAC exist on the mininet...")
363 host = main.params['YANK']['hostname']
364 mac = main.params['YANK']['hostmac']
365 RestIP1 = main.params['RESTCALL']['restIP1']
366 RestIP2 = main.params['RESTCALL']['restIP2']
367 RestPort = main.params['RESTCALL']['restPort']
368 url = main.params['RESTCALL']['restURL']
369 #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
370
371 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" )
372 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
373 restcall = OnosRestApiDriver()
374 Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
375 try:
376 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
377 except IndexError:
378 Reststatus = 0
379 if Reststatus == 1:
380 main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
381 result = main.TRUE
382 else:
383 main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
384 result = main.FALSE
385
386 ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
387
388 main.log.report("Yank out s1-eth1")
389 main.case("Yankout s6-eth1 (link to h1) from s1")
390 result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
391 time.sleep(3)
392 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
393 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
394 Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
395 try:
396 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
397 except IndexError:
398 Reststatus = 0
399 if Reststatus == 0:
400 main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
401 result = main.TRUE
402 else:
403 main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
404 result = main.FALSE
405
406 ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ######
407 main.log.report("Plug s1-eth1 into s6")
408 main.case("Plug s1-eth1 to s6")
409 result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
410 time.sleep(3)
411 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
412 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
413 Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
414 try:
415 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
416 except IndexError:
417 Reststatus = 0
418 if Reststatus == 0:
419 main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
420 result = main.FALSE
421 elif attachedSW == "00:00:00:00:00:00:00:06":
422 main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
423 result = main.TRUE
424 else:
425 main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
426 result = main.FALSE
427
428 ###### Step to put interface "s1-eth1" back to s1"#####
429 main.log.report("Move s1-eth1 back on to s1")
430 main.case("Move s1-eth1 back to s1")
431 result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
432 time.sleep(3)
433 retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
434 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
435 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
436 Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
437 try:
438 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
439 except IndexError:
440 Reststatus = 0
441 if Reststatus == 0:
442 main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
443 result = main.FALSE
444 elif attachedSW == "00:00:00:00:00:00:00:01":
445 main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
446 result = main.TRUE
447 else:
448 main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
449 result = main.FALSE
450
451 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
452
453