blob: c9c83ded2cf57b6a8e4b5cfaa90a521634e617b3 [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()
admin1723f1c2014-05-19 16:08:39 -070028 time.sleep(4)
29 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")
80 data = main.ONOS1.isup()
81 data = data and main.ONOS2.isup()
82 data = data and main.ONOS3.isup()
83 data = data and main.ONOS4.isup()
84 if data == main.FALSE:
85 main.log.report("Something is funny... restarting ONOS")
86 main.ONOS1.stop()
87 main.ONOS2.stop()
88 main.ONOS3.stop()
89 main.ONOS4.stop()
90 time.sleep(5)
91 main.ONOS1.start()
92 time.sleep(10)
93 main.ONOS2.start()
94 main.ONOS3.start()
95 main.ONOS4.start()
96 data = main.ONOS1.isup()
97 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
98
99 def CASE2(self,main) :
100 '''
101 Second case is to time the convergence time of a topology for ONOS.
102 It shuts down the ONOS, drops keyspace, starts ONOS...
103 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.
104 '''
105 import time
106 main.log.report("Time convergence for switches -> single ONOS node in cluster")
107 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
108 main.step("Bringing ONOS down...")
109 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700110 for i in range(1,int(main.params['NR_Switches'])+1):
111 main.Mininet1.delete_sw_controller("s"+i)
admincb593912014-04-14 10:34:41 -0700112 main.log.info("bringing ONOS down")
113 main.ONOS1.stop()
114 main.ONOS2.stop()
115 main.ONOS3.stop()
116 main.ONOS4.stop()
Jon Hall76f2c462014-04-17 11:37:15 -0700117 main.RamCloud1.stop_coor()
118 main.RamCloud1.stop_serv()
119 main.RamCloud2.stop_serv()
120 main.RamCloud3.stop_serv()
121 main.RamCloud4.stop_serv()
Jon Halle00b7e42014-05-23 12:00:33 -0700122 main.RamCloud1.del_db()
123 main.RamCloud2.del_db()
124 main.RamCloud3.del_db()
125 main.RamCloud4.del_db()
Jon Hall76f2c462014-04-17 11:37:15 -0700126
admincb593912014-04-14 10:34:41 -0700127 time.sleep(5)
Jon Hall76f2c462014-04-17 11:37:15 -0700128
129 main.RamCloud1.start_coor()
130 main.RamCloud1.start_serv()
131 main.RamCloud2.start_serv()
132 main.RamCloud3.start_serv()
133 main.RamCloud4.start_serv()
134
admincb593912014-04-14 10:34:41 -0700135 main.log.info("Bringing ONOS up")
136 main.ONOS1.start()
137 time.sleep(5)
138 main.ONOS2.start()
139 main.ONOS3.start()
140 main.ONOS4.start()
Jon Halle00b7e42014-05-23 12:00:33 -0700141 time.sleep(10)
admincb593912014-04-14 10:34:41 -0700142 main.ONOS1.isup()
143 main.ONOS2.isup()
144 main.ONOS3.isup()
145 main.ONOS4.isup()
146 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Halle00b7e42014-05-23 12:00:33 -0700147
admincb593912014-04-14 10:34:41 -0700148 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700149 for i in range(1,int(main.params['NR_Switches'])+1):
150 main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
151
152
153
154 t1 = time.time()
admincb593912014-04-14 10:34:41 -0700155 for i in range(15) :
156 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
157 if result == 1 :
158 break
159 else :
160 time.sleep(1)
161 t2 = time.time()
162 conv_time = t2 - t1
163 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
164 if result == 1 :
165 main.log.report( "Convergence time of : %f seconds" % conv_time )
166 if float(conv_time) < float(main.params['TargetTime']) :
167 test=main.TRUE
168 main.log.info("Time is less then supplied target time")
169 else:
170 test=main.FALSE
171 main.log.info("Time is greater then supplied target time")
172 else :
173 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
174 test=main.FALSE
175
176 utilities.assert_equals(expect=main.TRUE,actual=test)
177
178 def CASE3(self,main) :
179 '''
180 Second case is to time the convergence time of a topology for ONOS.
181 It shuts down the ONOS, drops keyspace, starts ONOS...
182 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.
183 '''
184 import time
185 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
186 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
187 main.step("Bringing ONOS down...")
188 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700189 for i in range(1,int(main.params['NR_Switches'])+1):
190 main.Mininet1.delete_sw_controller("s"+i)
admincb593912014-04-14 10:34:41 -0700191 main.log.info("bringing ONOS down")
192 main.ONOS1.stop()
193 main.ONOS2.stop()
194 main.ONOS3.stop()
195 main.ONOS4.stop()
196 #main.log.info("Dropping keyspace...")
197 #main.ONOS1.drop_keyspace()
198 time.sleep(5)
199 main.log.info("Bringing ONOS up")
200 main.ONOS1.start()
201 time.sleep(5)
202 main.ONOS2.start()
203 main.ONOS2.start_rest()
204 main.ONOS3.start()
205 main.ONOS4.start()
206 main.ONOS1.isup()
207 main.ONOS2.isup()
208 main.ONOS3.isup()
209 main.ONOS4.isup()
210 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
211 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700212 for i in range(1,int(main.params['NR_Switches'])+1):
213 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 -0700214 t1 = time.time()
215 for i in range(15) :
216 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
217 if result == 1 :
218 break
219 else :
220 time.sleep(1)
221 t2 = time.time()
222 conv_time = t2 - t1
223 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
224 if result == 1 :
225 main.log.report( "Convergence time of : %f seconds" % conv_time )
226 if float(conv_time) < float(main.params['TargetTime']) :
227 test=main.TRUE
228 main.log.info("Time is less then supplied target time")
229 else:
230 test=main.FALSE
231 main.log.info("Time is greater then supplied target time")
232 else :
233 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
234 test=main.FALSE
235
236 utilities.assert_equals(expect=main.TRUE,actual=test)
237
238 def CASE4(self,main) :
239 '''
240 Second case is to time the convergence time of a topology for ONOS.
241 It shuts down the ONOS, drops keyspace, starts ONOS...
242 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.
243 '''
244 import time
245 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
246 main.case("Timing Onos Convergence for even single controller distribution")
247 main.step("Bringing ONOS down...")
248 main.log.info("all switch no controllers")
Jon Halle00b7e42014-05-23 12:00:33 -0700249 for i in range(1,):
250 main.Mininet1.delete_sw_controller("s"+i)
admincb593912014-04-14 10:34:41 -0700251 main.log.info("bringing ONOS down")
252 main.ONOS1.stop()
253 main.ONOS2.stop()
254 main.ONOS3.stop()
255 main.ONOS4.stop()
256 #main.log.info("Dropping keyspace...")
257 #main.ONOS1.drop_keyspace()
258 time.sleep(5)
259 main.log.info("Bringing ONOS up")
260 main.ONOS1.start()
261 time.sleep(5)
262 main.ONOS2.start()
263 main.ONOS2.start_rest()
264 main.ONOS3.start()
265 main.ONOS4.start()
266 main.ONOS1.isup()
267 main.ONOS2.isup()
268 main.ONOS3.isup()
269 main.ONOS4.isup()
270 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
Jon Halle00b7e42014-05-23 12:00:33 -0700271
272
admincb593912014-04-14 10:34:41 -0700273 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
Jon Halle00b7e42014-05-23 12:00:33 -0700274 count = 0
275 for i in range(1,int(main.params['NR_Switches'])+1):
276 num = count % len(4)
277 #num = count % len(controllers) #TODO: check number of controllers in cluster
278 main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip'+str(num)],port1=main.params['CTRL']['port'+str(num)])
279 count = count + 1
280
281
admincb593912014-04-14 10:34:41 -0700282 t1 = time.time()
283 for i in range(15) :
284 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
285 if result == 1 :
286 break
287 else :
288 time.sleep(1)
289 t2 = time.time()
290 conv_time = t2 - t1
291 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
292 if result == 1 :
293 main.log.report( "Convergence time of : %f seconds" % conv_time )
294 if float(conv_time) < float(main.params['TargetTime']) :
295 test=main.TRUE
296 main.log.info("Time is less then supplied target time")
297 else:
298 test=main.FALSE
299 main.log.info("Time is greater then supplied target time")
300 else :
301 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
302 test=main.FALSE
303
304 utilities.assert_equals(expect=main.TRUE,actual=test)
305
Jon Hall1c4d2742014-05-22 10:57:05 -0700306 def CASE66(self, main):
admin1723f1c2014-05-19 16:08:39 -0700307 main.log.report("Checking ONOS logs for exceptions")
Jon Hall1c4d2742014-05-22 10:57:05 -0700308 count = 0
admin1723f1c2014-05-19 16:08:39 -0700309 check1 = main.ONOS1.check_exceptions()
310 main.log.report("Exceptions in ONOS1 logs: \n" + check1)
311 check2 = main.ONOS2.check_exceptions()
312 main.log.report("Exceptions in ONOS2 logs: \n" + check2)
313 check3 = main.ONOS3.check_exceptions()
314 main.log.report("Exceptions in ONOS3 logs: \n" + check3)
315 check4 = main.ONOS4.check_exceptions()
316 main.log.report("Exceptions in ONOS4 logs: \n" + check4)
Jon Hall1c4d2742014-05-22 10:57:05 -0700317 result = main.TRUE
admin1723f1c2014-05-19 16:08:39 -0700318 if (check1 or check2 or check3 or check4):
Jon Hall1c4d2742014-05-22 10:57:05 -0700319 result = main.FALSE
320 count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
321 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 -0700322
Jon Hall1c4d2742014-05-22 10:57:05 -0700323