blob: 9e6cb7b51186bcf8485fc72d531ce42d51ababf9 [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()
adminaef00552014-05-08 09:18:36 -070033 time.sleep(10)
admin1723f1c2014-05-19 16:08:39 -070034
admincb593912014-04-14 10:34:41 -070035 main.RamCloud1.start_coor()
Jon Hall76f2c462014-04-17 11:37:15 -070036 time.sleep(10)
admincb593912014-04-14 10:34:41 -070037 main.RamCloud1.start_serv()
38 main.RamCloud2.start_serv()
39 main.RamCloud3.start_serv()
40 main.RamCloud4.start_serv()
41 time.sleep(20)
admincb593912014-04-14 10:34:41 -070042 main.ONOS1.start()
43 time.sleep(10)
44 main.ONOS2.start()
45 main.ONOS3.start()
46 main.ONOS4.start()
47 main.ONOS1.start_rest()
48 time.sleep(5)
49 test= main.ONOS1.rest_status()
50 if test == main.FALSE:
51 main.ONOS1.start_rest()
52 main.ONOS1.get_version()
53 main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections")
54 main.case("Checking if the startup was clean...")
55 main.step("Testing startup Zookeeper")
56 data = main.Zookeeper1.isup()
57 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
58 main.step("Testing startup RamCloud")
adminc6cfc1c2014-04-21 13:55:21 -070059 data = main.RamCloud1.status_serv()
admincb593912014-04-14 10:34:41 -070060 if data == main.FALSE:
61 main.RamCloud1.stop_coor()
62 main.RamCloud1.stop_serv()
63 main.RamCloud2.stop_serv()
64 main.RamCloud3.stop_serv()
65 main.RamCloud4.stop_serv()
66
67 time.sleep(5)
68
69 main.RamCloud1.start_coor()
70 main.RamCloud1.start_serv()
71 main.RamCloud2.start_serv()
72 main.RamCloud3.start_serv()
73 main.RamCloud4.start_serv()
Jon Hall76f2c462014-04-17 11:37:15 -070074 data = main.RamCloud1.isup()
admincb593912014-04-14 10:34:41 -070075 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
76 main.step("Testing startup ONOS")
77 data = main.ONOS1.isup()
78 data = data and main.ONOS2.isup()
79 data = data and main.ONOS3.isup()
80 data = data and main.ONOS4.isup()
81 if data == main.FALSE:
82 main.log.report("Something is funny... restarting ONOS")
83 main.ONOS1.stop()
84 main.ONOS2.stop()
85 main.ONOS3.stop()
86 main.ONOS4.stop()
87 time.sleep(5)
88 main.ONOS1.start()
89 time.sleep(10)
90 main.ONOS2.start()
91 main.ONOS3.start()
92 main.ONOS4.start()
93 data = main.ONOS1.isup()
94 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
95
96 def CASE2(self,main) :
97 '''
98 Second case is to time the convergence time of a topology for ONOS.
99 It shuts down the ONOS, drops keyspace, starts ONOS...
100 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.
101 '''
102 import time
103 main.log.report("Time convergence for switches -> single ONOS node in cluster")
104 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
105 main.step("Bringing ONOS down...")
106 main.log.info("all switch no controllers")
107 main.Mininet1.ctrl_none()
108 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()
118
admincb593912014-04-14 10:34:41 -0700119 time.sleep(5)
Jon Hall76f2c462014-04-17 11:37:15 -0700120
121 main.RamCloud1.start_coor()
122 main.RamCloud1.start_serv()
123 main.RamCloud2.start_serv()
124 main.RamCloud3.start_serv()
125 main.RamCloud4.start_serv()
126
admincb593912014-04-14 10:34:41 -0700127 main.log.info("Bringing ONOS up")
128 main.ONOS1.start()
129 time.sleep(5)
130 main.ONOS2.start()
131 main.ONOS3.start()
132 main.ONOS4.start()
133 main.ONOS1.isup()
134 main.ONOS2.isup()
135 main.ONOS3.isup()
136 main.ONOS4.isup()
137 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
138 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
139 main.Mininet1.ctrl_local()
140 t1 = time.time()
141 for i in range(15) :
142 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
143 if result == 1 :
144 break
145 else :
146 time.sleep(1)
147 t2 = time.time()
148 conv_time = t2 - t1
149 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
150 if result == 1 :
151 main.log.report( "Convergence time of : %f seconds" % conv_time )
152 if float(conv_time) < float(main.params['TargetTime']) :
153 test=main.TRUE
154 main.log.info("Time is less then supplied target time")
155 else:
156 test=main.FALSE
157 main.log.info("Time is greater then supplied target time")
158 else :
159 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
160 test=main.FALSE
161
162 utilities.assert_equals(expect=main.TRUE,actual=test)
163
164 def CASE3(self,main) :
165 '''
166 Second case is to time the convergence time of a topology for ONOS.
167 It shuts down the ONOS, drops keyspace, starts ONOS...
168 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.
169 '''
170 import time
171 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
172 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
173 main.step("Bringing ONOS down...")
174 main.log.info("all switch no controllers")
175 main.Mininet1.ctrl_none()
176 main.log.info("bringing ONOS down")
177 main.ONOS1.stop()
178 main.ONOS2.stop()
179 main.ONOS3.stop()
180 main.ONOS4.stop()
181 #main.log.info("Dropping keyspace...")
182 #main.ONOS1.drop_keyspace()
183 time.sleep(5)
184 main.log.info("Bringing ONOS up")
185 main.ONOS1.start()
186 time.sleep(5)
187 main.ONOS2.start()
188 main.ONOS2.start_rest()
189 main.ONOS3.start()
190 main.ONOS4.start()
191 main.ONOS1.isup()
192 main.ONOS2.isup()
193 main.ONOS3.isup()
194 main.ONOS4.isup()
195 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
196 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
197 main.Mininet1.ctrl_all()
198 t1 = time.time()
199 for i in range(15) :
200 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
201 if result == 1 :
202 break
203 else :
204 time.sleep(1)
205 t2 = time.time()
206 conv_time = t2 - t1
207 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
208 if result == 1 :
209 main.log.report( "Convergence time of : %f seconds" % conv_time )
210 if float(conv_time) < float(main.params['TargetTime']) :
211 test=main.TRUE
212 main.log.info("Time is less then supplied target time")
213 else:
214 test=main.FALSE
215 main.log.info("Time is greater then supplied target time")
216 else :
217 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
218 test=main.FALSE
219
220 utilities.assert_equals(expect=main.TRUE,actual=test)
221
222 def CASE4(self,main) :
223 '''
224 Second case is to time the convergence time of a topology for ONOS.
225 It shuts down the ONOS, drops keyspace, starts ONOS...
226 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.
227 '''
228 import time
229 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
230 main.case("Timing Onos Convergence for even single controller distribution")
231 main.step("Bringing ONOS down...")
232 main.log.info("all switch no controllers")
233 main.Mininet1.ctrl_none()
234 main.log.info("bringing ONOS down")
235 main.ONOS1.stop()
236 main.ONOS2.stop()
237 main.ONOS3.stop()
238 main.ONOS4.stop()
239 #main.log.info("Dropping keyspace...")
240 #main.ONOS1.drop_keyspace()
241 time.sleep(5)
242 main.log.info("Bringing ONOS up")
243 main.ONOS1.start()
244 time.sleep(5)
245 main.ONOS2.start()
246 main.ONOS2.start_rest()
247 main.ONOS3.start()
248 main.ONOS4.start()
249 main.ONOS1.isup()
250 main.ONOS2.isup()
251 main.ONOS3.isup()
252 main.ONOS4.isup()
253 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
254 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
255 main.Mininet1.ctrl_divide()
256 t1 = time.time()
257 for i in range(15) :
258 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
259 if result == 1 :
260 break
261 else :
262 time.sleep(1)
263 t2 = time.time()
264 conv_time = t2 - t1
265 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
266 if result == 1 :
267 main.log.report( "Convergence time of : %f seconds" % conv_time )
268 if float(conv_time) < float(main.params['TargetTime']) :
269 test=main.TRUE
270 main.log.info("Time is less then supplied target time")
271 else:
272 test=main.FALSE
273 main.log.info("Time is greater then supplied target time")
274 else :
275 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
276 test=main.FALSE
277
278 utilities.assert_equals(expect=main.TRUE,actual=test)
279
Jon Hall1c4d2742014-05-22 10:57:05 -0700280 def CASE66(self, main):
admin1723f1c2014-05-19 16:08:39 -0700281 main.log.report("Checking ONOS logs for exceptions")
Jon Hall1c4d2742014-05-22 10:57:05 -0700282 count = 0
admin1723f1c2014-05-19 16:08:39 -0700283 check1 = main.ONOS1.check_exceptions()
284 main.log.report("Exceptions in ONOS1 logs: \n" + check1)
285 check2 = main.ONOS2.check_exceptions()
286 main.log.report("Exceptions in ONOS2 logs: \n" + check2)
287 check3 = main.ONOS3.check_exceptions()
288 main.log.report("Exceptions in ONOS3 logs: \n" + check3)
289 check4 = main.ONOS4.check_exceptions()
290 main.log.report("Exceptions in ONOS4 logs: \n" + check4)
Jon Hall1c4d2742014-05-22 10:57:05 -0700291 result = main.TRUE
admin1723f1c2014-05-19 16:08:39 -0700292 if (check1 or check2 or check3 or check4):
Jon Hall1c4d2742014-05-22 10:57:05 -0700293 result = main.FALSE
294 count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines())
295 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 -0700296
Jon Hall1c4d2742014-05-22 10:57:05 -0700297