blob: a0540889e292df3deb56476e54d11713134591c1 [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()
23 utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Cassandra is up!",onfail="Cassandra is down...")
24 main.step("Testing startup ONOS")
25 main.ONOS1.start()
26 main.ONOS2.start()
27 main.ONOS3.start()
28 main.ONOS4.start()
29 data = main.ONOS1.isup()
30 if data == main.FALSE:
31 main.log.info("Something is funny... restarting ONOS")
32 main.ONOS1.stop()
33 time.sleep(3)
34 main.ONOS1.start()
35 time.sleep(5)
36 data = main.ONOS1.isup()
37 #topoview = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
38 topoview = main.TRUE
39 if topoview == main.TRUE & data == main.TRUE :
40 data = main.TRUE
41 else:
42 data = main.FALSE
43
44 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...")
45
46 def CASE2(self,main) :
47 '''
48 Second case is to time the convergence time of a topology for ONOS.
49 It shuts down the ONOS, drops keyspace, starts ONOS...
50 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.
51 '''
52 import time
53 main.log.report("Time convergence for switches -> single ONOS node in cluster")
54 main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster")
55 main.step("Bringing ONOS down...")
56 main.log.info("all switch no controllers")
57 main.Mininet1.ctrl_none()
58 main.log.info("bringing ONOS down")
59 main.ONOS1.stop()
60 main.ONOS2.stop()
61 main.ONOS3.stop()
62 main.ONOS4.stop()
63 main.log.info("Dropping keyspace...")
64 main.ONOS1.drop_keyspace()
65 time.sleep(5)
66 main.log.info("Bringing ONOS up")
67 main.ONOS1.start()
68 time.sleep(5)
69 main.ONOS2.start()
70 main.ONOS3.start()
71 main.ONOS4.start()
72 main.ONOS1.isup()
73 main.ONOS2.isup()
74 main.ONOS3.isup()
75 main.ONOS4.isup()
76 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
77 main.log.info("Pointing the Switches at ONE controller... then BEGIN time")
78 main.Mininet1.ctrl_local()
79 t1 = time.time()
80 for i in range(9) :
81 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
82 if result == 1 :
83 break
84 else :
85 time.sleep(1)
86 t2 = time.time()
87 conv_time = t2 - t1
88 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
89 if result == 1 :
90 main.log.report( "Convergence time of : %f seconds" % conv_time )
91 if float(conv_time) < float(main.params['TargetTime']) :
92 test=main.TRUE
93 main.log.info("Time is less then supplied target time")
94 else:
95 test=main.FALSE
96 main.log.info("Time is greater then supplied target time")
97 else :
98 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
99 test=main.FALSE
100
101 utilities.assert_equals(expect=main.TRUE,actual=test)
102
103 def CASE3(self,main) :
104 '''
105 Second case is to time the convergence time of a topology for ONOS.
106 It shuts down the ONOS, drops keyspace, starts ONOS...
107 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.
108 '''
109 import time
110 main.log.report("Time convergence for switches -> all ONOS nodes in cluster")
111 main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster")
112 main.step("Bringing ONOS down...")
113 main.log.info("all switch no controllers")
114 main.Mininet1.ctrl_none()
115 main.log.info("bringing ONOS down")
116 main.ONOS1.stop()
117 main.ONOS2.stop()
118 main.ONOS3.stop()
119 main.ONOS4.stop()
120 main.log.info("Dropping keyspace...")
121 main.ONOS1.drop_keyspace()
122 time.sleep(5)
123 main.log.info("Bringing ONOS up")
124 main.ONOS1.start()
125 time.sleep(5)
126 main.ONOS2.start()
127 main.ONOS3.start()
128 main.ONOS4.start()
129 main.ONOS1.isup()
130 main.ONOS2.isup()
131 main.ONOS3.isup()
132 main.ONOS4.isup()
133 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
134 main.log.info("Pointing the Switches at ALL controllers... then BEGIN time")
135 main.Mininet1.ctrl_all()
136 t1 = time.time()
137 for i in range(9) :
138 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
139 if result == 1 :
140 break
141 else :
142 time.sleep(1)
143 t2 = time.time()
144 conv_time = t2 - t1
145 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
146 if result == 1 :
147 main.log.report( "Convergence time of : %f seconds" % conv_time )
148 if float(conv_time) < float(main.params['TargetTime']) :
149 test=main.TRUE
150 main.log.info("Time is less then supplied target time")
151 else:
152 test=main.FALSE
153 main.log.info("Time is greater then supplied target time")
154 else :
155 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
156 test=main.FALSE
157
158 utilities.assert_equals(expect=main.TRUE,actual=test)
159
160 def CASE4(self,main) :
161 '''
162 Second case is to time the convergence time of a topology for ONOS.
163 It shuts down the ONOS, drops keyspace, starts ONOS...
164 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.
165 '''
166 import time
167 main.log.report("Time convergence for switches -> one of all nodes in cluster")
168 main.case("Timing Onos Convergence for even single controller distribution")
169 main.step("Bringing ONOS down...")
170 main.log.info("all switch no controllers")
171 main.Mininet1.ctrl_none()
172 main.log.info("bringing ONOS down")
173 main.ONOS1.stop()
174 main.ONOS2.stop()
175 main.ONOS3.stop()
176 main.ONOS4.stop()
177 main.log.info("Dropping keyspace...")
178 main.ONOS1.drop_keyspace()
179 time.sleep(5)
180 main.log.info("Bringing ONOS up")
181 main.ONOS1.start()
182 time.sleep(5)
183 main.ONOS2.start()
184 main.ONOS3.start()
185 main.ONOS4.start()
186 main.ONOS1.isup()
187 main.ONOS2.isup()
188 main.ONOS3.isup()
189 main.ONOS4.isup()
190 main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
191 main.log.info("Pointing the Switches to alternating controllers... then BEGIN time")
192 main.Mininet1.ctrl_divide()
193 t1 = time.time()
194 for i in range(9) :
195 result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
196 if result == 1 :
197 break
198 else :
199 time.sleep(1)
200 t2 = time.time()
201 conv_time = t2 - t1
202 main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links'])
203 if result == 1 :
204 main.log.report( "Convergence time of : %f seconds" % conv_time )
205 if float(conv_time) < float(main.params['TargetTime']) :
206 test=main.TRUE
207 main.log.info("Time is less then supplied target time")
208 else:
209 test=main.FALSE
210 main.log.info("Time is greater then supplied target time")
211 else :
212 main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time )
213 test=main.FALSE
214
215 main.ONOS1.stop()
216 utilities.assert_equals(expect=main.TRUE,actual=test)
217