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