blob: 243eeacc1656aede89cfa28e8af8ab2bced18c09 [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
Jon Hallbd795bf2014-06-18 09:46:32 -070015 main.case("Initial setup")
16 main.step("stopping ONOS")
admincb593912014-04-14 10:34:41 -070017 main.ONOS1.stop()
18 main.ONOS2.stop()
19 main.ONOS3.stop()
20 main.ONOS4.stop()
adminaef00552014-05-08 09:18:36 -070021 main.RamCloud1.stop_coor()
22 main.RamCloud1.stop_serv()
23 main.RamCloud2.stop_serv()
24 main.RamCloud3.stop_serv()
25 main.RamCloud4.stop_serv()
Jon Hallbd795bf2014-06-18 09:46:32 -070026 main.step("Start tcpdump on mn")
27 main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
admin41d6b772014-06-24 15:59:50 -070028# main.step("Start tcpdump on mn")
29# main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port'])
Jon Hallbd795bf2014-06-18 09:46:32 -070030 main.step("Starting ONOS")
Jon Hall1c4d2742014-05-22 10:57:05 -070031 main.Zookeeper1.start()
32 main.Zookeeper2.start()
33 main.Zookeeper3.start()
34 main.Zookeeper4.start()
Jon Hallde7bbe82014-05-23 17:04:31 -070035 time.sleep(10)
admin1723f1c2014-05-19 16:08:39 -070036 main.RamCloud1.del_db()
37 main.RamCloud2.del_db()
38 main.RamCloud3.del_db()
39 main.RamCloud4.del_db()
admin1723f1c2014-05-19 16:08:39 -070040
admincb593912014-04-14 10:34:41 -070041 main.RamCloud1.start_coor()
Jon Hall76f2c462014-04-17 11:37:15 -070042 time.sleep(10)
admincb593912014-04-14 10:34:41 -070043 main.RamCloud1.start_serv()
44 main.RamCloud2.start_serv()
45 main.RamCloud3.start_serv()
46 main.RamCloud4.start_serv()
47 time.sleep(20)
admincb593912014-04-14 10:34:41 -070048 main.ONOS1.start()
49 time.sleep(10)
50 main.ONOS2.start()
51 main.ONOS3.start()
52 main.ONOS4.start()
53 main.ONOS1.start_rest()
54 time.sleep(5)
55 test= main.ONOS1.rest_status()
56 if test == main.FALSE:
57 main.ONOS1.start_rest()
58 main.ONOS1.get_version()
59 main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
admincb593912014-04-14 10:34:41 -070060 main.step("Testing startup Zookeeper")
61 data = main.Zookeeper1.isup()
62 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
63 main.step("Testing startup RamCloud")
adminc6cfc1c2014-04-21 13:55:21 -070064 data = main.RamCloud1.status_serv()
admincb593912014-04-14 10:34:41 -070065 if data == main.FALSE:
66 main.RamCloud1.stop_coor()
67 main.RamCloud1.stop_serv()
68 main.RamCloud2.stop_serv()
69 main.RamCloud3.stop_serv()
70 main.RamCloud4.stop_serv()
Jon Halle00b7e42014-05-23 12:00:33 -070071 main.RamCloud1.del_db()
72 main.RamCloud2.del_db()
73 main.RamCloud3.del_db()
74 main.RamCloud4.del_db()
admincb593912014-04-14 10:34:41 -070075
76 time.sleep(5)
77
78 main.RamCloud1.start_coor()
79 main.RamCloud1.start_serv()
80 main.RamCloud2.start_serv()
81 main.RamCloud3.start_serv()
82 main.RamCloud4.start_serv()
Jon Hall76f2c462014-04-17 11:37:15 -070083 data = main.RamCloud1.isup()
admincb593912014-04-14 10:34:41 -070084 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
85 main.step("Testing startup ONOS")
Jon Hallde7bbe82014-05-23 17:04:31 -070086 time.sleep(10)
admincb593912014-04-14 10:34:41 -070087 data = main.ONOS1.isup()
88 data = data and main.ONOS2.isup()
89 data = data and main.ONOS3.isup()
90 data = data and main.ONOS4.isup()
91 if data == main.FALSE:
92 main.log.report("Something is funny... restarting ONOS")
admincb593912014-04-14 10:34:41 -070093 time.sleep(10)
admincb593912014-04-14 10:34:41 -070094 data = main.ONOS1.isup()
Jon Hallde7bbe82014-05-23 17:04:31 -070095 data = data and main.ONOS2.isup()
96 data = data and main.ONOS3.isup()
97 data = data and main.ONOS4.isup()
98
admincb593912014-04-14 10:34:41 -070099 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
100
101 def CASE2(self,main) :
102 '''
103 Second case is to time the convergence time of a topology for ONOS.
104 It shuts down the ONOS, drops keyspace, starts ONOS...
105 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.
106 '''
107 import time
108 main.log.report("Time convergence for switches -> single ONOS node in cluster")
109 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
110 main.step("Bringing ONOS down...")
111 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700112 for i in range(1,int(main.params['NR_Switches'])+1):
Jon Hallde7bbe82014-05-23 17:04:31 -0700113 main.Mininet1.delete_sw_controller("s"+str(i))
admincb593912014-04-14 10:34:41 -0700114 main.log.info("bringing ONOS down")
115 main.ONOS1.stop()
116 main.ONOS2.stop()
117 main.ONOS3.stop()
118 main.ONOS4.stop()
Jon Hall76f2c462014-04-17 11:37:15 -0700119 main.RamCloud1.stop_coor()
120 main.RamCloud1.stop_serv()
121 main.RamCloud2.stop_serv()
122 main.RamCloud3.stop_serv()
123 main.RamCloud4.stop_serv()
Jon Hallde7bbe82014-05-23 17:04:31 -0700124 main.Zookeeper1.start()
125 main.Zookeeper2.start()
126 main.Zookeeper3.start()
127 main.Zookeeper4.start()
128 time.sleep(4)
Jon Halle00b7e42014-05-23 12:00:33 -0700129 main.RamCloud1.del_db()
130 main.RamCloud2.del_db()
131 main.RamCloud3.del_db()
132 main.RamCloud4.del_db()
Jon Hall76f2c462014-04-17 11:37:15 -0700133
admincb593912014-04-14 10:34:41 -0700134 time.sleep(5)
Jon Hall76f2c462014-04-17 11:37:15 -0700135
136 main.RamCloud1.start_coor()
137 main.RamCloud1.start_serv()
138 main.RamCloud2.start_serv()
139 main.RamCloud3.start_serv()
140 main.RamCloud4.start_serv()
141
admincb593912014-04-14 10:34:41 -0700142 main.log.info("Bringing ONOS up")
143 main.ONOS1.start()
144 time.sleep(5)
145 main.ONOS2.start()
146 main.ONOS3.start()
147 main.ONOS4.start()
Jon Halle00b7e42014-05-23 12:00:33 -0700148 time.sleep(10)
Jon Hallde7bbe82014-05-23 17:04:31 -0700149 data = main.ONOS1.isup()
150 data = data and main.ONOS2.isup()
151 data = data and main.ONOS3.isup()
152 data = data and main.ONOS4.isup()
153 if data == main.FALSE:
154 main.log.report("Something is funny... restarting ONOS")
155 time.sleep(10)
156 data = main.ONOS1.isup()
157 data = data and main.ONOS2.isup()
158 data = data and main.ONOS3.isup()
159 data = data and main.ONOS4.isup()
160 if data == main.FALSE:
161 main.log.report("Something is funny... restarting ONOS")
admincb593912014-04-14 10:34:41 -0700162 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Halle00b7e42014-05-23 12:00:33 -0700163
admincb593912014-04-14 10:34:41 -0700164 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700165 for i in range(1,int(main.params['NR_Switches'])+1):
166 main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
167
168
169
Jon Hallde7bbe82014-05-23 17:04:31 -0700170 t1 = time.time()
admincb593912014-04-14 10:34:41 -0700171 for i in range(15) :
172 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
173 if result == 1 :
174 break
175 else :
176 time.sleep(1)
177 t2 = time.time()
178 conv_time = t2 - t1
179 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
180 if result == 1 :
181 main.log.report( "Convergence time of : %f seconds" % conv_time )
182 if float(conv_time) < float(main.params['TargetTime']) :
183 test=main.TRUE
184 main.log.info("Time is less then supplied target time")
185 else:
186 test=main.FALSE
187 main.log.info("Time is greater then supplied target time")
188 else :
189 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
190 test=main.FALSE
191
192 utilities.assert_equals(expect=main.TRUE,actual=test)
193
194 def CASE3(self,main) :
195 '''
196 Second case is to time the convergence time of a topology for ONOS.
197 It shuts down the ONOS, drops keyspace, starts ONOS...
198 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.
199 '''
200 import time
201 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
202 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
203 main.step("Bringing ONOS down...")
204 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700205 for i in range(1,int(main.params['NR_Switches'])+1):
Jon Hallde7bbe82014-05-23 17:04:31 -0700206 main.Mininet1.delete_sw_controller("s"+str(i))
admincb593912014-04-14 10:34:41 -0700207 main.log.info("bringing ONOS down")
208 main.ONOS1.stop()
209 main.ONOS2.stop()
210 main.ONOS3.stop()
211 main.ONOS4.stop()
212 #main.log.info("Dropping keyspace...")
213 #main.ONOS1.drop_keyspace()
214 time.sleep(5)
215 main.log.info("Bringing ONOS up")
216 main.ONOS1.start()
217 time.sleep(5)
218 main.ONOS2.start()
219 main.ONOS2.start_rest()
220 main.ONOS3.start()
221 main.ONOS4.start()
222 main.ONOS1.isup()
223 main.ONOS2.isup()
224 main.ONOS3.isup()
225 main.ONOS4.isup()
226 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
227 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700228 for i in range(1,int(main.params['NR_Switches'])+1):
229 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 -0700230 t1 = time.time()
231 for i in range(15) :
232 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
233 if result == 1 :
234 break
235 else :
236 time.sleep(1)
237 t2 = time.time()
238 conv_time = t2 - t1
239 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
240 if result == 1 :
241 main.log.report( "Convergence time of : %f seconds" % conv_time )
242 if float(conv_time) < float(main.params['TargetTime']) :
243 test=main.TRUE
244 main.log.info("Time is less then supplied target time")
245 else:
246 test=main.FALSE
247 main.log.info("Time is greater then supplied target time")
248 else :
249 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
250 test=main.FALSE
251
252 utilities.assert_equals(expect=main.TRUE,actual=test)
253
254 def CASE4(self,main) :
255 '''
256 Second case is to time the convergence time of a topology for ONOS.
257 It shuts down the ONOS, drops keyspace, starts ONOS...
258 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.
259 '''
260 import time
261 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
262 main.case("Timing Onos Convergence for even single controller distribution")
263 main.step("Bringing ONOS down...")
264 main.log.info("all switch no controllers")
Jon Hallde7bbe82014-05-23 17:04:31 -0700265 for i in range(1,int(main.params['NR_Switches'])+1):
266 main.Mininet1.delete_sw_controller("s"+str(i))
admincb593912014-04-14 10:34:41 -0700267 main.log.info("bringing ONOS down")
268 main.ONOS1.stop()
269 main.ONOS2.stop()
270 main.ONOS3.stop()
271 main.ONOS4.stop()
272 #main.log.info("Dropping keyspace...")
273 #main.ONOS1.drop_keyspace()
274 time.sleep(5)
275 main.log.info("Bringing ONOS up")
276 main.ONOS1.start()
277 time.sleep(5)
278 main.ONOS2.start()
279 main.ONOS2.start_rest()
280 main.ONOS3.start()
281 main.ONOS4.start()
282 main.ONOS1.isup()
283 main.ONOS2.isup()
284 main.ONOS3.isup()
285 main.ONOS4.isup()
286 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Halle00b7e42014-05-23 12:00:33 -0700287
288
admincb593912014-04-14 10:34:41 -0700289 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700290 count = 0
291 for i in range(1,int(main.params['NR_Switches'])+1):
Jon Hallde7bbe82014-05-23 17:04:31 -0700292 num = (count % 4)+1
Jon Halle00b7e42014-05-23 12:00:33 -0700293 #num = count % len(controllers) #TODO: check number of controllers in cluster
294 main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip'+str(num)],port1=main.params['CTRL']['port'+str(num)])
295 count = count + 1
296
297
admincb593912014-04-14 10:34:41 -0700298 t1 = time.time()
299 for i in range(15) :
300 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
301 if result == 1 :
302 break
303 else :
304 time.sleep(1)
305 t2 = time.time()
306 conv_time = t2 - t1
307 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
308 if result == 1 :
309 main.log.report( "Convergence time of : %f seconds" % conv_time )
310 if float(conv_time) < float(main.params['TargetTime']) :
311 test=main.TRUE
312 main.log.info("Time is less then supplied target time")
313 else:
314 test=main.FALSE
315 main.log.info("Time is greater then supplied target time")
316 else :
317 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
318 test=main.FALSE
319
320 utilities.assert_equals(expect=main.TRUE,actual=test)
321
Jon Hall1c4d2742014-05-22 10:57:05 -0700322 def CASE66(self, main):
admin1723f1c2014-05-19 16:08:39 -0700323 main.log.report("Checking ONOS logs for exceptions")
Jon Hall1c4d2742014-05-22 10:57:05 -0700324 count = 0
admin1723f1c2014-05-19 16:08:39 -0700325 check1 = main.ONOS1.check_exceptions()
326 main.log.report("Exceptions in ONOS1 logs: \n" + check1)
327 check2 = main.ONOS2.check_exceptions()
328 main.log.report("Exceptions in ONOS2 logs: \n" + check2)
329 check3 = main.ONOS3.check_exceptions()
330 main.log.report("Exceptions in ONOS3 logs: \n" + check3)
331 check4 = main.ONOS4.check_exceptions()
332 main.log.report("Exceptions in ONOS4 logs: \n" + check4)
Jon Hall1c4d2742014-05-22 10:57:05 -0700333 result = main.TRUE
admin1723f1c2014-05-19 16:08:39 -0700334 if (check1 or check2 or check3 or check4):
Jon Hall1c4d2742014-05-22 10:57:05 -0700335 result = main.FALSE
336 count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
337 utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs")
Jon Hallbd795bf2014-06-18 09:46:32 -0700338 main.Mininet1.stop_tcpdump()
admin1723f1c2014-05-19 16:08:39 -0700339
Jon Hall1c4d2742014-05-22 10:57:05 -0700340