blob: 970945432b8c83400f96dda4cd0bf4458ad2768c [file] [log] [blame]
admincb593912014-04-14 10:34:41 -07001
2class RCOnosScale4nodes:
3
4 def __init__(self) :
5 self.default = ''
6
7 def CASE1(self,main) :
8 '''
9 First case is to simply check if ONOS, ZK, and RamCloud are all running properly.
10 If ONOS if not running properly, it will restart ONOS once before continuing.
11 It will then check if the ONOS has a view of all the switches and links as defined in the params file.
12 The test will only pass if ONOS is running properly, and has a full view of all topology elements.
13 '''
14 import time
15 main.ONOS1.stop()
16 main.ONOS2.stop()
17 main.ONOS3.stop()
18 main.ONOS4.stop()
adminaef00552014-05-08 09:18:36 -070019 main.RamCloud1.stop_coor()
20 main.RamCloud1.stop_serv()
21 main.RamCloud2.stop_serv()
22 main.RamCloud3.stop_serv()
23 main.RamCloud4.stop_serv()
Jon Hall1c4d2742014-05-22 10:57:05 -070024 main.Zookeeper1.start()
25 main.Zookeeper2.start()
26 main.Zookeeper3.start()
27 main.Zookeeper4.start()
Jon Hallde7bbe82014-05-23 17:04:31 -070028 time.sleep(10)
admin1723f1c2014-05-19 16:08:39 -070029 main.RamCloud1.del_db()
30 main.RamCloud2.del_db()
31 main.RamCloud3.del_db()
32 main.RamCloud4.del_db()
admin1723f1c2014-05-19 16:08:39 -070033
admincb593912014-04-14 10:34:41 -070034 main.RamCloud1.start_coor()
Jon Hall76f2c462014-04-17 11:37:15 -070035 time.sleep(10)
admincb593912014-04-14 10:34:41 -070036 main.RamCloud1.start_serv()
37 main.RamCloud2.start_serv()
38 main.RamCloud3.start_serv()
39 main.RamCloud4.start_serv()
40 time.sleep(20)
admincb593912014-04-14 10:34:41 -070041 main.ONOS1.start()
42 time.sleep(10)
43 main.ONOS2.start()
44 main.ONOS3.start()
45 main.ONOS4.start()
46 main.ONOS1.start_rest()
47 time.sleep(5)
48 test= main.ONOS1.rest_status()
49 if test == main.FALSE:
50 main.ONOS1.start_rest()
51 main.ONOS1.get_version()
52 main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
53 main.case("Checking if the startup was clean...")
54 main.step("Testing startup Zookeeper")
55 data = main.Zookeeper1.isup()
56 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
57 main.step("Testing startup RamCloud")
adminc6cfc1c2014-04-21 13:55:21 -070058 data = main.RamCloud1.status_serv()
admincb593912014-04-14 10:34:41 -070059 if data == main.FALSE:
60 main.RamCloud1.stop_coor()
61 main.RamCloud1.stop_serv()
62 main.RamCloud2.stop_serv()
63 main.RamCloud3.stop_serv()
64 main.RamCloud4.stop_serv()
Jon Halle00b7e42014-05-23 12:00:33 -070065 main.RamCloud1.del_db()
66 main.RamCloud2.del_db()
67 main.RamCloud3.del_db()
68 main.RamCloud4.del_db()
admincb593912014-04-14 10:34:41 -070069
70 time.sleep(5)
71
72 main.RamCloud1.start_coor()
73 main.RamCloud1.start_serv()
74 main.RamCloud2.start_serv()
75 main.RamCloud3.start_serv()
76 main.RamCloud4.start_serv()
Jon Hall76f2c462014-04-17 11:37:15 -070077 data = main.RamCloud1.isup()
admincb593912014-04-14 10:34:41 -070078 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
79 main.step("Testing startup ONOS")
Jon Hallde7bbe82014-05-23 17:04:31 -070080 time.sleep(10)
admincb593912014-04-14 10:34:41 -070081 data = main.ONOS1.isup()
82 data = data and main.ONOS2.isup()
83 data = data and main.ONOS3.isup()
84 data = data and main.ONOS4.isup()
85 if data == main.FALSE:
86 main.log.report("Something is funny... restarting ONOS")
admincb593912014-04-14 10:34:41 -070087 time.sleep(10)
admincb593912014-04-14 10:34:41 -070088 data = main.ONOS1.isup()
Jon Hallde7bbe82014-05-23 17:04:31 -070089 data = data and main.ONOS2.isup()
90 data = data and main.ONOS3.isup()
91 data = data and main.ONOS4.isup()
92
admincb593912014-04-14 10:34:41 -070093 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
94
95 def CASE2(self,main) :
96 '''
97 Second case is to time the convergence time of a topology for ONOS.
98 It shuts down the ONOS, drops keyspace, starts ONOS...
99 Then it points all the mininet switches at the ONOS node and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
100 '''
101 import time
102 main.log.report("Time convergence for switches -> single ONOS node in cluster")
103 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
104 main.step("Bringing ONOS down...")
105 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700106 for i in range(1,int(main.params['NR_Switches'])+1):
Jon Hallde7bbe82014-05-23 17:04:31 -0700107 main.Mininet1.delete_sw_controller("s"+str(i))
admincb593912014-04-14 10:34:41 -0700108 main.log.info("bringing ONOS down")
109 main.ONOS1.stop()
110 main.ONOS2.stop()
111 main.ONOS3.stop()
112 main.ONOS4.stop()
Jon Hall76f2c462014-04-17 11:37:15 -0700113 main.RamCloud1.stop_coor()
114 main.RamCloud1.stop_serv()
115 main.RamCloud2.stop_serv()
116 main.RamCloud3.stop_serv()
117 main.RamCloud4.stop_serv()
Jon Hallde7bbe82014-05-23 17:04:31 -0700118 main.Zookeeper1.start()
119 main.Zookeeper2.start()
120 main.Zookeeper3.start()
121 main.Zookeeper4.start()
122 time.sleep(4)
Jon Halle00b7e42014-05-23 12:00:33 -0700123 main.RamCloud1.del_db()
124 main.RamCloud2.del_db()
125 main.RamCloud3.del_db()
126 main.RamCloud4.del_db()
Jon Hall76f2c462014-04-17 11:37:15 -0700127
admincb593912014-04-14 10:34:41 -0700128 time.sleep(5)
Jon Hall76f2c462014-04-17 11:37:15 -0700129
130 main.RamCloud1.start_coor()
131 main.RamCloud1.start_serv()
132 main.RamCloud2.start_serv()
133 main.RamCloud3.start_serv()
134 main.RamCloud4.start_serv()
135
admincb593912014-04-14 10:34:41 -0700136 main.log.info("Bringing ONOS up")
137 main.ONOS1.start()
138 time.sleep(5)
139 main.ONOS2.start()
140 main.ONOS3.start()
141 main.ONOS4.start()
Jon Halle00b7e42014-05-23 12:00:33 -0700142 time.sleep(10)
Jon Hallde7bbe82014-05-23 17:04:31 -0700143 data = main.ONOS1.isup()
144 data = data and main.ONOS2.isup()
145 data = data and main.ONOS3.isup()
146 data = data and main.ONOS4.isup()
147 if data == main.FALSE:
148 main.log.report("Something is funny... restarting ONOS")
149 time.sleep(10)
150 data = main.ONOS1.isup()
151 data = data and main.ONOS2.isup()
152 data = data and main.ONOS3.isup()
153 data = data and main.ONOS4.isup()
154 if data == main.FALSE:
155 main.log.report("Something is funny... restarting ONOS")
admincb593912014-04-14 10:34:41 -0700156 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Halle00b7e42014-05-23 12:00:33 -0700157
admincb593912014-04-14 10:34:41 -0700158 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700159 for i in range(1,int(main.params['NR_Switches'])+1):
160 main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
161
162
163
Jon Hallde7bbe82014-05-23 17:04:31 -0700164 t1 = time.time()
admincb593912014-04-14 10:34:41 -0700165 for i in range(15) :
166 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
167 if result == 1 :
168 break
169 else :
170 time.sleep(1)
171 t2 = time.time()
172 conv_time = t2 - t1
173 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
174 if result == 1 :
175 main.log.report( "Convergence time of : %f seconds" % conv_time )
176 if float(conv_time) < float(main.params['TargetTime']) :
177 test=main.TRUE
178 main.log.info("Time is less then supplied target time")
179 else:
180 test=main.FALSE
181 main.log.info("Time is greater then supplied target time")
182 else :
183 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
184 test=main.FALSE
185
186 utilities.assert_equals(expect=main.TRUE,actual=test)
187
188 def CASE3(self,main) :
189 '''
190 Second case is to time the convergence time of a topology for ONOS.
191 It shuts down the ONOS, drops keyspace, starts ONOS...
192 Then it points all the mininet switches at all ONOS nodes and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
193 '''
194 import time
195 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
196 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
197 main.step("Bringing ONOS down...")
198 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700199 for i in range(1,int(main.params['NR_Switches'])+1):
Jon Hallde7bbe82014-05-23 17:04:31 -0700200 main.Mininet1.delete_sw_controller("s"+str(i))
admincb593912014-04-14 10:34:41 -0700201 main.log.info("bringing ONOS down")
202 main.ONOS1.stop()
203 main.ONOS2.stop()
204 main.ONOS3.stop()
205 main.ONOS4.stop()
206 #main.log.info("Dropping keyspace...")
207 #main.ONOS1.drop_keyspace()
208 time.sleep(5)
209 main.log.info("Bringing ONOS up")
210 main.ONOS1.start()
211 time.sleep(5)
212 main.ONOS2.start()
213 main.ONOS2.start_rest()
214 main.ONOS3.start()
215 main.ONOS4.start()
216 main.ONOS1.isup()
217 main.ONOS2.isup()
218 main.ONOS3.isup()
219 main.ONOS4.isup()
220 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
221 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700222 for i in range(1,int(main.params['NR_Switches'])+1):
223 main.Mininet1.assign_sw_controller(sw=str(i),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'])
admincb593912014-04-14 10:34:41 -0700224 t1 = time.time()
225 for i in range(15) :
226 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
227 if result == 1 :
228 break
229 else :
230 time.sleep(1)
231 t2 = time.time()
232 conv_time = t2 - t1
233 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
234 if result == 1 :
235 main.log.report( "Convergence time of : %f seconds" % conv_time )
236 if float(conv_time) < float(main.params['TargetTime']) :
237 test=main.TRUE
238 main.log.info("Time is less then supplied target time")
239 else:
240 test=main.FALSE
241 main.log.info("Time is greater then supplied target time")
242 else :
243 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
244 test=main.FALSE
245
246 utilities.assert_equals(expect=main.TRUE,actual=test)
247
248 def CASE4(self,main) :
249 '''
250 Second case is to time the convergence time of a topology for ONOS.
251 It shuts down the ONOS, drops keyspace, starts ONOS...
252 Then it evenly points all mininet switches to all ONOS nodes, but only one node, and times how long it take for the ONOS rest call to reflect the correct count of switches and links.
253 '''
254 import time
255 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
256 main.case("Timing Onos Convergence for even single controller distribution")
257 main.step("Bringing ONOS down...")
258 main.log.info("all switch no controllers")
Jon Hallde7bbe82014-05-23 17:04:31 -0700259 for i in range(1,int(main.params['NR_Switches'])+1):
260 main.Mininet1.delete_sw_controller("s"+str(i))
admincb593912014-04-14 10:34:41 -0700261 main.log.info("bringing ONOS down")
262 main.ONOS1.stop()
263 main.ONOS2.stop()
264 main.ONOS3.stop()
265 main.ONOS4.stop()
266 #main.log.info("Dropping keyspace...")
267 #main.ONOS1.drop_keyspace()
268 time.sleep(5)
269 main.log.info("Bringing ONOS up")
270 main.ONOS1.start()
271 time.sleep(5)
272 main.ONOS2.start()
273 main.ONOS2.start_rest()
274 main.ONOS3.start()
275 main.ONOS4.start()
276 main.ONOS1.isup()
277 main.ONOS2.isup()
278 main.ONOS3.isup()
279 main.ONOS4.isup()
280 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Halle00b7e42014-05-23 12:00:33 -0700281
282
admincb593912014-04-14 10:34:41 -0700283 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700284 count = 0
285 for i in range(1,int(main.params['NR_Switches'])+1):
Jon Hallde7bbe82014-05-23 17:04:31 -0700286 num = (count % 4)+1
Jon Halle00b7e42014-05-23 12:00:33 -0700287 #num = count % len(controllers) #TODO: check number of controllers in cluster
288 main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip'+str(num)],port1=main.params['CTRL']['port'+str(num)])
289 count = count + 1
290
291
admincb593912014-04-14 10:34:41 -0700292 t1 = time.time()
293 for i in range(15) :
294 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
295 if result == 1 :
296 break
297 else :
298 time.sleep(1)
299 t2 = time.time()
300 conv_time = t2 - t1
301 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
302 if result == 1 :
303 main.log.report( "Convergence time of : %f seconds" % conv_time )
304 if float(conv_time) < float(main.params['TargetTime']) :
305 test=main.TRUE
306 main.log.info("Time is less then supplied target time")
307 else:
308 test=main.FALSE
309 main.log.info("Time is greater then supplied target time")
310 else :
311 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
312 test=main.FALSE
313
314 utilities.assert_equals(expect=main.TRUE,actual=test)
315
Jon Hall1c4d2742014-05-22 10:57:05 -0700316 def CASE66(self, main):
admin1723f1c2014-05-19 16:08:39 -0700317 main.log.report("Checking ONOS logs for exceptions")
Jon Hall1c4d2742014-05-22 10:57:05 -0700318 count = 0
admin1723f1c2014-05-19 16:08:39 -0700319 check1 = main.ONOS1.check_exceptions()
320 main.log.report("Exceptions in ONOS1 logs: \n" + check1)
321 check2 = main.ONOS2.check_exceptions()
322 main.log.report("Exceptions in ONOS2 logs: \n" + check2)
323 check3 = main.ONOS3.check_exceptions()
324 main.log.report("Exceptions in ONOS3 logs: \n" + check3)
325 check4 = main.ONOS4.check_exceptions()
326 main.log.report("Exceptions in ONOS4 logs: \n" + check4)
Jon Hall1c4d2742014-05-22 10:57:05 -0700327 result = main.TRUE
admin1723f1c2014-05-19 16:08:39 -0700328 if (check1 or check2 or check3 or check4):
Jon Hall1c4d2742014-05-22 10:57:05 -0700329 result = main.FALSE
330 count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
331 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
admin1723f1c2014-05-19 16:08:39 -0700332
Jon Hall1c4d2742014-05-22 10:57:05 -0700333