blob: bae4b5c324b7687491c0af681b7091ff240e9686 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001
2class OnosScale4nodes:
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 Cassandra 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
Jon Hallf89c8552014-04-02 13:14:06 -070015 main.Zookeeper1.start()
16 main.Zookeeper2.start()
17 main.Zookeeper3.start()
18 main.Zookeeper4.start()
admincd0944e2013-09-30 12:07:19 -070019 main.ONOS1.stop()
20 main.ONOS2.stop()
21 main.ONOS3.stop()
22 main.ONOS4.stop()
23 main.Cassandra1.start()
24 main.Cassandra2.start()
25 main.Cassandra3.start()
26 main.Cassandra4.start()
27 time.sleep(20)
28 main.ONOS1.drop_keyspace()
29 main.ONOS1.start()
30 time.sleep(10)
31 main.ONOS2.start()
32 main.ONOS3.start()
33 main.ONOS4.start()
34 main.ONOS1.start_rest()
35 time.sleep(5)
36 test= main.ONOS1.rest_status()
37 if test == main.FALSE:
38 main.ONOS1.start_rest()
39 main.ONOS1.get_version()
40 main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
adminbae64d82013-08-01 10:50:15 -070041 main.case("Checking if the startup was clean...")
42 main.step("Testing startup Zookeeper")
adminbae64d82013-08-01 10:50:15 -070043 data = main.Zookeeper1.isup()
44 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
45 main.step("Testing startup Cassandra")
46 data = main.Cassandra1.isup()
admin530b4c92013-08-14 16:54:35 -070047 if data == main.FALSE:
48 main.Cassandra1.stop()
49 main.Cassandra2.stop()
50 main.Cassandra3.stop()
51 main.Cassandra4.stop()
52
53 time.sleep(5)
admincd0944e2013-09-30 12:07:19 -070054
admin530b4c92013-08-14 16:54:35 -070055 main.Cassandra1.start()
56 main.Cassandra2.start()
57 main.Cassandra3.start()
58 main.Cassandra4.start()
adminbae64d82013-08-01 10:50:15 -070059 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
60 main.step("Testing startup ONOS")
adminbae64d82013-08-01 10:50:15 -070061 data = main.ONOS1.isup()
admincd0944e2013-09-30 12:07:19 -070062 data = data and main.ONOS2.isup()
63 data = data and main.ONOS3.isup()
64 data = data and main.ONOS4.isup()
adminbae64d82013-08-01 10:50:15 -070065 if data == main.FALSE:
admincd0944e2013-09-30 12:07:19 -070066 main.log.report("Something is funny... restarting ONOS")
adminbae64d82013-08-01 10:50:15 -070067 main.ONOS1.stop()
admincd0944e2013-09-30 12:07:19 -070068 main.ONOS2.stop()
69 main.ONOS3.stop()
70 main.ONOS4.stop()
adminbae64d82013-08-01 10:50:15 -070071 time.sleep(5)
admincd0944e2013-09-30 12:07:19 -070072 main.ONOS1.start()
73 time.sleep(10)
74 main.ONOS2.start()
75 main.ONOS3.start()
76 main.ONOS4.start()
adminbae64d82013-08-01 10:50:15 -070077 data = main.ONOS1.isup()
admincd0944e2013-09-30 12:07:19 -070078 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...")
adminbae64d82013-08-01 10:50:15 -070079
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()
97 main.log.info("Dropping keyspace...")
98 main.ONOS1.drop_keyspace()
99 time.sleep(5)
100 main.log.info("Bringing ONOS up")
101 main.ONOS1.start()
102 time.sleep(5)
103 main.ONOS2.start()
104 main.ONOS3.start()
105 main.ONOS4.start()
106 main.ONOS1.isup()
107 main.ONOS2.isup()
108 main.ONOS3.isup()
109 main.ONOS4.isup()
110 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
111 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
112 main.Mininet1.ctrl_local()
113 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700114 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700115 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
116 if result == 1 :
117 break
118 else :
119 time.sleep(1)
120 t2 = time.time()
121 conv_time = t2 - t1
122 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
123 if result == 1 :
124 main.log.report( "Convergence time of : %f seconds" % conv_time )
125 if float(conv_time) < float(main.params['TargetTime']) :
126 test=main.TRUE
127 main.log.info("Time is less then supplied target time")
128 else:
129 test=main.FALSE
130 main.log.info("Time is greater then supplied target time")
131 else :
132 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
133 test=main.FALSE
134
135 utilities.assert_equals(expect=main.TRUE,actual=test)
136
137 def CASE3(self,main) :
138 '''
139 Second case is to time the convergence time of a topology for ONOS.
140 It shuts down the ONOS, drops keyspace, starts ONOS...
141 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.
142 '''
143 import time
144 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
145 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
146 main.step("Bringing ONOS down...")
147 main.log.info("all switch no controllers")
148 main.Mininet1.ctrl_none()
149 main.log.info("bringing ONOS down")
150 main.ONOS1.stop()
151 main.ONOS2.stop()
152 main.ONOS3.stop()
153 main.ONOS4.stop()
admin530b4c92013-08-14 16:54:35 -0700154 #main.log.info("Dropping keyspace...")
155 #main.ONOS1.drop_keyspace()
adminbae64d82013-08-01 10:50:15 -0700156 time.sleep(5)
157 main.log.info("Bringing ONOS up")
158 main.ONOS1.start()
159 time.sleep(5)
160 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -0700161 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -0700162 main.ONOS3.start()
163 main.ONOS4.start()
164 main.ONOS1.isup()
165 main.ONOS2.isup()
166 main.ONOS3.isup()
167 main.ONOS4.isup()
168 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
169 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
170 main.Mininet1.ctrl_all()
171 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700172 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700173 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
174 if result == 1 :
175 break
176 else :
177 time.sleep(1)
178 t2 = time.time()
179 conv_time = t2 - t1
180 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
181 if result == 1 :
182 main.log.report( "Convergence time of : %f seconds" % conv_time )
183 if float(conv_time) < float(main.params['TargetTime']) :
184 test=main.TRUE
185 main.log.info("Time is less then supplied target time")
186 else:
187 test=main.FALSE
188 main.log.info("Time is greater then supplied target time")
189 else :
190 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
191 test=main.FALSE
192
193 utilities.assert_equals(expect=main.TRUE,actual=test)
194
195 def CASE4(self,main) :
196 '''
197 Second case is to time the convergence time of a topology for ONOS.
198 It shuts down the ONOS, drops keyspace, starts ONOS...
199 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.
200 '''
201 import time
admin530b4c92013-08-14 16:54:35 -0700202 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
adminbae64d82013-08-01 10:50:15 -0700203 main.case("Timing Onos Convergence for even single controller distribution")
204 main.step("Bringing ONOS down...")
205 main.log.info("all switch no controllers")
206 main.Mininet1.ctrl_none()
207 main.log.info("bringing ONOS down")
208 main.ONOS1.stop()
209 main.ONOS2.stop()
210 main.ONOS3.stop()
211 main.ONOS4.stop()
admin530b4c92013-08-14 16:54:35 -0700212 #main.log.info("Dropping keyspace...")
213 #main.ONOS1.drop_keyspace()
adminbae64d82013-08-01 10:50:15 -0700214 time.sleep(5)
215 main.log.info("Bringing ONOS up")
216 main.ONOS1.start()
217 time.sleep(5)
218 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -0700219 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -0700220 main.ONOS3.start()
221 main.ONOS4.start()
222 main.ONOS1.isup()
223 main.ONOS2.isup()
224 main.ONOS3.isup()
225 main.ONOS4.isup()
226 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
227 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
228 main.Mininet1.ctrl_divide()
229 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700230 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700231 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
232 if result == 1 :
233 break
234 else :
235 time.sleep(1)
236 t2 = time.time()
237 conv_time = t2 - t1
238 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
239 if result == 1 :
240 main.log.report( "Convergence time of : %f seconds" % conv_time )
241 if float(conv_time) < float(main.params['TargetTime']) :
242 test=main.TRUE
243 main.log.info("Time is less then supplied target time")
244 else:
245 test=main.FALSE
246 main.log.info("Time is greater then supplied target time")
247 else :
248 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
249 test=main.FALSE
250
adminbae64d82013-08-01 10:50:15 -0700251 utilities.assert_equals(expect=main.TRUE,actual=test)
252