admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 1 | |
| 2 | class RCOnosPerf4nodes: |
| 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 |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 15 | main.case("Initial Setup") |
| 16 | main.step("Stopping ONOS") |
| 17 | main.ONOS1.stop_all() |
| 18 | main.ONOS2.stop_all() |
| 19 | main.ONOS3.stop_all() |
| 20 | main.ONOS4.stop_all() |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 21 | main.Zookeeper1.start() |
| 22 | main.Zookeeper2.start() |
| 23 | main.Zookeeper3.start() |
| 24 | main.Zookeeper4.start() |
| 25 | main.RamCloud1.del_db() |
| 26 | main.RamCloud2.del_db() |
| 27 | main.RamCloud3.del_db() |
| 28 | main.RamCloud4.del_db() |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 29 | main.step("Start tcpdump on mn") |
| 30 | main.Mininet1.start_tcpdump(main.params['tcpdump']['filename'], intf = main.params['tcpdump']['intf'], port = main.params['tcpdump']['port']) |
| 31 | main.step("Starting ONOS") |
| 32 | main.ONOS1.start_all() |
| 33 | main.ONOS2.start_all() |
| 34 | main.ONOS3.start_all() |
| 35 | main.ONOS4.start_all() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 36 | main.ONOS1.start_rest() |
| 37 | time.sleep(5) |
| 38 | test= main.ONOS1.rest_status() |
| 39 | if test == main.FALSE: |
| 40 | main.ONOS1.start_rest() |
| 41 | main.ONOS1.get_version() |
| 42 | main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections") |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 43 | main.step("Testing startup Zookeeper") |
| 44 | data = main.Zookeeper1.isup() |
| 45 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...") |
| 46 | main.step("Testing startup RamCloud") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 47 | data = main.RamCloud1.status_serv() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 48 | if data == main.FALSE: |
| 49 | main.RamCloud1.stop_coor() |
| 50 | main.RamCloud1.stop_serv() |
| 51 | main.RamCloud2.stop_serv() |
| 52 | main.RamCloud3.stop_serv() |
| 53 | main.RamCloud4.stop_serv() |
| 54 | |
| 55 | time.sleep(5) |
| 56 | main.RamCloud1.start_coor() |
| 57 | main.RamCloud1.start_serv() |
| 58 | main.RamCloud2.start_serv() |
| 59 | main.RamCloud3.start_serv() |
| 60 | main.RamCloud4.start_serv() |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 61 | data = main.RamCloud1.status_serv() |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 62 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...") |
| 63 | main.step("Testing startup ONOS") |
| 64 | data = main.ONOS1.isup() |
| 65 | data = data and main.ONOS2.isup() |
| 66 | data = data and main.ONOS3.isup() |
| 67 | data = data and main.ONOS4.isup() |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 68 | for i in range(3): |
| 69 | if data == main.FALSE: |
| 70 | main.log.report("Something is funny... rechecking ONOS") |
| 71 | time.sleep(5) |
| 72 | data = main.ONOS1.isup() |
| 73 | data = data and main.ONOS2.isup() |
| 74 | data = data and main.ONOS3.isup() |
| 75 | data = data and main.ONOS4.isup() |
| 76 | else: |
| 77 | break |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 78 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...") |
| 79 | |
| 80 | def CASE2(self,main) : |
| 81 | ''' |
| 82 | Makes sure that the HW links are all up |
| 83 | Verifies that at least one mininet host exists. |
| 84 | Proves that there is actually a mininet that we are working with |
| 85 | ''' |
| 86 | import time |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 87 | import re |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 88 | main.step("Checking if MN switches exist") |
| 89 | main.log.report("Check if MN switches exist") |
| 90 | #result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 91 | #for i in range(2): |
| 92 | # if result == main.FALSE: |
| 93 | # time.sleep(5) |
| 94 | # result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 95 | # else: |
| 96 | # break |
| 97 | #main.step("Verifying the result") |
| 98 | #utilities.assert_equals(expect=main.TRUE,actual=result,onpass="MN switches exist",onfail="MN is missing switches and or links...") |
| 99 | |
| 100 | main.step("assigning ONOS controllers to switches") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 101 | data = main.TRUE |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 102 | for i in range(25): |
| 103 | if i < 3: |
| 104 | j=i+1 |
| 105 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 106 | controllers = main.Mininet1.get_sw_controller("s"+str(j)) |
| 107 | |
| 108 | if re.search("tcp:"+main.params['CTRL']['ip1'],controllers): |
| 109 | main.log.report("SW" + str(j) + " Master Controller Set Correctly") |
| 110 | data = data and main.TRUE |
| 111 | else: |
| 112 | main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!") |
| 113 | data = main.FALSE |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 114 | time.sleep(1) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 115 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 116 | main.Mininet1.assign_sw_controller(sw=str(j),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']) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 117 | |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 118 | elif i >= 3 and i < 5: |
| 119 | j=i+1 |
| 120 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2']) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 121 | controllers = main.Mininet1.get_sw_controller("s"+str(j)) |
| 122 | if re.search("tcp:"+ main.params['CTRL']['ip2'],controllers): |
| 123 | main.log.report("SW" + str(j) + " Master Controller Set Correctly") |
| 124 | data = data and main.TRUE |
| 125 | else: |
| 126 | main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!") |
| 127 | data = main.FALSE |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 128 | time.sleep(1) |
| 129 | main.Mininet1.assign_sw_controller(sw=str(j),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']) |
| 130 | elif i >= 5 and i < 15: |
| 131 | j=i+1 |
| 132 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3']) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 133 | controllers = main.Mininet1.get_sw_controller("s"+str(j)) |
| 134 | if re.search("tcp:"+ main.params['CTRL']['ip3'],controllers): |
| 135 | main.log.report("SW" + str(j) + " Master Controller Set Correctly") |
| 136 | data = data and main.TRUE |
| 137 | else: |
| 138 | main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!") |
| 139 | data = main.FALSE |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 140 | time.sleep(1) |
| 141 | main.Mininet1.assign_sw_controller(sw=str(j),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']) |
| 142 | else: |
| 143 | j=i+16 |
| 144 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4']) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 145 | |
| 146 | controllers = main.Mininet1.get_sw_controller("s"+str(j)) |
| 147 | if re.search("tcp:"+ main.params['CTRL']['ip4'],controllers): |
| 148 | main.log.report("SW" + str(j) + " Master Controller Set Correctly") |
| 149 | data = data and main.TRUE |
| 150 | else: |
| 151 | main.log.report("SW" + str(j) + " MASTER CONTROLLER SET INCORRECTLY!!") |
| 152 | data = main.FALSE |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 153 | time.sleep(1) |
| 154 | main.Mininet1.assign_sw_controller(sw=str(j),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']) |
| 155 | main.Mininet1.get_sw_controller("s1") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 156 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Mininet Controllers Set!",onfail="Mininet Controllers not correct!!!!!!!!!!!!!!!!!!!!") |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 157 | time.sleep(5) |
| 158 | |
| 159 | def CASE3(self,main) : |
| 160 | ''' |
| 161 | Verifies that ONOS sees the right topology... |
| 162 | ''' |
| 163 | import time |
| 164 | main.log.report("checking if ONOS sees the right topo...") |
| 165 | main.case("TOPO check") |
| 166 | main.step("calling rest calls") |
| 167 | for i in range(4): |
| 168 | result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 169 | time.sleep(5) |
| 170 | if result == 1: |
| 171 | break |
| 172 | if result == 0: |
| 173 | main.ONOS1.start() |
| 174 | main.ONOS2.start() |
| 175 | main.ONOS3.start() |
| 176 | main.ONOS4.start() |
| 177 | time.sleep(45) |
| 178 | for i in range(4): |
| 179 | result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 180 | time.sleep(5) |
| 181 | if result == 1: |
| 182 | break |
| 183 | utilities.assert_equals(expect=1,actual=result) |
| 184 | |
| 185 | def CASE4(self,main) : |
| 186 | ''' |
| 187 | This Test case: |
| 188 | - Clears out any leftover flows |
| 189 | - Adds new flows into ONOS |
| 190 | - Checks flows up to 10 times waiting for each flow to be caluculated and no "NOT" statements inte get_flow |
| 191 | ''' |
| 192 | import time |
| 193 | main.log.report("Deleting and adding flows") |
| 194 | main.case("Taking care of these flows!") |
| 195 | main.step("Cleaning out any leftover flows...") |
| 196 | main.log.info("deleting...") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 197 | main.ONOS1.rm_intents() |
Jon Hall | e80ef8c | 2014-04-29 15:29:13 -0700 | [diff] [blame] | 198 | # main.ONOS1.delete_flow("all") |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 199 | main.log.info("adding...") |
| 200 | t1 = time.time() |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 201 | main.ONOS1.add_intents() |
Jon Hall | e80ef8c | 2014-04-29 15:29:13 -0700 | [diff] [blame] | 202 | # main.ONOS1.add_flow(main.params['FLOWDEF']) |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 203 | main.log.info("Checking...") |
| 204 | for i in range(15): |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 205 | #result = main.ONOS1.check_flow() |
| 206 | result = main.TRUE |
admin | cb59391 | 2014-04-14 10:34:41 -0700 | [diff] [blame] | 207 | if result == main.TRUE: |
| 208 | t2 = time.time() |
| 209 | main.log.info( 'Adding flows took %0.3f s' % (t2-t1)) |
| 210 | break |
| 211 | time.sleep(5) |
| 212 | main.log.info("Checking Flows again...") |
| 213 | |
| 214 | strtTime = time.time() |
| 215 | count = 1 |
| 216 | i = 6 |
| 217 | while i < 16 : |
| 218 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 219 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 220 | if ping == main.FALSE and count < 3: |
| 221 | count = count + 1 |
| 222 | i = 6 |
| 223 | main.log.info("Ping failed, making attempt number "+str(count)+" in 10 seconds") |
| 224 | time.sleep(10) |
| 225 | elif ping == main.FALSE and count ==3: |
| 226 | main.log.error("Ping test failed") |
| 227 | i = 17 |
| 228 | result = main.FALSE |
| 229 | elif ping == main.TRUE: |
| 230 | i = i + 1 |
| 231 | result = main.TRUE |
| 232 | endTime = time.time() |
| 233 | if result == main.TRUE: |
| 234 | main.log.info("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 235 | else: |
| 236 | main.log.info("\tPING TEST FAIL") |
| 237 | |
| 238 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="flows are good",onfail="FLOWS not correct") |
| 239 | |
| 240 | main.log.report("checking if ONOS sees the right topo...") |
| 241 | main.case("TOPO check") |
| 242 | main.step("calling rest calls") |
| 243 | for i in range(3): |
| 244 | result = main.ONOS1.check_status(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 245 | time.sleep(5) |
| 246 | if result == 1: |
| 247 | break |
| 248 | |
| 249 | def CASE5(self,main) : |
| 250 | ''' |
| 251 | Tests a single ping |
| 252 | ''' |
| 253 | main.log.report("Testing a single ping") |
| 254 | main.case("Testing ping...") |
| 255 | ping_result = main.Mininet4.pingHost(src=main.params['PING']['source1'],target=main.params['PING']['target1']) |
| 256 | utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 257 | |
| 258 | |
| 259 | def CASE6(self,main) : |
| 260 | ''' |
| 261 | Starts continuous pings on the Mininet nodes |
| 262 | ''' |
| 263 | main.log.report("Starting continuous ping, then toggle a single link in the center triangle") |
| 264 | import time |
| 265 | import os |
| 266 | main.case("Starting long ping... ") |
| 267 | main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1']) |
| 268 | main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2']) |
| 269 | main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3']) |
| 270 | main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4']) |
| 271 | main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5']) |
| 272 | main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6']) |
| 273 | main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7']) |
| 274 | main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8']) |
| 275 | main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9']) |
| 276 | main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10']) |
| 277 | main.step("Check that the pings are going") |
| 278 | result = main.Mininet4.pingstatus(src=main.params['PING']['source1']) |
| 279 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2']) |
| 280 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3']) |
| 281 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4']) |
| 282 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5']) |
| 283 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6']) |
| 284 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7']) |
| 285 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8']) |
| 286 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9']) |
| 287 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10']) |
| 288 | main.step( "Link down number of iterations: " + main.params['Iterations'] ) |
| 289 | for i in range(int(main.params['Iterations'])): |
| 290 | main.log.info("Bringing Link down... ") |
| 291 | main.Mininet1.link(END1="s1",END2="s2",OPTION="down") |
| 292 | main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " ) |
| 293 | time.sleep( int(main.params['WaitTime']) ) |
| 294 | main.log.info("Bringing Link up... ") |
| 295 | main.Mininet1.link(END1="s1",END2="s2",OPTION="up") |
| 296 | main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " ) |
| 297 | time.sleep( int(main.params['WaitTime']) ) |
| 298 | main.case("Killing remote ping processes ") |
| 299 | result = result & main.Mininet4.pingKill() |
| 300 | utilities.assert_equals(expect=main.TRUE,actual=result) |
| 301 | |
| 302 | |
| 303 | def CASE7(self,main) : |
| 304 | ''' |
| 305 | Processes all of the ping data and outputs raw data and an overall average |
| 306 | ''' |
| 307 | import os |
| 308 | import time |
| 309 | main.log.report("Process ping data (Fail is time is >20 seconds)") |
| 310 | main.case("Processing Ping data") |
| 311 | time.sleep(3) |
| 312 | #result=os.popen("/home/admin/tools/shell.sh " + main.params['Iterations']).read() |
| 313 | try: |
| 314 | result=os.popen("/home/admin/ONLabTest/TestON/scripts/get_reroute_times.py").read() |
| 315 | average=result.split(":")[1] |
| 316 | main.log.info( "Reroute times are... " ) |
| 317 | main.log.report( result + " seconds" ) |
| 318 | try: |
| 319 | if float(average) < float(main.params['TargetTime']) : |
| 320 | test=main.TRUE |
| 321 | else: |
| 322 | test=main.FALSE |
| 323 | except ValueError: |
| 324 | main.log.error("Data is corrupted") |
| 325 | test=main.FALSE |
| 326 | except: |
| 327 | main.log.report("No data") |
| 328 | test=main.FALSE |
| 329 | utilities.assert_equals(expect=main.TRUE,actual=test,onpass="Average is less then the target time!",onfail="Average is worse then target time... ") |
| 330 | |
| 331 | def CASE8(self,main) : |
| 332 | ''' |
| 333 | Starts continuous pings on the Mininet nodes |
| 334 | ''' |
| 335 | main.log.report("Start continuous pings, then toggle multiple links in center triangle") |
| 336 | import time |
| 337 | import os |
| 338 | time.sleep(20) |
| 339 | main.case("Starting long ping... ") |
| 340 | main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1']) |
| 341 | main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2']) |
| 342 | main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3']) |
| 343 | main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4']) |
| 344 | main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5']) |
| 345 | main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6']) |
| 346 | main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7']) |
| 347 | main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8']) |
| 348 | main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9']) |
| 349 | main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10']) |
| 350 | main.step("Check that the pings are going") |
| 351 | result = main.Mininet4.pingstatus(src=main.params['PING']['source1']) |
| 352 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2']) |
| 353 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3']) |
| 354 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4']) |
| 355 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5']) |
| 356 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6']) |
| 357 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7']) |
| 358 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8']) |
| 359 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9']) |
| 360 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10']) |
| 361 | main.step( "Making topo change while flows are rerouting") |
| 362 | main.step( "Link down number of iterations: " + main.params['Iterations'] ) |
| 363 | for i in range(int(main.params['Iterations'])): |
| 364 | main.log.info("s1-s2 link down") |
| 365 | main.Mininet1.link(END1="s1",END2="s2",OPTION="down") |
| 366 | main.Mininet1.link(END1="s1",END2="s3",OPTION="up") |
| 367 | main.Mininet1.link(END1="s2",END2="s3",OPTION="up") |
| 368 | |
| 369 | time.sleep(5) |
| 370 | |
| 371 | main.log.info("s1-s2 link up | s1-s3 link down | s2-s3 link down") |
| 372 | main.Mininet1.link(END1="s1",END2="s2",OPTION="up") |
| 373 | main.Mininet1.link(END1="s1",END2="s3",OPTION="down") |
| 374 | main.Mininet1.link(END1="s2",END2="s3",OPTION="down") |
| 375 | |
| 376 | main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " ) |
| 377 | time.sleep( int(main.params['WaitTime']) + 60 ) |
| 378 | |
| 379 | main.case("Killing remote ping processes ") |
| 380 | result = result & main.Mininet4.pingKill() |
| 381 | utilities.assert_equals(expect=main.TRUE,actual=result) |
| 382 | main.log.info("Make sure all links in triangle are up") |
| 383 | main.Mininet1.link(END1="s1",END2="s2",OPTION="up") |
| 384 | main.Mininet1.link(END1="s1",END2="s3",OPTION="up") |
| 385 | main.Mininet1.link(END1="s2",END2="s3",OPTION="up") |
| 386 | |
| 387 | def CASE9(self,main) : |
| 388 | ''' |
| 389 | Starts continuous pings on the Mininet nodes |
| 390 | ''' |
| 391 | main.log.report("Start continuous pings, then toggle one link in center triangle and start/stop 1 ONOS node") |
| 392 | import time |
| 393 | import os |
| 394 | |
| 395 | time.sleep(20) |
| 396 | main.case("Starting long ping... ") |
| 397 | main.Mininet4.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1']) |
| 398 | main.Mininet4.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2']) |
| 399 | main.Mininet4.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3']) |
| 400 | main.Mininet4.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4']) |
| 401 | main.Mininet4.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5']) |
| 402 | main.Mininet4.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6']) |
| 403 | main.Mininet4.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7']) |
| 404 | main.Mininet4.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8']) |
| 405 | main.Mininet4.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9']) |
| 406 | main.Mininet4.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10']) |
| 407 | main.step("Check that the pings are going") |
| 408 | result = main.Mininet4.pingstatus(src=main.params['PING']['source1']) |
| 409 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source2']) |
| 410 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source3']) |
| 411 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source4']) |
| 412 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source5']) |
| 413 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source6']) |
| 414 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source7']) |
| 415 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source8']) |
| 416 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source9']) |
| 417 | result = result & main.Mininet4.pingstatus(src=main.params['PING']['source10']) |
| 418 | main.step( "Making topo change while flows are rerouting") |
| 419 | main.step( "Link down number of iterations: " + main.params['Iterations'] ) |
| 420 | for i in range(int(main.params['Iterations'])): |
| 421 | main.log.info("s1-s2 link down | Onos 1 down") |
| 422 | main.Mininet1.link(END1="s1",END2="s2",OPTION="down") |
| 423 | if i % 4 == 0: |
| 424 | main.ONOS1.stop() |
| 425 | elif i % 4 == 1: |
| 426 | main.ONOS2.stop() |
| 427 | elif i % 4 == 2: |
| 428 | main.ONOS3.stop() |
| 429 | else: |
| 430 | main.ONOS4.stop() |
| 431 | |
| 432 | time.sleep(5) |
| 433 | |
| 434 | main.log.info("s1-s2 link up | Onos 1 back up") |
| 435 | main.Mininet1.link(END1="s1",END2="s2",OPTION="up") |
| 436 | if i % 4 == 0: |
| 437 | main.ONOS1.start() |
| 438 | main.ONOS1.isup() |
| 439 | elif i % 4 == 1: |
| 440 | main.ONOS2.start() |
| 441 | main.ONOS2.isup() |
| 442 | elif i % 4 == 2: |
| 443 | main.ONOS3.start() |
| 444 | main.ONOS3.isup() |
| 445 | else: |
| 446 | main.ONOS4.start() |
| 447 | main.ONOS4.isup() |
| 448 | |
| 449 | main.log.info( "Waiting " + main.params['WaitTime'] + " seconds.... " ) |
| 450 | time.sleep( int(main.params['WaitTime']) ) |
| 451 | |
| 452 | main.case("Killing remote ping processes ") |
| 453 | result = result & main.Mininet4.pingKill() |
| 454 | utilities.assert_equals(expect=main.TRUE,actual=result) |
| 455 | |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 456 | def CASE66(self, main): |
| 457 | main.log.report("Checking ONOS logs for exceptions") |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 458 | count = 0 |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 459 | check1 = main.ONOS1.check_exceptions() |
| 460 | main.log.report("Exceptions in ONOS1 logs: \n" + check1) |
| 461 | check2 = main.ONOS2.check_exceptions() |
| 462 | main.log.report("Exceptions in ONOS2 logs: \n" + check2) |
| 463 | check3 = main.ONOS3.check_exceptions() |
| 464 | main.log.report("Exceptions in ONOS3 logs: \n" + check3) |
| 465 | check4 = main.ONOS4.check_exceptions() |
| 466 | main.log.report("Exceptions in ONOS4 logs: \n" + check4) |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 467 | result = main.TRUE |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 468 | if (check1 or check2 or check3 or check4): |
Jon Hall | 1c4d274 | 2014-05-22 10:57:05 -0700 | [diff] [blame] | 469 | result = main.FALSE |
| 470 | count = len(check1.splitlines()) + len(check2.splitlines()) + len(check3.splitlines()) + len(check4.splitlines()) |
| 471 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="No Exceptions found in the logs",onfail=str(count) + " Exceptions were found in the logs") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 472 | main.Mininet1.stop_tcpdump() |
admin | 1723f1c | 2014-05-19 16:08:39 -0700 | [diff] [blame] | 473 | |
| 474 | |