blob: 3081eeda6416c8941296716e2a57f6dfd75d2217 [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()
20 main.RamCloud1.start_serv()
21 main.RamCloud2.start_serv()
22 main.RamCloud3.start_serv()
23 main.RamCloud4.start_serv()
24 time.sleep(20)
25 main.ONOS1.drop_keyspace()
26 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")
43 data = main.RamCloud1.isup()
44 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()
58 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...")
59 main.step("Testing startup ONOS")
60 data = main.ONOS1.isup()
61 data = data and main.ONOS2.isup()
62 data = data and main.ONOS3.isup()
63 data = data and main.ONOS4.isup()
64 if data == main.FALSE:
65 main.log.report("Something is funny... restarting ONOS")
66 main.ONOS1.stop()
67 main.ONOS2.stop()
68 main.ONOS3.stop()
69 main.ONOS4.stop()
70 time.sleep(5)
71 main.ONOS1.start()
72 time.sleep(10)
73 main.ONOS2.start()
74 main.ONOS3.start()
75 main.ONOS4.start()
76 data = main.ONOS1.isup()
77 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
78
79 def CASE2(self,main) :
80 '''
81 Second case is to time the convergence time of a topology for ONOS.
82 It shuts down the ONOS, drops keyspace, starts ONOS...
83 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.
84 '''
85 import time
86 main.log.report("Time convergence for switches -> single ONOS node in cluster")
87 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
88 main.step("Bringing ONOS down...")
89 main.log.info("all switch no controllers")
90 main.Mininet1.ctrl_none()
91 main.log.info("bringing ONOS down")
92 main.ONOS1.stop()
93 main.ONOS2.stop()
94 main.ONOS3.stop()
95 main.ONOS4.stop()
96 main.log.info("Dropping keyspace...")
97 main.ONOS1.drop_keyspace()
98 time.sleep(5)
99 main.log.info("Bringing ONOS up")
100 main.ONOS1.start()
101 time.sleep(5)
102 main.ONOS2.start()
103 main.ONOS3.start()
104 main.ONOS4.start()
105 main.ONOS1.isup()
106 main.ONOS2.isup()
107 main.ONOS3.isup()
108 main.ONOS4.isup()
109 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
110 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
111 main.Mininet1.ctrl_local()
112 t1 = time.time()
113 for i in range(15) :
114 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
115 if result == 1 :
116 break
117 else :
118 time.sleep(1)
119 t2 = time.time()
120 conv_time = t2 - t1
121 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
122 if result == 1 :
123 main.log.report( "Convergence time of : %f seconds" % conv_time )
124 if float(conv_time) < float(main.params['TargetTime']) :
125 test=main.TRUE
126 main.log.info("Time is less then supplied target time")
127 else:
128 test=main.FALSE
129 main.log.info("Time is greater then supplied target time")
130 else :
131 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
132 test=main.FALSE
133
134 utilities.assert_equals(expect=main.TRUE,actual=test)
135
136 def CASE3(self,main) :
137 '''
138 Second case is to time the convergence time of a topology for ONOS.
139 It shuts down the ONOS, drops keyspace, starts ONOS...
140 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.
141 '''
142 import time
143 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
144 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
145 main.step("Bringing ONOS down...")
146 main.log.info("all switch no controllers")
147 main.Mininet1.ctrl_none()
148 main.log.info("bringing ONOS down")
149 main.ONOS1.stop()
150 main.ONOS2.stop()
151 main.ONOS3.stop()
152 main.ONOS4.stop()
153 #main.log.info("Dropping keyspace...")
154 #main.ONOS1.drop_keyspace()
155 time.sleep(5)
156 main.log.info("Bringing ONOS up")
157 main.ONOS1.start()
158 time.sleep(5)
159 main.ONOS2.start()
160 main.ONOS2.start_rest()
161 main.ONOS3.start()
162 main.ONOS4.start()
163 main.ONOS1.isup()
164 main.ONOS2.isup()
165 main.ONOS3.isup()
166 main.ONOS4.isup()
167 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
168 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
169 main.Mininet1.ctrl_all()
170 t1 = time.time()
171 for i in range(15) :
172 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
173 if result == 1 :
174 break
175 else :
176 time.sleep(1)
177 t2 = time.time()
178 conv_time = t2 - t1
179 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
180 if result == 1 :
181 main.log.report( "Convergence time of : %f seconds" % conv_time )
182 if float(conv_time) < float(main.params['TargetTime']) :
183 test=main.TRUE
184 main.log.info("Time is less then supplied target time")
185 else:
186 test=main.FALSE
187 main.log.info("Time is greater then supplied target time")
188 else :
189 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
190 test=main.FALSE
191
192 utilities.assert_equals(expect=main.TRUE,actual=test)
193
194 def CASE4(self,main) :
195 '''
196 Second case is to time the convergence time of a topology for ONOS.
197 It shuts down the ONOS, drops keyspace, starts ONOS...
198 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.
199 '''
200 import time
201 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
202 main.case("Timing Onos Convergence for even single controller distribution")
203 main.step("Bringing ONOS down...")
204 main.log.info("all switch no controllers")
205 main.Mininet1.ctrl_none()
206 main.log.info("bringing ONOS down")
207 main.ONOS1.stop()
208 main.ONOS2.stop()
209 main.ONOS3.stop()
210 main.ONOS4.stop()
211 #main.log.info("Dropping keyspace...")
212 #main.ONOS1.drop_keyspace()
213 time.sleep(5)
214 main.log.info("Bringing ONOS up")
215 main.ONOS1.start()
216 time.sleep(5)
217 main.ONOS2.start()
218 main.ONOS2.start_rest()
219 main.ONOS3.start()
220 main.ONOS4.start()
221 main.ONOS1.isup()
222 main.ONOS2.isup()
223 main.ONOS3.isup()
224 main.ONOS4.isup()
225 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
226 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
227 main.Mininet1.ctrl_divide()
228 t1 = time.time()
229 for i in range(15) :
230 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
231 if result == 1 :
232 break
233 else :
234 time.sleep(1)
235 t2 = time.time()
236 conv_time = t2 - t1
237 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
238 if result == 1 :
239 main.log.report( "Convergence time of : %f seconds" % conv_time )
240 if float(conv_time) < float(main.params['TargetTime']) :
241 test=main.TRUE
242 main.log.info("Time is less then supplied target time")
243 else:
244 test=main.FALSE
245 main.log.info("Time is greater then supplied target time")
246 else :
247 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
248 test=main.FALSE
249
250 utilities.assert_equals(expect=main.TRUE,actual=test)
251