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