admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 1 | |
| 2 | class 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() |
admin | aef0055 | 2014-05-08 09:18:36 -0700 | [diff] [blame] | 19 | main.RamCloud1.stop_coor() |
| 20 | main.RamCloud1.stop_serv() |
| 21 | main.RamCloud2.stop_serv() |
| 22 | main.RamCloud3.stop_serv() |
| 23 | main.RamCloud4.stop_serv() |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 24 | main.Zookeeper1.start() |
| 25 | main.Zookeeper2.start() |
| 26 | main.Zookeeper3.start() |
| 27 | main.Zookeeper4.start() |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 28 | time.sleep(10) |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 29 | main.RamCloud1.del_db() |
| 30 | main.RamCloud2.del_db() |
| 31 | main.RamCloud3.del_db() |
| 32 | main.RamCloud4.del_db() |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 33 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 34 | main.RamCloud1.start_coor() |
Jon Hall | 76f2c46 | 2014-04-17 11:37:15 -0700 | [diff] [blame] | 35 | time.sleep(10) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 36 | main.RamCloud1.start_serv() |
| 37 | main.RamCloud2.start_serv() |
| 38 | main.RamCloud3.start_serv() |
| 39 | main.RamCloud4.start_serv() |
| 40 | time.sleep(20) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 41 | main.ONOS1.start() |
| 42 | time.sleep(10) |
| 43 | main.ONOS2.start() |
| 44 | main.ONOS3.start() |
| 45 | main.ONOS4.start() |
| 46 | main.ONOS1.start_rest() |
| 47 | time.sleep(5) |
| 48 | test= main.ONOS1.rest_status() |
| 49 | if test == main.FALSE: |
| 50 | main.ONOS1.start_rest() |
| 51 | main.ONOS1.get_version() |
| 52 | main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections") |
| 53 | main.case("Checking if the startup was clean...") |
| 54 | main.step("Testing startup Zookeeper") |
| 55 | data = main.Zookeeper1.isup() |
| 56 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...") |
| 57 | main.step("Testing startup RamCloud") |
admin | c6cfc1c | 2014-04-21 13:55:21 -0700 | [diff] [blame] | 58 | data = main.RamCloud1.status_serv() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 59 | if data == main.FALSE: |
| 60 | main.RamCloud1.stop_coor() |
| 61 | main.RamCloud1.stop_serv() |
| 62 | main.RamCloud2.stop_serv() |
| 63 | main.RamCloud3.stop_serv() |
| 64 | main.RamCloud4.stop_serv() |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 65 | main.RamCloud1.del_db() |
| 66 | main.RamCloud2.del_db() |
| 67 | main.RamCloud3.del_db() |
| 68 | main.RamCloud4.del_db() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 69 | |
| 70 | time.sleep(5) |
| 71 | |
| 72 | main.RamCloud1.start_coor() |
| 73 | main.RamCloud1.start_serv() |
| 74 | main.RamCloud2.start_serv() |
| 75 | main.RamCloud3.start_serv() |
| 76 | main.RamCloud4.start_serv() |
Jon Hall | 76f2c46 | 2014-04-17 11:37:15 -0700 | [diff] [blame] | 77 | data = main.RamCloud1.isup() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 78 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...") |
| 79 | main.step("Testing startup ONOS") |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 80 | time.sleep(10) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 81 | data = main.ONOS1.isup() |
| 82 | data = data and main.ONOS2.isup() |
| 83 | data = data and main.ONOS3.isup() |
| 84 | data = data and main.ONOS4.isup() |
| 85 | if data == main.FALSE: |
| 86 | main.log.report("Something is funny... restarting ONOS") |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 87 | time.sleep(10) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 88 | data = main.ONOS1.isup() |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 89 | data = data and main.ONOS2.isup() |
| 90 | data = data and main.ONOS3.isup() |
| 91 | data = data and main.ONOS4.isup() |
| 92 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 93 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...") |
| 94 | |
| 95 | def CASE2(self,main) : |
| 96 | ''' |
| 97 | Second case is to time the convergence time of a topology for ONOS. |
| 98 | It shuts down the ONOS, drops keyspace, starts ONOS... |
| 99 | 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. |
| 100 | ''' |
| 101 | import time |
| 102 | main.log.report("Time convergence for switches -> single ONOS node in cluster") |
| 103 | main.case("Timing Onos Convergence for switch -> a single ONOS node in the cluster") |
| 104 | main.step("Bringing ONOS down...") |
| 105 | main.log.info("all switch no controllers") |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 106 | for i in range(1,int(main.params['NR_Switches'])+1): |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 107 | main.Mininet1.delete_sw_controller("s"+str(i)) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 108 | main.log.info("bringing ONOS down") |
| 109 | main.ONOS1.stop() |
| 110 | main.ONOS2.stop() |
| 111 | main.ONOS3.stop() |
| 112 | main.ONOS4.stop() |
Jon Hall | 76f2c46 | 2014-04-17 11:37:15 -0700 | [diff] [blame] | 113 | main.RamCloud1.stop_coor() |
| 114 | main.RamCloud1.stop_serv() |
| 115 | main.RamCloud2.stop_serv() |
| 116 | main.RamCloud3.stop_serv() |
| 117 | main.RamCloud4.stop_serv() |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 118 | main.Zookeeper1.start() |
| 119 | main.Zookeeper2.start() |
| 120 | main.Zookeeper3.start() |
| 121 | main.Zookeeper4.start() |
| 122 | time.sleep(4) |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 123 | main.RamCloud1.del_db() |
| 124 | main.RamCloud2.del_db() |
| 125 | main.RamCloud3.del_db() |
| 126 | main.RamCloud4.del_db() |
Jon Hall | 76f2c46 | 2014-04-17 11:37:15 -0700 | [diff] [blame] | 127 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 128 | time.sleep(5) |
Jon Hall | 76f2c46 | 2014-04-17 11:37:15 -0700 | [diff] [blame] | 129 | |
| 130 | main.RamCloud1.start_coor() |
| 131 | main.RamCloud1.start_serv() |
| 132 | main.RamCloud2.start_serv() |
| 133 | main.RamCloud3.start_serv() |
| 134 | main.RamCloud4.start_serv() |
| 135 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 136 | main.log.info("Bringing ONOS up") |
| 137 | main.ONOS1.start() |
| 138 | time.sleep(5) |
| 139 | main.ONOS2.start() |
| 140 | main.ONOS3.start() |
| 141 | main.ONOS4.start() |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 142 | time.sleep(10) |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 143 | data = main.ONOS1.isup() |
| 144 | data = data and main.ONOS2.isup() |
| 145 | data = data and main.ONOS3.isup() |
| 146 | data = data and main.ONOS4.isup() |
| 147 | if data == main.FALSE: |
| 148 | main.log.report("Something is funny... restarting ONOS") |
| 149 | time.sleep(10) |
| 150 | data = main.ONOS1.isup() |
| 151 | data = data and main.ONOS2.isup() |
| 152 | data = data and main.ONOS3.isup() |
| 153 | data = data and main.ONOS4.isup() |
| 154 | if data == main.FALSE: |
| 155 | main.log.report("Something is funny... restarting ONOS") |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 156 | main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 157 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 158 | main.log.info("Pointing the Switches at ONE controller... then BEGIN time") |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 159 | for i in range(1,int(main.params['NR_Switches'])+1): |
| 160 | main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) |
| 161 | |
| 162 | |
| 163 | |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 164 | t1 = time.time() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 165 | for i in range(15) : |
| 166 | result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 167 | if result == 1 : |
| 168 | break |
| 169 | else : |
| 170 | time.sleep(1) |
| 171 | t2 = time.time() |
| 172 | conv_time = t2 - t1 |
| 173 | main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 174 | if result == 1 : |
| 175 | main.log.report( "Convergence time of : %f seconds" % conv_time ) |
| 176 | if float(conv_time) < float(main.params['TargetTime']) : |
| 177 | test=main.TRUE |
| 178 | main.log.info("Time is less then supplied target time") |
| 179 | else: |
| 180 | test=main.FALSE |
| 181 | main.log.info("Time is greater then supplied target time") |
| 182 | else : |
| 183 | main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) |
| 184 | test=main.FALSE |
| 185 | |
| 186 | utilities.assert_equals(expect=main.TRUE,actual=test) |
| 187 | |
| 188 | def CASE3(self,main) : |
| 189 | ''' |
| 190 | Second case is to time the convergence time of a topology for ONOS. |
| 191 | It shuts down the ONOS, drops keyspace, starts ONOS... |
| 192 | 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. |
| 193 | ''' |
| 194 | import time |
| 195 | main.log.report("Time convergence for switches -> all ONOS nodes in cluster") |
| 196 | main.case("Timing Onos Convergence for switch -> all ONOS nodes in cluster") |
| 197 | main.step("Bringing ONOS down...") |
| 198 | main.log.info("all switch no controllers") |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 199 | for i in range(1,int(main.params['NR_Switches'])+1): |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 200 | main.Mininet1.delete_sw_controller("s"+str(i)) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 201 | main.log.info("bringing ONOS down") |
| 202 | main.ONOS1.stop() |
| 203 | main.ONOS2.stop() |
| 204 | main.ONOS3.stop() |
| 205 | main.ONOS4.stop() |
| 206 | #main.log.info("Dropping keyspace...") |
| 207 | #main.ONOS1.drop_keyspace() |
| 208 | time.sleep(5) |
| 209 | main.log.info("Bringing ONOS up") |
| 210 | main.ONOS1.start() |
| 211 | time.sleep(5) |
| 212 | main.ONOS2.start() |
| 213 | main.ONOS2.start_rest() |
| 214 | main.ONOS3.start() |
| 215 | main.ONOS4.start() |
| 216 | main.ONOS1.isup() |
| 217 | main.ONOS2.isup() |
| 218 | main.ONOS3.isup() |
| 219 | main.ONOS4.isup() |
| 220 | main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 221 | main.log.info("Pointing the Switches at ALL controllers... then BEGIN time") |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 222 | for i in range(1,int(main.params['NR_Switches'])+1): |
| 223 | main.Mininet1.assign_sw_controller(sw=str(i),count=4,ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'],ip2=main.params['CTRL']['ip2'],port2=main.params['CTRL']['port2'],ip3=main.params['CTRL']['ip3'],port3=main.params['CTRL']['port3'],ip4=main.params['CTRL']['ip4'],port4=main.params['CTRL']['port4']) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 224 | t1 = time.time() |
| 225 | for i in range(15) : |
| 226 | result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 227 | if result == 1 : |
| 228 | break |
| 229 | else : |
| 230 | time.sleep(1) |
| 231 | t2 = time.time() |
| 232 | conv_time = t2 - t1 |
| 233 | main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 234 | if result == 1 : |
| 235 | main.log.report( "Convergence time of : %f seconds" % conv_time ) |
| 236 | if float(conv_time) < float(main.params['TargetTime']) : |
| 237 | test=main.TRUE |
| 238 | main.log.info("Time is less then supplied target time") |
| 239 | else: |
| 240 | test=main.FALSE |
| 241 | main.log.info("Time is greater then supplied target time") |
| 242 | else : |
| 243 | main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) |
| 244 | test=main.FALSE |
| 245 | |
| 246 | utilities.assert_equals(expect=main.TRUE,actual=test) |
| 247 | |
| 248 | def CASE4(self,main) : |
| 249 | ''' |
| 250 | Second case is to time the convergence time of a topology for ONOS. |
| 251 | It shuts down the ONOS, drops keyspace, starts ONOS... |
| 252 | 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. |
| 253 | ''' |
| 254 | import time |
| 255 | main.log.report("Time convergence for switches -> Divide switches equall among all nodes in cluster") |
| 256 | main.case("Timing Onos Convergence for even single controller distribution") |
| 257 | main.step("Bringing ONOS down...") |
| 258 | main.log.info("all switch no controllers") |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 259 | for i in range(1,int(main.params['NR_Switches'])+1): |
| 260 | main.Mininet1.delete_sw_controller("s"+str(i)) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 261 | main.log.info("bringing ONOS down") |
| 262 | main.ONOS1.stop() |
| 263 | main.ONOS2.stop() |
| 264 | main.ONOS3.stop() |
| 265 | main.ONOS4.stop() |
| 266 | #main.log.info("Dropping keyspace...") |
| 267 | #main.ONOS1.drop_keyspace() |
| 268 | time.sleep(5) |
| 269 | main.log.info("Bringing ONOS up") |
| 270 | main.ONOS1.start() |
| 271 | time.sleep(5) |
| 272 | main.ONOS2.start() |
| 273 | main.ONOS2.start_rest() |
| 274 | main.ONOS3.start() |
| 275 | main.ONOS4.start() |
| 276 | main.ONOS1.isup() |
| 277 | main.ONOS2.isup() |
| 278 | main.ONOS3.isup() |
| 279 | main.ONOS4.isup() |
| 280 | main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 281 | |
| 282 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 283 | main.log.info("Pointing the Switches to alternating controllers... then BEGIN time") |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 284 | count = 0 |
| 285 | for i in range(1,int(main.params['NR_Switches'])+1): |
Jon Hall | de7bbe8 | 2014-05-23 17:04:31 -0700 | [diff] [blame] | 286 | num = (count % 4)+1 |
Jon Hall | e00b7e4 | 2014-05-23 12:00:33 -0700 | [diff] [blame] | 287 | #num = count % len(controllers) #TODO: check number of controllers in cluster |
| 288 | main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip'+str(num)],port1=main.params['CTRL']['port'+str(num)]) |
| 289 | count = count + 1 |
| 290 | |
| 291 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 292 | t1 = time.time() |
| 293 | for i in range(15) : |
| 294 | result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 295 | if result == 1 : |
| 296 | break |
| 297 | else : |
| 298 | time.sleep(1) |
| 299 | t2 = time.time() |
| 300 | conv_time = t2 - t1 |
| 301 | main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 302 | if result == 1 : |
| 303 | main.log.report( "Convergence time of : %f seconds" % conv_time ) |
| 304 | if float(conv_time) < float(main.params['TargetTime']) : |
| 305 | test=main.TRUE |
| 306 | main.log.info("Time is less then supplied target time") |
| 307 | else: |
| 308 | test=main.FALSE |
| 309 | main.log.info("Time is greater then supplied target time") |
| 310 | else : |
| 311 | main.log.report( "ONOS did NOT converge over : %f seconds" % conv_time ) |
| 312 | test=main.FALSE |
| 313 | |
| 314 | utilities.assert_equals(expect=main.TRUE,actual=test) |
| 315 | |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 316 | def CASE66(self, main): |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 317 | main.log.report("Checking ONOS logs for exceptions") |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 318 | count = 0 |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 319 | check1 = main.ONOS1.check_exceptions() |
| 320 | main.log.report("Exceptions in ONOS1 logs: \n" + check1) |
| 321 | check2 = main.ONOS2.check_exceptions() |
| 322 | main.log.report("Exceptions in ONOS2 logs: \n" + check2) |
| 323 | check3 = main.ONOS3.check_exceptions() |
| 324 | main.log.report("Exceptions in ONOS3 logs: \n" + check3) |
| 325 | check4 = main.ONOS4.check_exceptions() |
| 326 | main.log.report("Exceptions in ONOS4 logs: \n" + check4) |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 327 | result = main.TRUE |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 328 | if (check1 or check2 or check3 or check4): |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 329 | result = main.FALSE |
| 330 | count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines()) |
| 331 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs") |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 332 | |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 333 | |