blob: 06778da75c820f9d222aa2536144005b9630ccba [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
15 main.log.report("Checking is startup was clean")
16 main.case("Checking if the startup was clean...")
17 main.step("Testing startup Zookeeper")
18 main.ONOS1.get_version()
19 data = main.Zookeeper1.isup()
20 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...")
21 main.step("Testing startup Cassandra")
22 data = main.Cassandra1.isup()
admin530b4c92013-08-14 16:54:35 -070023 if data == main.FALSE:
24 main.Cassandra1.stop()
25 main.Cassandra2.stop()
26 main.Cassandra3.stop()
27 main.Cassandra4.stop()
28
29 time.sleep(5)
30
31 main.Cassandra1.start()
32 main.Cassandra2.start()
33 main.Cassandra3.start()
34 main.Cassandra4.start()
adminbae64d82013-08-01 10:50:15 -070035 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
36 main.step("Testing startup ONOS")
37 main.ONOS1.start()
38 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -070039 main.ONOS2.start_rest()
40 time.sleep(5)
41 test= main.ONOS2.rest_status()
42 if test == main.FALSE:
43 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -070044 main.ONOS3.start()
45 main.ONOS4.start()
46 data = main.ONOS1.isup()
47 if data == main.FALSE:
48 main.log.info("Something is funny... restarting ONOS")
49 main.ONOS1.stop()
50 time.sleep(3)
51 main.ONOS1.start()
52 time.sleep(5)
53 data = main.ONOS1.isup()
54 #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
55 topoview = main.TRUE
56 if topoview == main.TRUE & data == main.TRUE :
57 data = main.TRUE
58 else:
59 data = main.FALSE
60
61 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running and has full view of topology",onfail="ONOS didn't start or has fragmented view of topology...")
62
63 def CASE2(self,main) :
64 '''
65 Second case is to time the convergence time of a topology for ONOS.
66 It shuts down the ONOS, drops keyspace, starts ONOS...
67 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.
68 '''
69 import time
70 main.log.report("Time convergence for switches -> single ONOS node in cluster")
71 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
72 main.step("Bringing ONOS down...")
73 main.log.info("all switch no controllers")
74 main.Mininet1.ctrl_none()
75 main.log.info("bringing ONOS down")
76 main.ONOS1.stop()
77 main.ONOS2.stop()
78 main.ONOS3.stop()
79 main.ONOS4.stop()
80 main.log.info("Dropping keyspace...")
81 main.ONOS1.drop_keyspace()
82 time.sleep(5)
83 main.log.info("Bringing ONOS up")
84 main.ONOS1.start()
85 time.sleep(5)
86 main.ONOS2.start()
87 main.ONOS3.start()
88 main.ONOS4.start()
89 main.ONOS1.isup()
90 main.ONOS2.isup()
91 main.ONOS3.isup()
92 main.ONOS4.isup()
93 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
94 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
95 main.Mininet1.ctrl_local()
96 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -070097 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -070098 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
99 if result == 1 :
100 break
101 else :
102 time.sleep(1)
103 t2 = time.time()
104 conv_time = t2 - t1
105 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
106 if result == 1 :
107 main.log.report( "Convergence time of : %f seconds" % conv_time )
108 if float(conv_time) < float(main.params['TargetTime']) :
109 test=main.TRUE
110 main.log.info("Time is less then supplied target time")
111 else:
112 test=main.FALSE
113 main.log.info("Time is greater then supplied target time")
114 else :
115 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
116 test=main.FALSE
117
118 utilities.assert_equals(expect=main.TRUE,actual=test)
119
120 def CASE3(self,main) :
121 '''
122 Second case is to time the convergence time of a topology for ONOS.
123 It shuts down the ONOS, drops keyspace, starts ONOS...
124 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.
125 '''
126 import time
127 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
128 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
129 main.step("Bringing ONOS down...")
130 main.log.info("all switch no controllers")
131 main.Mininet1.ctrl_none()
132 main.log.info("bringing ONOS down")
133 main.ONOS1.stop()
134 main.ONOS2.stop()
135 main.ONOS3.stop()
136 main.ONOS4.stop()
admin530b4c92013-08-14 16:54:35 -0700137 #main.log.info("Dropping keyspace...")
138 #main.ONOS1.drop_keyspace()
adminbae64d82013-08-01 10:50:15 -0700139 time.sleep(5)
140 main.log.info("Bringing ONOS up")
141 main.ONOS1.start()
142 time.sleep(5)
143 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -0700144 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -0700145 main.ONOS3.start()
146 main.ONOS4.start()
147 main.ONOS1.isup()
148 main.ONOS2.isup()
149 main.ONOS3.isup()
150 main.ONOS4.isup()
151 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
152 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
153 main.Mininet1.ctrl_all()
154 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700155 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700156 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
157 if result == 1 :
158 break
159 else :
160 time.sleep(1)
161 t2 = time.time()
162 conv_time = t2 - t1
163 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
164 if result == 1 :
165 main.log.report( "Convergence time of : %f seconds" % conv_time )
166 if float(conv_time) < float(main.params['TargetTime']) :
167 test=main.TRUE
168 main.log.info("Time is less then supplied target time")
169 else:
170 test=main.FALSE
171 main.log.info("Time is greater then supplied target time")
172 else :
173 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
174 test=main.FALSE
175
176 utilities.assert_equals(expect=main.TRUE,actual=test)
177
178 def CASE4(self,main) :
179 '''
180 Second case is to time the convergence time of a topology for ONOS.
181 It shuts down the ONOS, drops keyspace, starts ONOS...
182 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.
183 '''
184 import time
admin530b4c92013-08-14 16:54:35 -0700185 main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster")
adminbae64d82013-08-01 10:50:15 -0700186 main.case("Timing Onos Convergence for even single controller distribution")
187 main.step("Bringing ONOS down...")
188 main.log.info("all switch no controllers")
189 main.Mininet1.ctrl_none()
190 main.log.info("bringing ONOS down")
191 main.ONOS1.stop()
192 main.ONOS2.stop()
193 main.ONOS3.stop()
194 main.ONOS4.stop()
admin530b4c92013-08-14 16:54:35 -0700195 #main.log.info("Dropping keyspace...")
196 #main.ONOS1.drop_keyspace()
adminbae64d82013-08-01 10:50:15 -0700197 time.sleep(5)
198 main.log.info("Bringing ONOS up")
199 main.ONOS1.start()
200 time.sleep(5)
201 main.ONOS2.start()
admin530b4c92013-08-14 16:54:35 -0700202 main.ONOS2.start_rest()
adminbae64d82013-08-01 10:50:15 -0700203 main.ONOS3.start()
204 main.ONOS4.start()
205 main.ONOS1.isup()
206 main.ONOS2.isup()
207 main.ONOS3.isup()
208 main.ONOS4.isup()
209 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
210 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
211 main.Mininet1.ctrl_divide()
212 t1 = time.time()
admin530b4c92013-08-14 16:54:35 -0700213 for i in range(15) :
adminbae64d82013-08-01 10:50:15 -0700214 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
215 if result == 1 :
216 break
217 else :
218 time.sleep(1)
219 t2 = time.time()
220 conv_time = t2 - t1
221 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
222 if result == 1 :
223 main.log.report( "Convergence time of : %f seconds" % conv_time )
224 if float(conv_time) < float(main.params['TargetTime']) :
225 test=main.TRUE
226 main.log.info("Time is less then supplied target time")
227 else:
228 test=main.FALSE
229 main.log.info("Time is greater then supplied target time")
230 else :
231 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
232 test=main.FALSE
233
234 main.ONOS1.stop()
235 utilities.assert_equals(expect=main.TRUE,actual=test)
236