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