blob: 3543b65ca82672ed3ef71c175c5a7786d0763b54 [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
Jon Hallbb650fe2014-07-14 14:54:48 -070012 main.ONOS1.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
13 main.ONOS2.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
14 main.ONOS3.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
15 main.ONOS4.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties")
Jon Hall010f5412014-05-21 15:10:12 -070016
Jon Hallbb650fe2014-07-14 14:54:48 -070017 main.ONOS1.stop_all()
18 main.ONOS2.stop_all()
19 main.ONOS3.stop_all()
20 main.ONOS4.stop_all()
SeanCorcoranf4ee2582014-04-16 17:12:30 -070021 main.Zookeeper1.start()
SeanCorcoranf4ee2582014-04-16 17:12:30 -070022 main.Zookeeper2.start()
23 main.Zookeeper3.start()
24 main.Zookeeper4.start()
Jon Hall010f5412014-05-21 15:10:12 -070025 main.RamCloud1.stop_coor()
26 main.RamCloud1.stop_serv()
27 main.RamCloud2.stop_serv()
28 main.RamCloud3.stop_serv()
29 main.RamCloud4.stop_serv()
30 time.sleep(10)
31 main.RamCloud1.del_db()
32 main.RamCloud2.del_db()
33 main.RamCloud3.del_db()
34 main.RamCloud4.del_db()
35 time.sleep(10)
Jon Hall0e09e6a2014-04-25 13:42:15 -070036 main.log.report("Pulling latest code from github to all nodes")
37 for i in range(2):
38 uptodate = main.ONOS1.git_pull()
39 main.ONOS2.git_pull()
40 main.ONOS3.git_pull()
41 main.ONOS4.git_pull()
42 ver1 = main.ONOS1.get_version()
43 ver2 = main.ONOS4.get_version()
44 if ver1==ver2:
45 break
46 elif i==1:
47 main.ONOS2.git_pull("ONOS1 master")
48 main.ONOS3.git_pull("ONOS1 master")
49 main.ONOS4.git_pull("ONOS1 master")
Jon Hall010f5412014-05-21 15:10:12 -070050 #if uptodate==0
51 if 1:
Jon Hall0e09e6a2014-04-25 13:42:15 -070052 main.ONOS1.git_compile()
53 main.ONOS2.git_compile()
54 main.ONOS3.git_compile()
55 main.ONOS4.git_compile()
56 main.ONOS1.print_version()
Jon Hall010f5412014-05-21 15:10:12 -070057 # main.RamCloud1.git_pull()
58 # main.RamCloud2.git_pull()
59 # main.RamCloud3.git_pull()
60 # main.RamCloud4.git_pull()
61 # main.ONOS1.get_version()
62 # main.ONOS2.get_version()
63 # main.ONOS3.get_version()
64 # main.ONOS4.get_version()
SeanCorcoranc3ed7432014-04-09 16:32:27 -070065 main.RamCloud1.start_coor()
Jon Hall010f5412014-05-21 15:10:12 -070066 time.sleep(1)
SeanCorcoranc3ed7432014-04-09 16:32:27 -070067 main.RamCloud1.start_serv()
68 main.RamCloud2.start_serv()
69 main.RamCloud3.start_serv()
Jon Hall010f5412014-05-21 15:10:12 -070070 main.RamCloud4.start_serv()
Jon Hallbb650fe2014-07-14 14:54:48 -070071 main.ONOS1.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
Jon Hall010f5412014-05-21 15:10:12 -070072 time.sleep(5)
Jon Hallbb650fe2014-07-14 14:54:48 -070073 main.ONOS2.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
74 main.ONOS3.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
75 main.ONOS4.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ")
Jon Hall010f5412014-05-21 15:10:12 -070076 main.ONOS1.start_rest()
77 time.sleep(10)
78 test= main.ONOS1.rest_status()
79 if test == main.FALSE:
80 main.ONOS1.start_rest()
81 main.ONOS1.get_version()
SeanCorcoranc3ed7432014-04-09 16:32:27 -070082 main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
83 main.case("Checking if the startup was clean...")
Jon Hall010f5412014-05-21 15:10:12 -070084 main.step("Testing startup Zookeeper")
SeanCorcoranc3ed7432014-04-09 16:32:27 -070085 data = main.Zookeeper1.isup()
86 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
Jon Hall010f5412014-05-21 15:10:12 -070087 main.step("Testing startup RamCloud")
88 data = main.RamCloud1.status_serv()
SeanCorcoranc3ed7432014-04-09 16:32:27 -070089 if data == main.FALSE:
90 main.RamCloud1.stop_coor()
91 main.RamCloud1.stop_serv()
92 main.RamCloud2.stop_serv()
93 main.RamCloud3.stop_serv()
94 main.RamCloud4.stop_serv()
95
96 time.sleep(5)
SeanCorcoranc3ed7432014-04-09 16:32:27 -070097 main.RamCloud1.start_coor()
98 main.RamCloud1.start_serv()
99 main.RamCloud2.start_serv()
100 main.RamCloud3.start_serv()
Jon Hall010f5412014-05-21 15:10:12 -0700101 main.RamCloud4.start_serv()
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700102 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
Jon Hall010f5412014-05-21 15:10:12 -0700103 main.step("Testing startup ONOS")
104 data = main.ONOS1.isup()
105 for i in range(3):
106 if data == main.FALSE:
107 #main.log.report("Something is funny... restarting ONOS")
108 #main.ONOS1.stop()
109 time.sleep(3)
110 #main.ONOS1.start()
111 #time.sleep(5)
112 data = main.ONOS1.isup()
113 else:
114 break
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700115 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
Jon Hallbb650fe2014-07-14 14:54:48 -0700116 time.sleep(10)
Jon Hall010f5412014-05-21 15:10:12 -0700117
118
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700119#**********************************************************************************************************************************************************************************************
120#Assign Controllers
121#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>).
122#Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers.
123#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
124# the controllers already assigned to the switch are not specified.
125
126 def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches
127 import time
128 main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4")
129 main.case("Checking if one MN host exists")
130 main.step("Host IP Checking using checkIP")
131 result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
132 main.step("Verifying the result")
133 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured")
134 main.step("assigning ONOS controllers to switches")
135 for i in range(25):
136 if i < 3:
137 j=i+1
138 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
139 time.sleep(1)
Jon Hall0e09e6a2014-04-25 13:42:15 -0700140 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'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700141 elif i >= 3 and i < 5:
142 j=i+1
143 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2'])
144 time.sleep(1)
Jon Hall0e09e6a2014-04-25 13:42:15 -0700145 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'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700146 elif i >= 5 and i < 15:
147 j=i+1
148 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3'])
149 time.sleep(1)
Jon Hall0e09e6a2014-04-25 13:42:15 -0700150 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'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700151 else:
152 j=i+16
153 main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4'])
154 time.sleep(1)
Jon Hall0e09e6a2014-04-25 13:42:15 -0700155 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'])
Jon Hall670808c2014-06-23 16:07:22 -0700156 result = main.Mininet1.get_sw_controller("s1")
157 if result:
158 result = main.TRUE
159 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="S1 assigned to controller",onfail="S1 not assigned to controller")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700160
161 for i in range(9):
162 if result == main.FALSE:
163 time.sleep(3)
164 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
165 else:
Jon Hallbb650fe2014-07-14 14:54:48 -0700166 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
167 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
168 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700169 break
170
171# **********************************************************************************************************************************************************************************************
172#Add Flows
173#Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test
174#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
175
176 def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
Jon Hall010f5412014-05-21 15:10:12 -0700177 main.log.report("Delete any flows from previous tests, then add flows using intents and wait for switch flow tables to update")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700178 import time
179
180 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
181 for counter in range(9):
182 if result == main.FALSE:
183 time.sleep(3)
184 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
185 else:
Jon Hallbb650fe2014-07-14 14:54:48 -0700186 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
187 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
188 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700189 break
Jon Hall670808c2014-06-23 16:07:22 -0700190 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700191
192 main.case("Taking care of these flows!")
193 main.step("Cleaning out any leftover flows...")
Jon Hall0e09e6a2014-04-25 13:42:15 -0700194 #main.ONOS1.delete_flow("all")
Jon Hallbd795bf2014-06-18 09:46:32 -0700195 main.ONOS1.rm_intents()
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700196 time.sleep(5)
Jon Hallbd795bf2014-06-18 09:46:32 -0700197 main.ONOS1.purge_intents()
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700198 strtTime = time.time()
Jon Hallbd795bf2014-06-18 09:46:32 -0700199 main.ONOS1.add_intents()
Jon Hallf7947982014-05-22 10:44:45 -0700200 main.case("Checking flows with pings")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700201
202 pingAttempts = main.params['pingAttempts']
203 pingSleep = main.params['pingSleep']
204
205 count = 1
206 i = 6
207 while i < 16 :
208 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
209 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
210 if ping == main.FALSE and count < int(pingAttempts):
211 count = count + 1
Jon Hall010f5412014-05-21 15:10:12 -0700212 # i = 6
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700213 main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
214 time.sleep(int(pingSleep))
215 elif ping == main.FALSE and count == int(pingAttempts):
216 main.log.error("Ping test failed")
217 i = 17
Jon Hall670808c2014-06-23 16:07:22 -0700218 result2 = main.FALSE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700219 elif ping == main.TRUE:
220 i = i + 1
Jon Hall670808c2014-06-23 16:07:22 -0700221 result2 = main.TRUE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700222 endTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700223 result = result and result2
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700224 if result == main.TRUE:
Jon Hall010f5412014-05-21 15:10:12 -0700225 main.log.report("\n\t\t\t\tTime from pushing intents to successful ping test: "+str(round(endTime-strtTime,2))+" seconds")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700226 else:
227 main.log.report("\tFlows failed check")
228
229 main.step("Verifying the result")
Jon Hall670808c2014-06-23 16:07:22 -0700230 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
231 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700232
233#**********************************************************************************************************************************************************************************************
234#This test case removes Controllers 2,3, and 4 then performs a ping test.
235#The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
236#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.
237#If the ping test fails 6 times, then the test case will return false
238
239 def CASE4(self,main) :
Jon Hall670808c2014-06-23 16:07:22 -0700240 main.log.report("Assign all switches to just one ONOS instance then ping until all hosts are reachable or fail after 6 attempts")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700241 import time
242 import random
243
244 random.seed(None)
245
246 num = random.randint(1,4)
247 if num == 1:
248 ip = main.params['CTRL']['ip1']
249 port = main.params['CTRL']['port1']
250 elif num == 2:
251 ip = main.params['CTRL']['ip2']
252 port = main.params['CTRL']['port2']
253 elif num == 3:
254 ip = main.params['CTRL']['ip3']
255 port = main.params['CTRL']['port3']
256 else:
257 ip = main.params['CTRL']['ip4']
258 port = main.params['CTRL']['port4']
259
260 main.log.report("ONOS"+str(num)+" will be the sole controller")
261 for i in range(25):
262 if i < 15:
263 j=i+1
264 main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port) #Assigning a single controller removes all other controllers
265 else:
266 j=i+16
267 main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port)
268
269 strtTime = time.time()
270 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
271 for counter in range(9):
272 if result == main.FALSE:
273 time.sleep(3)
274 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
275 else:
Jon Hallbb650fe2014-07-14 14:54:48 -0700276 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
277 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
278 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700279 break
Jon Hall670808c2014-06-23 16:07:22 -0700280 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700281
282 pingAttempts = main.params['pingAttempts']
283 pingSleep = main.params['pingSleep']
284
285 count = 1
286 i = 6
287 while i < 16 :
288 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
289 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
290 if ping == main.FALSE and count < int(pingAttempts):
291 count = count + 1
Jon Hall010f5412014-05-21 15:10:12 -0700292 # i = 6
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700293 main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
294 time.sleep(int(pingSleep))
295 elif ping == main.FALSE and count == int(pingAttempts):
296 main.log.error("Ping test failed")
297 i = 17
Jon Hall670808c2014-06-23 16:07:22 -0700298 result2 = main.FALSE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700299 elif ping == main.TRUE:
300 i = i + 1
Jon Hall670808c2014-06-23 16:07:22 -0700301 result2 = main.TRUE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700302 endTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700303 result = result and result2
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700304 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 FAIL")
Jon Hallbb650fe2014-07-14 14:54:48 -0700308 main.ONOS1.show_intent(main.params['RestIP'])
Jon Hall670808c2014-06-23 16:07:22 -0700309 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
310 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700311
312# **********************************************************************************************************************************************************************************************
313#This test case restores the controllers removed by Case 4 then performs a ping test.
314
315 def CASE5(self,main) :
Jon Hall670808c2014-06-23 16:07:22 -0700316 main.log.report("Restore switch assignments to all 4 ONOS instances then ping until all hosts are reachable or fail after 6 attempts")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700317 import time
Jon Hallbb650fe2014-07-14 14:54:48 -0700318
319 #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
320 time.sleep(10)
321
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700322 for i in range(25):
323 if i < 15:
324 j=i+1
Jon Hall670808c2014-06-23 16:07:22 -0700325 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'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700326 else:
327 j=i+16
Jon Hall670808c2014-06-23 16:07:22 -0700328 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'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700329
330 strtTime = time.time()
331 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
332 for counter 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:
Jon Hallbb650fe2014-07-14 14:54:48 -0700337 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
338 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
339 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700340 break
Jon Hall670808c2014-06-23 16:07:22 -0700341 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700342
343 pingAttempts = main.params['pingAttempts']
344 pingSleep = main.params['pingSleep']
345
346 count = 1
347 i = 6
348 while i < 16 :
349 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
350 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
351 if ping == main.FALSE and count < int(pingAttempts):
352 count = count + 1
Jon Hall010f5412014-05-21 15:10:12 -0700353 # i = 6
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700354 main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
355 time.sleep(int(pingSleep))
356 elif ping == main.FALSE and count == int(pingAttempts):
357 main.log.error("Ping test failed")
358 i = 17
Jon Hall670808c2014-06-23 16:07:22 -0700359 result2 = main.FALSE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700360 elif ping == main.TRUE:
361 i = i + 1
Jon Hall670808c2014-06-23 16:07:22 -0700362 result2 = main.TRUE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700363 endTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700364 result = result and result2
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700365 if result == main.TRUE:
366 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
367 else:
368 main.log.report("\tPING TEST FAILED")
Jon Hallbb650fe2014-07-14 14:54:48 -0700369 main.ONOS1.show_intent(main.params['RestIP'])
Jon Hall670808c2014-06-23 16:07:22 -0700370 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
371 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700372
373# **********************************************************************************************************************************************************************************************
374#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
375
376 def CASE6(self,main) :
377 main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
378 import time
Jon Hall670808c2014-06-23 16:07:22 -0700379
Jon Hallbb650fe2014-07-14 14:54:48 -0700380 #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
381 time.sleep(10)
Jon Hall670808c2014-06-23 16:07:22 -0700382
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700383 main.case("Bringing Link down... ")
384 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
385 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
386
387 strtTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700388 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700389 for counter in range(9):
Jon Hall670808c2014-06-23 16:07:22 -0700390 if result1 == main.FALSE:
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700391 time.sleep(3)
Jon Hall670808c2014-06-23 16:07:22 -0700392 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700393 else:
Jon Hallbb650fe2014-07-14 14:54:48 -0700394 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
395 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
396 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700397 break
Jon Hall670808c2014-06-23 16:07:22 -0700398 utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700399
400 pingAttempts = main.params['pingAttempts']
401 pingSleep = main.params['pingSleep']
402
403 count = 1
404 i = 6
405 while i < 16 :
406 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
407 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
408 if ping == main.FALSE and count < int(pingAttempts):
409 count = count + 1
410 main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
Jon Hall0e09e6a2014-04-25 13:42:15 -0700411 #i = 6
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700412 time.sleep(int(pingSleep))
413 elif ping == main.FALSE and count == int(pingAttempts):
414 main.log.error("Ping test failed")
415 i = 17
Jon Hall670808c2014-06-23 16:07:22 -0700416 result2 = main.FALSE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700417 elif ping == main.TRUE:
418 i = i + 1
Jon Hall670808c2014-06-23 16:07:22 -0700419 result2 = main.TRUE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700420 endTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700421 result = result and result2 and result1
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700422 if result == main.TRUE:
423 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
424 else:
425 main.log.report("\tPING TEST FAILED")
Jon Hallbb650fe2014-07-14 14:54:48 -0700426 main.ONOS1.show_intent(main.params['RestIP'])
Jon Hall670808c2014-06-23 16:07:22 -0700427 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
428 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700429
430# **********************************************************************************************************************************************************************************************
431#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
432
433 def CASE7(self,main) :
434 main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
435 import time
436 main.case("Bringing Link up... ")
Jon Hall670808c2014-06-23 16:07:22 -0700437
Jon Hallbb650fe2014-07-14 14:54:48 -0700438 #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
439 time.sleep(10)
Jon Hall670808c2014-06-23 16:07:22 -0700440
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700441 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
442 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
443
444 strtTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700445 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700446 for counter in range(9):
Jon Hall670808c2014-06-23 16:07:22 -0700447 if result1 == main.FALSE:
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700448 time.sleep(3)
Jon Hall670808c2014-06-23 16:07:22 -0700449 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700450 else:
Jon Hallbb650fe2014-07-14 14:54:48 -0700451 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
452 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
453 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700454 break
Jon Hall670808c2014-06-23 16:07:22 -0700455 utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700456
457 pingAttempts = main.params['pingAttempts']
458 pingSleep = main.params['pingSleep']
459
460 strtTime = time.time()
461 count = 1
462 i = 6
463 while i < 16 :
464 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) )
465 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25))
466 if ping == main.FALSE and count < int(pingAttempts):
467 count = count + 1
468 main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
Jon Hall010f5412014-05-21 15:10:12 -0700469 #i = 6
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700470 time.sleep(int(pingSleep))
471 elif ping == main.FALSE and count == int(pingAttempts):
472 main.log.error("Ping test failed")
473 i = 17
Jon Hall670808c2014-06-23 16:07:22 -0700474 result2 = main.FALSE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700475 elif ping == main.TRUE:
476 i = i + 1
Jon Hall670808c2014-06-23 16:07:22 -0700477 result2 = main.TRUE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700478 endTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700479 result = result and result2 and result1
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700480 if result == main.TRUE:
481 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
482 else:
483 main.log.report("\tPING TESTS FAILED")
Jon Hallbb650fe2014-07-14 14:54:48 -0700484 main.ONOS1.show_intent(main.params['RestIP'])
Jon Hall010f5412014-05-21 15:10:12 -0700485
Jon Hallbb650fe2014-07-14 14:54:48 -0700486 print main.ONOS1.check_exceptions()
487 print main.ONOS2.check_exceptions()
488 print main.ONOS3.check_exceptions()
489 print main.ONOS4.check_exceptions()
Jon Hall010f5412014-05-21 15:10:12 -0700490
Jon Hall670808c2014-06-23 16:07:22 -0700491 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
492 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
493
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700494
Jon Hallf7947982014-05-22 10:44:45 -0700495# **********************************************************************************************************************************************************************************************
496# Runs reactive ping test
497 def CASE8(self,main) :
498 main.log.report("Reactive flow ping test:ping until the routes are active or fail after 10 attempts")
499 import time
500
501 strtTime = time.time()
502 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
503 for counter in range(9):
504 if result == main.FALSE:
505 time.sleep(3)
506 result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
507 else:
Jon Hallbb650fe2014-07-14 14:54:48 -0700508 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
509 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
510 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Hallf7947982014-05-22 10:44:45 -0700511 break
Jon Hall670808c2014-06-23 16:07:22 -0700512 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL")
Jon Hallf7947982014-05-22 10:44:45 -0700513
514 pingAttempts = main.params['pingAttempts']
515 pingSleep = main.params['pingSleep']
516
517 strtTime = time.time()
518 count = 1
519 i = 6
520 while i < 16 :
521 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
522 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
523 if ping == main.FALSE and count < int(pingAttempts):
524 count = count + 1
525 main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
526 #i = 6
527 time.sleep(int(pingSleep))
528 elif ping == main.FALSE and count == int(pingAttempts):
529 main.log.error("Ping test failed")
530 i = 17
Jon Hall670808c2014-06-23 16:07:22 -0700531 result2 = main.FALSE
Jon Hallf7947982014-05-22 10:44:45 -0700532 elif ping == main.TRUE:
533 i = i + 1
Jon Hall670808c2014-06-23 16:07:22 -0700534 result2 = main.TRUE
Jon Hallf7947982014-05-22 10:44:45 -0700535 endTime = time.time()
Jon Hall670808c2014-06-23 16:07:22 -0700536 result = result and result2
Jon Hallf7947982014-05-22 10:44:45 -0700537 if result == main.TRUE:
538 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
539 else:
540 main.log.report("\tPING TESTS FAILED")
Jon Hallbb650fe2014-07-14 14:54:48 -0700541 main.ONOS1.show_intent(main.params['RestIP'])
Jon Hallf7947982014-05-22 10:44:45 -0700542
Jon Hallbb650fe2014-07-14 14:54:48 -0700543 print main.ONOS1.check_exceptions()
544 print main.ONOS2.check_exceptions()
545 print main.ONOS3.check_exceptions()
546 print main.ONOS4.check_exceptions()
547
548 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
549 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
550# **********************************************************************************************************************************************************************************************
551#Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time
552# This is the same as case 6, but specifically for the reactive tests
553
554 def CASE61(self,main) :
555 main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts")
556 import time
557
558 #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
559 time.sleep(10)
560
561 main.case("Bringing Link down... ")
562 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down")
563 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...")
564
565 strtTime = time.time()
566 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
567 for counter in range(9):
568 if result1 == main.FALSE:
569 time.sleep(3)
570 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
571 else:
572 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
573 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
574 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2))
575 break
576 utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
577
578 pingAttempts = main.params['pingAttempts']
579 pingSleep = main.params['pingSleep']
580
581 count = 1
582 i = 6
583 while i < 16 :
584 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
585 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
586 if ping == main.FALSE and count < int(pingAttempts):
587 count = count + 1
588 main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds")
589 #i = 6
590 time.sleep(int(pingSleep))
591 elif ping == main.FALSE and count == int(pingAttempts):
592 main.log.error("Ping test failed")
593 i = 17
594 result2 = main.FALSE
595 elif ping == main.TRUE:
596 i = i + 1
597 result2 = main.TRUE
598 endTime = time.time()
599 result = result and result2 and result1
600 if result == main.TRUE:
601 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
602 else:
603 main.log.report("\tPING TEST FAILED")
604 main.ONOS1.show_intent(main.params['RestIP'])
605 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
606 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
607
608
609# **********************************************************************************************************************************************************************************************
610#Brings the link that Case 6 took down back up, then runs a ping test to view reroute time
611# Specifically for the Reactive tests
612
613 def CASE71(self,main) :
614 main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts")
615 import time
616 main.case("Bringing Link up... ")
617
618 #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute
619 time.sleep(10)
620
621 result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up")
622 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...")
623
624 strtTime = time.time()
625 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
626 for counter in range(9):
627 if result1 == main.FALSE:
628 time.sleep(3)
629 result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
630 else:
631 main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
632 main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
633 main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
634 break
635 utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL")
636
637 pingAttempts = main.params['pingAttempts']
638 pingSleep = main.params['pingSleep']
639
640 strtTime = time.time()
641 count = 1
642 i = 6
643 while i < 16 :
644 main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) )
645 ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i))
646 if ping == main.FALSE and count < int(pingAttempts):
647 count = count + 1
648 main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds")
649 #i = 6
650 time.sleep(int(pingSleep))
651 elif ping == main.FALSE and count == int(pingAttempts):
652 main.log.error("Ping test failed")
653 i = 17
654 result2 = main.FALSE
655 elif ping == main.TRUE:
656 i = i + 1
657 result2 = main.TRUE
658 endTime = time.time()
659 result = result and result2 and result1
660 if result == main.TRUE:
661 main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds")
662 else:
663 main.log.report("\tPING TESTS FAILED")
664 main.ONOS1.show_intent(main.params['RestIP'])
665
666 print main.ONOS1.check_exceptions()
667 print main.ONOS2.check_exceptions()
668 print main.ONOS3.check_exceptions()
669 print main.ONOS4.check_exceptions()
Jon Hallf7947982014-05-22 10:44:45 -0700670
Jon Hall670808c2014-06-23 16:07:22 -0700671 utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
672 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed")
Jon Hallf7947982014-05-22 10:44:45 -0700673
674
Jon Hallbb650fe2014-07-14 14:54:48 -0700675
676
Jon Hall670808c2014-06-23 16:07:22 -0700677# ******************************************************************************************************************************************************************
Jon Hallbb650fe2014-07-14 14:54:48 -0700678# Check for ONOS Components health
Jon Hall670808c2014-06-23 16:07:22 -0700679
680 def CASE9(self,main) :
681 main.case("Checking component status")
682 result = main.TRUE
683
684 main.step("Checking Zookeeper status")
685 result1 = main.Zookeeper1.status()
686 if not result1:
687 main.log.report("Zookeeper1 encountered a tragic death!")
688 result2 = main.Zookeeper2.status()
689 if not result2:
690 main.log.report("Zookeeper2 encountered a tragic death!")
691 result3 = main.Zookeeper3.status()
692 if not result3:
693 main.log.report("Zookeeper3 encountered a tragic death!")
694 result4 = main.Zookeeper4.status()
695 if not result4:
696 main.log.report("Zookeeper4 encountered a tragic death!")
697 result = result and result1 and result2 and result3 and result4
698
699 main.step("Checking RamCloud status")
700 result5 = main.RamCloud1.status_coor()
701 if not result5:
702 main.log.report("RamCloud Coordinator1 encountered a tragic death!")
703 result6 = main.RamCloud1.status_serv()
704 if not result6:
705 main.log.report("RamCloud Server1 encountered a tragic death!")
706 result7 = main.RamCloud2.status_serv()
707 if not result7:
708 main.log.report("RamCloud Server2 encountered a tragic death!")
709 result8 = main.RamCloud3.status_serv()
710 if not result8:
711 main.log.report("RamCloud Server3 encountered a tragic death!")
712 result9 = main.RamCloud4.status_serv()
713 if not result9:
714 main.log.report("RamCloud Server4 encountered a tragic death!")
715 result = result and result5 and result6 and result7 and result8 and result9
716
717
718 main.step("Checking ONOS status")
719 result10 = main.ONOS1.status()
720 if not result10:
721 main.log.report("ONOS1 core encountered a tragic death!")
722 result11 = main.ONOS2.status()
723 if not result11:
724 main.log.report("ONOS2 core encountered a tragic death!")
725 result12 = main.ONOS3.status()
726 if not result12:
727 main.log.report("ONOS3 core encountered a tragic death!")
728 result13 = main.ONOS4.status()
729 if not result13:
730 main.log.report("ONOS4 core encountered a tragic death!")
731 result = result and result10 and result11 and result12 and result13
732
733
734
735 rest_result = main.ONOS1.rest_status()
736 if not rest_result:
737 main.log.report("Simple Rest GUI server is not running on ONOS1")
738
739
740 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="All Components are running",onfail="One or more components failed")
Jon Hallf7947982014-05-22 10:44:45 -0700741
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700742# ******************************************************************************************************************************************************************
743# Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch
744
745 def CASE21(self,main) :
746 import json
Jon Hallbb650fe2014-07-14 14:54:48 -0700747 main.log.report("Test device discovery function, by attach, detach, and move host h1 from s1->s6->s1. Per mininet naming, the name of the switch port the host attaches to will remain as 's1-eth1' throughout the test.")
748 main.log.report("Check initially hostMAC/IP exist on the mininet...")
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700749 host = main.params['YANK']['hostname']
750 mac = main.params['YANK']['hostmac']
751 RestIP1 = main.params['RESTCALL']['restIP1']
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700752 RestPort = main.params['RESTCALL']['restPort']
753 url = main.params['RESTCALL']['restURL']
Jon Hallbb650fe2014-07-14 14:54:48 -0700754
755 t_topowait = 5
756 t_restwait = 0
757 main.log.report( "Wait time from topo change to ping set to " + str(t_topowait))
758 main.log.report( "Wait time from ping to rest call set to " + str(t_restwait))
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700759 #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort)
Jon Hallbb650fe2014-07-14 14:54:48 -0700760 time.sleep(t_topowait)
761 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" )
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700762 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
Jon Hallbb650fe2014-07-14 14:54:48 -0700763 time.sleep(t_restwait)
764 Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
765 main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus))
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700766 if Reststatus == 1:
Jon Hallbb650fe2014-07-14 14:54:48 -0700767 main.log.report("\t PASSED - Found host mac = " + mac + "; attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0]))
768 result1 = main.TRUE
769 elif Reststatus > 1:
770 main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac addresses. FAILED")
771 main.log.report("switches are: " + "; ".join(Switch))
772 main.log.report("Ports are: " + "; ".join(Port))
773 result1 = main.FALSE
774 elif Reststatus == 0 and Switch == []:
775 main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED")
776 result1 = main.FALSE
777 else:# check if rest server is working
778 main.log.error("Issue with find host")
779 result1 = main.FALSE
780
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700781
782 ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 #####
783
784 main.log.report("Yank out s1-eth1")
785 main.case("Yankout s6-eth1 (link to h1) from s1")
786 result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf'])
Jon Hallbb650fe2014-07-14 14:54:48 -0700787 time.sleep(t_topowait)
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700788 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...")
Jon Hallbb650fe2014-07-14 14:54:48 -0700789
790 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" )
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700791 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
Jon Hallbb650fe2014-07-14 14:54:48 -0700792 time.sleep(t_restwait)
793 Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
794
795 main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus))
796 if Reststatus == 1:
797 main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port))
798 result2 = main.FALSE
799 elif Reststatus > 1:
800 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
801 main.log.report("switches are: " + "; ".join(Switch))
802 main.log.report("Ports are: " + "; ".join(Port))
803 main.log.report("MACs are: " + "; ".join(MAC))
804 result2 = main.FALSE
805 elif Reststatus == 0 and Switch == []:
806 main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.")
807 result2 = main.TRUE
808 else:# check if rest server is working
809 main.log.error("Issue with find host")
810 result2 = main.FALSE
811
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700812 ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ######
813 main.log.report("Plug s1-eth1 into s6")
814 main.case("Plug s1-eth1 to s6")
815 result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf'])
Jon Hallbb650fe2014-07-14 14:54:48 -0700816 time.sleep(t_topowait)
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700817 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...")
Jon Hallbb650fe2014-07-14 14:54:48 -0700818 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" )
819
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700820 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
Jon Hallbb650fe2014-07-14 14:54:48 -0700821 time.sleep(t_restwait)
822 Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
823
824 main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus))
825 if Reststatus == 1:
826 main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
827 result3 = main.TRUE
828 elif Reststatus > 1:
829 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED")
830 main.log.report("switches are: " + "; ".join(Switch))
831 main.log.report("Ports are: " + "; ".join(Port))
832 main.log.report("MACs are: " + "; ".join(MAC))
833 result3 = main.FALSE
834 elif Reststatus == 0 and Switch == []:
835 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
836 result3 = main.FALSE
837 else:# check if rest server is working
838 main.log.error("Issue with find host")
839 result3 = main.FALSE
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700840
841 ###### Step to put interface "s1-eth1" back to s1"#####
842 main.log.report("Move s1-eth1 back on to s1")
843 main.case("Move s1-eth1 back to s1")
844 result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf'])
Jon Hallbb650fe2014-07-14 14:54:48 -0700845 time.sleep(t_topowait)
846 result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf'])
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700847 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...")
Jon Hallbb650fe2014-07-14 14:54:48 -0700848 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" )
849
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700850 ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254")
Jon Hallbb650fe2014-07-14 14:54:48 -0700851 time.sleep(t_restwait)
852 Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac)
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700853
Jon Hallbb650fe2014-07-14 14:54:48 -0700854 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
855 if Reststatus == 1:
856 main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0]))
857 result4 = main.TRUE
858 elif Reststatus > 1:
859 main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED")
860 main.log.report("switches are: " + "; ".join(Switch))
861 main.log.report("Ports are: " + "; ".join(Port))
862 main.log.report("MACs are: " + "; ".join(MAC))
863 result4 = main.FALSE
864 elif Reststatus == 0 and Switch == []:
865 main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED")
866 result4 = main.FALSE
867 else:# check if rest server is working
868 main.log.error("Issue with find host")
869 result4 = main.FALSE
870 time.sleep(20)
871 Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac)
872 main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus))
873 if Reststatus ==1:
874 main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout")
875 elif Reststatus>1:
876 main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)")
877 elif Reststatus==0:
878 main.log.report("\t PASSED - Device cleared after timeout")
879
880 result = result1 and result2 and result3 and result4
SeanCorcoranc3ed7432014-04-09 16:32:27 -0700881 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED")
882