blob: 570ae71fd7bac92349e4ea99723326ac80f2c6c6 [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
admincd0944e2013-09-30 12:07:19 -070015 main.ONOS1.stop()
16 main.ONOS2.stop()
17 main.ONOS3.stop()
18 main.ONOS4.stop()
19 main.Cassandra1.start()
20 main.Cassandra2.start()
21 main.Cassandra3.start()
22 main.Cassandra4.start()
23 time.sleep(20)
24 main.ONOS1.drop_keyspace()
25 main.ONOS1.start()
26 time.sleep(10)
27 main.ONOS2.start()
28 main.ONOS3.start()
29 main.ONOS4.start()
30 main.ONOS1.start_rest()
31 time.sleep(5)
32 test= main.ONOS1.rest_status()
33 if test == main.FALSE:
34 main.ONOS1.start_rest()
35 main.ONOS1.get_version()
36 main.log.report("Startup check Zookeeper1, Cassandra1, and ONOS1 connections")
adminbae64d82013-08-01 10:50:15 -070037 main.case("Checking if the startup was clean...")
38 main.step("Testing startup Zookeeper")
adminbae64d82013-08-01 10:50:15 -070039 data = main.Zookeeper1.isup()
40 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
41 main.step("Testing startup Cassandra")
42 data = main.Cassandra1.isup()
admin530b4c92013-08-14 16:54:35 -070043 if data == main.FALSE:
44 main.Cassandra1.stop()
45 main.Cassandra2.stop()
46 main.Cassandra3.stop()
47 main.Cassandra4.stop()
48
49 time.sleep(5)
admincd0944e2013-09-30 12:07:19 -070050
admin530b4c92013-08-14 16:54:35 -070051 main.Cassandra1.start()
52 main.Cassandra2.start()
53 main.Cassandra3.start()
54 main.Cassandra4.start()
adminbae64d82013-08-01 10:50:15 -070055 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
56 main.step("Testing startup ONOS")
adminbae64d82013-08-01 10:50:15 -070057 data = main.ONOS1.isup()
admincd0944e2013-09-30 12:07:19 -070058 data = data and main.ONOS2.isup()
59 data = data and main.ONOS3.isup()
60 data = data and main.ONOS4.isup()
adminbae64d82013-08-01 10:50:15 -070061 if data == main.FALSE:
admincd0944e2013-09-30 12:07:19 -070062 main.log.report("Something is funny... restarting ONOS")
adminbae64d82013-08-01 10:50:15 -070063 main.ONOS1.stop()
admincd0944e2013-09-30 12:07:19 -070064 main.ONOS2.stop()
65 main.ONOS3.stop()
66 main.ONOS4.stop()
adminbae64d82013-08-01 10:50:15 -070067 time.sleep(5)
admincd0944e2013-09-30 12:07:19 -070068 main.ONOS1.start()
69 time.sleep(10)
70 main.ONOS2.start()
71 main.ONOS3.start()
72 main.ONOS4.start()
adminbae64d82013-08-01 10:50:15 -070073 data = main.ONOS1.isup()
admincd0944e2013-09-30 12:07:19 -070074 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 -070075
76 def CASE2(self,main) :
77 '''
78 Second case is to time the convergence time of a topology for ONOS.
79 It shuts down the ONOS, drops keyspace, starts ONOS...
80 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.
81 '''
82 import time
83 main.log.report("Time convergence for switches -> single ONOS node in cluster")
84 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
85 main.step("Bringing ONOS down...")
86 main.log.info("all switch no controllers")
87 main.Mininet1.ctrl_none()
88 main.log.info("bringing ONOS down")
89 main.ONOS1.stop()
90 main.ONOS2.stop()
91 main.ONOS3.stop()
92 main.ONOS4.stop()
93 main.log.info("Dropping keyspace...")
94 main.ONOS1.drop_keyspace()
95 time.sleep(5)
96 main.log.info("Bringing ONOS up")
97 main.ONOS1.start()
98 time.sleep(5)
99 main.ONOS2.start()
100 main.ONOS3.start()
101 main.ONOS4.start()
102 main.ONOS1.isup()
103 main.ONOS2.isup()
104 main.ONOS3.isup()
105 main.ONOS4.isup()
106 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
107 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
108 main.Mininet1.ctrl_local()
109 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700110 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700111 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
112 if result == 1 :
113 break
114 else :
115 time.sleep(1)
116 t2 = time.time()
117 conv_time = t2 - t1
118 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
119 if result == 1 :
120 main.log.report( "Convergence time of : %f seconds" % conv_time )
121 if float(conv_time) < float(main.params['TargetTime']) :
122 test=main.TRUE
123 main.log.info("Time is less then supplied target time")
124 else:
125 test=main.FALSE
126 main.log.info("Time is greater then supplied target time")
127 else :
128 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
129 test=main.FALSE
130
131 utilities.assert_equals(expect=main.TRUE,actual=test)
132
133 def CASE3(self,main) :
134 '''
135 Second case is to time the convergence time of a topology for ONOS.
136 It shuts down the ONOS, drops keyspace, starts ONOS...
137 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.
138 '''
139 import time
140 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
141 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
142 main.step("Bringing ONOS down...")
143 main.log.info("all switch no controllers")
144 main.Mininet1.ctrl_none()
145 main.log.info("bringing ONOS down")
146 main.ONOS1.stop()
147 main.ONOS2.stop()
148 main.ONOS3.stop()
149 main.ONOS4.stop()
admin530b4c92013-08-14 16:54:35 -0700150 #main.log.info("Dropping keyspace...")
151 #main.ONOS1.drop_keyspace()
adminbae64d82013-08-01 10:50:15 -0700152 time.sleep(5)
153 main.log.info("Bringing ONOS up")
154 main.ONOS1.start()
155 time.sleep(5)
156 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -0700157 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -0700158 main.ONOS3.start()
159 main.ONOS4.start()
160 main.ONOS1.isup()
161 main.ONOS2.isup()
162 main.ONOS3.isup()
163 main.ONOS4.isup()
164 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
165 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
166 main.Mininet1.ctrl_all()
167 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700168 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700169 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
170 if result == 1 :
171 break
172 else :
173 time.sleep(1)
174 t2 = time.time()
175 conv_time = t2 - t1
176 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
177 if result == 1 :
178 main.log.report( "Convergence time of : %f seconds" % conv_time )
179 if float(conv_time) < float(main.params['TargetTime']) :
180 test=main.TRUE
181 main.log.info("Time is less then supplied target time")
182 else:
183 test=main.FALSE
184 main.log.info("Time is greater then supplied target time")
185 else :
186 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
187 test=main.FALSE
188
189 utilities.assert_equals(expect=main.TRUE,actual=test)
190
191 def CASE4(self,main) :
192 '''
193 Second case is to time the convergence time of a topology for ONOS.
194 It shuts down the ONOS, drops keyspace, starts ONOS...
195 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.
196 '''
197 import time
admin530b4c92013-08-14 16:54:35 -0700198 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
adminbae64d82013-08-01 10:50:15 -0700199 main.case("Timing Onos Convergence for even single controller distribution")
200 main.step("Bringing ONOS down...")
201 main.log.info("all switch no controllers")
202 main.Mininet1.ctrl_none()
203 main.log.info("bringing ONOS down")
204 main.ONOS1.stop()
205 main.ONOS2.stop()
206 main.ONOS3.stop()
207 main.ONOS4.stop()
admin530b4c92013-08-14 16:54:35 -0700208 #main.log.info("Dropping keyspace...")
209 #main.ONOS1.drop_keyspace()
adminbae64d82013-08-01 10:50:15 -0700210 time.sleep(5)
211 main.log.info("Bringing ONOS up")
212 main.ONOS1.start()
213 time.sleep(5)
214 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -0700215 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -0700216 main.ONOS3.start()
217 main.ONOS4.start()
218 main.ONOS1.isup()
219 main.ONOS2.isup()
220 main.ONOS3.isup()
221 main.ONOS4.isup()
222 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
223 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
224 main.Mininet1.ctrl_divide()
225 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700226 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700227 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
228 if result == 1 :
229 break
230 else :
231 time.sleep(1)
232 t2 = time.time()
233 conv_time = t2 - t1
234 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
235 if result == 1 :
236 main.log.report( "Convergence time of : %f seconds" % conv_time )
237 if float(conv_time) < float(main.params['TargetTime']) :
238 test=main.TRUE
239 main.log.info("Time is less then supplied target time")
240 else:
241 test=main.FALSE
242 main.log.info("Time is greater then supplied target time")
243 else :
244 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
245 test=main.FALSE
246
adminbae64d82013-08-01 10:50:15 -0700247 utilities.assert_equals(expect=main.TRUE,actual=test)
248