blob: bc0291b05b9f8a3c44cc74544d71f331b0cf625d [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()
17 main.ONOS1.drop_keyspace()
18 main.ONOS1.start()
19 time.sleep(10)
20 main.ONOS2.start()
21 main.ONOS3.start()
22 main.ONOS4.start()
23 main.ONOS1.start_rest()
admin530b4c92013-08-14 16:54:35 -070024 time.sleep(5)
25 test= main.ONOS1.rest_status()
26 if test == main.FALSE:
27 main.ONOS1.start_rest()
adminbae64d82013-08-01 10:50:15 -070028 main.ONOS1.get_version()
29 main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
30 main.case("Checking if the startup was clean...")
31 main.step("Testing startup Zookeeper")
32 data = main.Zookeeper1.isup()
33 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
34 main.step("Testing startup Cassandra")
admin530b4c92013-08-14 16:54:35 -070035 data = main.Cassandra1.isup()
36 if data == main.FALSE:
37 main.Cassandra1.stop()
38 main.Cassandra2.stop()
39 main.Cassandra3.stop()
40 main.Cassandra4.stop()
41
42 time.sleep(5)
43
44 main.Cassandra1.start()
45 main.Cassandra2.start()
46 main.Cassandra3.start()
47 main.Cassandra4.start()
adminbae64d82013-08-01 10:50:15 -070048 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
49 main.step("Testing startup ONOS")
50 data = main.ONOS1.isup()
51 if data == main.FALSE:
52 main.log.report("Something is funny... restarting ONOS")
53 main.ONOS1.stop()
54 time.sleep(3)
55 main.ONOS1.start()
56 time.sleep(5)
57 data = main.ONOS1.isup()
58 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
59
60#**********************************************************************************************************************************************************************************************
61#Assign Controllers
62#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>).
63#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
64#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
65# the controllers already assigned to the switch are not specified.
66
67 def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches
68 import time
69 main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
70 main.case("Checking if one MN host exists")
71 main.step("Host IP Checking using checkIP")
72 result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
73 main.step("Verifying the result")
74 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
75 main.step("assigning ONOS controllers to switches")
76 for i in range(25):
77 if i < 3:
78 j=i+1
admin530b4c92013-08-14 16:54:35 -070079 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
adminbae64d82013-08-01 10:50:15 -070080 time.sleep(1)
admin530b4c92013-08-14 16:54:35 -070081 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 -070082 elif i >= 3 and i < 5:
83 j=i+1
admin530b4c92013-08-14 16:54:35 -070084 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
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 >= 5 and i < 15:
88 j=i+1
admin530b4c92013-08-14 16:54:35 -070089 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
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 else:
93 j=i+16
admin530b4c92013-08-14 16:54:35 -070094 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
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 main.Mininet1.get_sw_controller("s1")
98
99# **********************************************************************************************************************************************************************************************
100#Add Flows
101#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
102#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
103
104 def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
105 main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
106 import time
107 main.case("Taking care of these flows!")
108 main.step("Cleaning out any leftover flows...")
109 main.ONOS1.delete_flow("all")
110 time.sleep(5)
111 strtTime = time.time()
112 main.ONOS1.add_flow(main.params['FLOWDEF'])
113 main.case("Checking flows")
114 tmp = main.FALSE
115 count = 1
116 main.log.info("Wait for flows to settle, then check")
117 while tmp == main.FALSE:
118 main.step("Waiting")
119 time.sleep(10)
120 main.step("Checking")
121 tmp = main.ONOS1.check_flow()
122 if tmp == main.FALSE and count < 6:
123 count = count + 1
124 main.log.report("Flow failed, waiting 10 seconds then making attempt number "+str(count))
125 elif tmp == main.FALSE and count == 6:
admin530b4c92013-08-14 16:54:35 -0700126 result1 = main.FALSE
adminbae64d82013-08-01 10:50:15 -0700127 break
128 else:
admin530b4c92013-08-14 16:54:35 -0700129 result1 = main.TRUE
adminbae64d82013-08-01 10:50:15 -0700130 break
131 endTime = time.time()
admin530b4c92013-08-14 16:54:35 -0700132 if result1 == main.TRUE:
adminbae64d82013-08-01 10:50:15 -0700133 main.log.report("\n\t\t\t\tTime to add flows: "+str(round(endTime-strtTime,2))+" seconds")
134 else:
135 main.log.report("\tFlows failed check")
admin530b4c92013-08-14 16:54:35 -0700136
adminbae64d82013-08-01 10:50:15 -0700137 strtTime = time.time()
138 count = 1
139 i = 6
140 while i < 16 :
141 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
142 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
143 if ping == main.FALSE and count < 3:
144 count = count + 1
145 i = 6
146 main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds")
147 time.sleep(10)
148 elif ping == main.FALSE and count ==3:
149 main.log.error("Ping test failed")
150 i = 17
admin530b4c92013-08-14 16:54:35 -0700151 result2 = main.FALSE
152 elif ping == main.TRUE:
153 i = i + 1
154 result2 = main.TRUE
155 endTime = time.time()
156 if result2 == main.TRUE:
157 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
158 else:
159 main.log.report("\tPING TEST FAIL")
160
161 result3 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
162 main.step("Verifying the result")
163 utilities.assert_equals(expect=main.TRUE,actual=result1 and result2 and result3,onpass="Flow check PASS",onfail="Flow check FAIL")
164
165#**********************************************************************************************************************************************************************************************
166#This test case removes Controllers 2,3, and 4 then performs a ping test.
167#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
168#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.
169#If the ping test fails 6 times, then the test case will return false
170
171 def CASE4(self,main) :
172 main.log.report("Remove ONOS 2,3,4 then ping until all hosts are reachable or fail after 6 attempts")
173 import time
174 for i in range(25):
175 if i < 15:
176 j=i+1
177 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
178 else:
179 j=i+16
180 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
181
182 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
183 for i in range(2):
184 if result == main.FALSE:
185 time.sleep(5)
186 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
187 else:
188 break
189
190 strtTime = time.time()
191 count = 1
192 i = 6
193 while i < 16 :
194 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
195 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
196 if ping == main.FALSE and count < 6:
197 count = count + 1
198 i = 6
199 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
200 time.sleep(5)
201 elif ping == main.FALSE and count ==6:
202 main.log.error("Ping test failed")
203 i = 17
adminbae64d82013-08-01 10:50:15 -0700204 result = main.FALSE
205 elif ping == main.TRUE:
206 i = i + 1
207 result = main.TRUE
208 endTime = time.time()
209 if result == main.TRUE:
210 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
211 else:
212 main.log.report("\tPING TEST FAIL")
213 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
214
215# **********************************************************************************************************************************************************************************************
216#This test case restores the controllers removed by Case 4 then performs a ping test.
217
218 def CASE5(self,main) :
admin530b4c92013-08-14 16:54:35 -0700219 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 -0700220 import time
221 for i in range(25):
222 if i < 15:
223 j=i+1
admin530b4c92013-08-14 16:54:35 -0700224 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 -0700225 else:
226 j=i+16
admin530b4c92013-08-14 16:54:35 -0700227 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'])
228
229 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
230 for i in range(2):
231 if result == main.FALSE:
232 time.sleep(5)
233 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
234 else:
235 break
236
adminbae64d82013-08-01 10:50:15 -0700237 strtTime = time.time()
238 count = 1
239 i = 6
240 while i < 16 :
241 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
242 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
admin530b4c92013-08-14 16:54:35 -0700243 if ping == main.FALSE and count < 6:
adminbae64d82013-08-01 10:50:15 -0700244 count = count + 1
245 i = 6
admin530b4c92013-08-14 16:54:35 -0700246 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
247 time.sleep(5)
248 elif ping == main.FALSE and count ==6:
adminbae64d82013-08-01 10:50:15 -0700249 main.log.error("Ping test failed")
250 i = 17
251 result = main.FALSE
252 elif ping == main.TRUE:
253 i = i + 1
254 result = main.TRUE
255 endTime = time.time()
256 if result == main.TRUE:
257 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
258 else:
259 main.log.report("\tPING TEST FAILED")
260 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
261
262# **********************************************************************************************************************************************************************************************
263#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
264
265 def CASE6(self,main) :
admin530b4c92013-08-14 16:54:35 -0700266 main.log.report("Bring Link between s1 and s2 down, wait 15 seconds, then ping until all hosts are reachable or fail after 6 attempts")
adminbae64d82013-08-01 10:50:15 -0700267 import time
268 main.case("Bringing Link down... ")
269 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
admin530b4c92013-08-14 16:54:35 -0700270 time.sleep(15)
adminbae64d82013-08-01 10:50:15 -0700271 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
admin530b4c92013-08-14 16:54:35 -0700272
273 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
274 for i in range(2):
275 if result == main.FALSE:
276 time.sleep(5)
277 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
278 else:
279 break
280
adminbae64d82013-08-01 10:50:15 -0700281 strtTime = time.time()
282 count = 1
283 i = 6
284 while i < 16 :
285 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
286 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
admin530b4c92013-08-14 16:54:35 -0700287 if ping == main.FALSE and count < 6:
adminbae64d82013-08-01 10:50:15 -0700288 count = count + 1
admin530b4c92013-08-14 16:54:35 -0700289 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
adminbae64d82013-08-01 10:50:15 -0700290 i = 6
admin530b4c92013-08-14 16:54:35 -0700291 time.sleep(5)
292 elif ping == main.FALSE and count ==6:
adminbae64d82013-08-01 10:50:15 -0700293 main.log.error("Ping test failed")
294 i = 17
295 result = main.FALSE
296 elif ping == main.TRUE:
297 i = i + 1
298 result = main.TRUE
299 endTime = time.time()
300 if result == main.TRUE:
301 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
302 else:
303 main.log.report("\tPING TEST FAILED")
304 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
305
306# **********************************************************************************************************************************************************************************************
307#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
308
309 def CASE7(self,main) :
admin530b4c92013-08-14 16:54:35 -0700310 main.log.report("Bring Link between s1 and s2 up, wait 15 seconds, then ping until all hosts are reachable or fail after 6 attempts")
adminbae64d82013-08-01 10:50:15 -0700311 import time
312 main.case("Bringing Link up... ")
313 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
admin530b4c92013-08-14 16:54:35 -0700314 time.sleep(15)
adminbae64d82013-08-01 10:50:15 -0700315 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
admin530b4c92013-08-14 16:54:35 -0700316
317 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
318 for i in range(2):
319 if result == main.FALSE:
320 time.sleep(5)
321 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
322 else:
323 break
324
adminbae64d82013-08-01 10:50:15 -0700325 strtTime = time.time()
326 count = 1
327 i = 6
328 while i < 16 :
329 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
330 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
admin530b4c92013-08-14 16:54:35 -0700331 if ping == main.FALSE and count < 6:
adminbae64d82013-08-01 10:50:15 -0700332 count = count + 1
admin530b4c92013-08-14 16:54:35 -0700333 main.log.info("Ping failed, making attempt number "+str(count)+" in 5 seconds")
adminbae64d82013-08-01 10:50:15 -0700334 i = 6
admin530b4c92013-08-14 16:54:35 -0700335 time.sleep(5)
336 elif ping == main.FALSE and count ==6:
adminbae64d82013-08-01 10:50:15 -0700337 main.log.error("Ping test failed")
338 i = 17
339 result = main.FALSE
340 elif ping == main.TRUE:
341 i = i + 1
342 result = main.TRUE
343 endTime = time.time()
344 if result == main.TRUE:
345 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
346 else:
347 main.log.report("\tPING TESTS FAILED")
348 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
349
admin530b4c92013-08-14 16:54:35 -0700350
351# ******************************************************************************************************************************************************************
352# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
353
354 def CASE21(self,main) :
355 import json
356 from drivers.common.api.onosrestapidriver import *
357 main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.")
358 main.log.report("Check initially hostMAC exist on the mininet...")
359 host = main.params['YANK']['hostname']
360 mac = main.params['YANK']['hostmac']
361 RestIP1 = main.params['RESTCALL']['restIP1']
362 RestIP2 = main.params['RESTCALL']['restIP2']
363 RestPort = main.params['RESTCALL']['restPort']
364 url = main.params['RESTCALL']['restURL']
365 #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
366
367 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" )
368 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
369 restcall = OnosRestApiDriver()
370 Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
371 try:
372 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
373 except IndexError:
374 Reststatus = 0
375 if Reststatus == 1:
376 main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW)
377 result = main.TRUE
378 else:
379 main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
380 result = main.FALSE
381
382 ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
383
384 main.log.report("Yank out s1-eth1")
385 main.case("Yankout s6-eth1 (link to h1) from s1")
386 result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
387 time.sleep(3)
388 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
389 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
390 Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
391 try:
392 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
393 except IndexError:
394 Reststatus = 0
395 if Reststatus == 0:
396 main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully")
397 result = main.TRUE
398 else:
399 main.log.report("Attempt to yank out s1-eht1 from s1 failed.")
400 result = main.FALSE
401
402 ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ######
403 main.log.report("Plug s1-eth1 into s6")
404 main.case("Plug s1-eth1 to s6")
405 result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
406 time.sleep(3)
407 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
408 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
409 Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac)
410 try:
411 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
412 except IndexError:
413 Reststatus = 0
414 if Reststatus == 0:
415 main.log.report("Attempt to plug s1-eth1 to s6 FAILED")
416 result = main.FALSE
417 elif attachedSW == "00:00:00:00:00:00:00:06":
418 main.log.report("Attempt to plug s1-eht1 to s6 succeded.")
419 result = main.TRUE
420 else:
421 main.log.report( "FAILED to attach s1-eth1 to s6 correctly!")
422 result = main.FALSE
423
424 ###### Step to put interface "s1-eth1" back to s1"#####
425 main.log.report("Move s1-eth1 back on to s1")
426 main.case("Move s1-eth1 back to s1")
427 result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
428 time.sleep(3)
429 retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
430 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
431 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
432 Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac)
433 try:
434 attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID']
435 except IndexError:
436 Reststatus = 0
437 if Reststatus == 0:
438 main.log.report("Attempt to plug s1-eth1 back to s1 FAILED")
439 result = main.FALSE
440 elif attachedSW == "00:00:00:00:00:00:00:01":
441 main.log.report("Attempt to plug s1-eht1 back to s1 succeded.")
442 result = main.TRUE
443 else:
444 main.log.report( "FAIL to attach s1-eth1 to s1 correctly!")
445 result = main.FALSE
446
447 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
448
449