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