SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 1 | |
| 2 | class RCOnosCHO4nodes : |
| 3 | |
| 4 | def __init__(self) : |
| 5 | self.default = '' |
| 6 | |
| 7 | #********************************************************************************************************************************************************************************************** |
| 8 | #Test startup |
| 9 | #Tests the startup of Zookeeper1, RamCloud1, and ONOS1 to be certain that all started up successfully |
| 10 | def CASE1(self,main) : #Check to be sure ZK, Cass, and ONOS are up, then get ONOS version |
| 11 | import time |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 12 | main.ONOS1.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties") |
| 13 | main.ONOS2.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties") |
| 14 | main.ONOS3.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties") |
| 15 | main.ONOS4.handle.sendline("cp ~/onos.properties.proactive ~/ONOS/conf/onos.properties") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 16 | |
SeanCorcoran | f4ee258 | 2014-04-16 17:12:30 -0700 | [diff] [blame] | 17 | main.Zookeeper1.start() |
SeanCorcoran | f4ee258 | 2014-04-16 17:12:30 -0700 | [diff] [blame] | 18 | main.Zookeeper2.start() |
| 19 | main.Zookeeper3.start() |
| 20 | main.Zookeeper4.start() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 21 | main.RamCloud1.stop_coor() |
| 22 | main.RamCloud1.stop_serv() |
| 23 | main.RamCloud2.stop_serv() |
| 24 | main.RamCloud3.stop_serv() |
| 25 | main.RamCloud4.stop_serv() |
| 26 | time.sleep(10) |
| 27 | main.RamCloud1.del_db() |
| 28 | main.RamCloud2.del_db() |
| 29 | main.RamCloud3.del_db() |
| 30 | main.RamCloud4.del_db() |
| 31 | time.sleep(10) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 32 | main.log.report("Pulling latest code from github to all nodes") |
| 33 | for i in range(2): |
| 34 | uptodate = main.ONOS1.git_pull() |
| 35 | main.ONOS2.git_pull() |
| 36 | main.ONOS3.git_pull() |
| 37 | main.ONOS4.git_pull() |
| 38 | ver1 = main.ONOS1.get_version() |
| 39 | ver2 = main.ONOS4.get_version() |
| 40 | if ver1==ver2: |
| 41 | break |
| 42 | elif i==1: |
| 43 | main.ONOS2.git_pull("ONOS1 master") |
| 44 | main.ONOS3.git_pull("ONOS1 master") |
| 45 | main.ONOS4.git_pull("ONOS1 master") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 46 | #if uptodate==0 |
| 47 | if 1: |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 48 | main.ONOS1.git_compile() |
| 49 | main.ONOS2.git_compile() |
| 50 | main.ONOS3.git_compile() |
| 51 | main.ONOS4.git_compile() |
| 52 | main.ONOS1.print_version() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 53 | # main.RamCloud1.git_pull() |
| 54 | # main.RamCloud2.git_pull() |
| 55 | # main.RamCloud3.git_pull() |
| 56 | # main.RamCloud4.git_pull() |
| 57 | # main.ONOS1.get_version() |
| 58 | # main.ONOS2.get_version() |
| 59 | # main.ONOS3.get_version() |
| 60 | # main.ONOS4.get_version() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 61 | main.RamCloud1.start_coor() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 62 | time.sleep(1) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 63 | main.RamCloud1.start_serv() |
| 64 | main.RamCloud2.start_serv() |
| 65 | main.RamCloud3.start_serv() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 66 | main.RamCloud4.start_serv() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 67 | main.ONOS1.start() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 68 | time.sleep(5) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 69 | main.ONOS2.start() |
| 70 | main.ONOS3.start() |
| 71 | main.ONOS4.start() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 72 | main.ONOS1.start_rest() |
| 73 | time.sleep(10) |
| 74 | test= main.ONOS1.rest_status() |
| 75 | if test == main.FALSE: |
| 76 | main.ONOS1.start_rest() |
| 77 | main.ONOS1.get_version() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 78 | main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections") |
| 79 | main.case("Checking if the startup was clean...") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 80 | main.step("Testing startup Zookeeper") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 81 | data = main.Zookeeper1.isup() |
| 82 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="Zookeeper is up!",onfail="Zookeeper is down...") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 83 | main.step("Testing startup RamCloud") |
| 84 | data = main.RamCloud1.status_serv() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 85 | if data == main.FALSE: |
| 86 | main.RamCloud1.stop_coor() |
| 87 | main.RamCloud1.stop_serv() |
| 88 | main.RamCloud2.stop_serv() |
| 89 | main.RamCloud3.stop_serv() |
| 90 | main.RamCloud4.stop_serv() |
| 91 | |
| 92 | time.sleep(5) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 93 | main.RamCloud1.start_coor() |
| 94 | main.RamCloud1.start_serv() |
| 95 | main.RamCloud2.start_serv() |
| 96 | main.RamCloud3.start_serv() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 97 | main.RamCloud4.start_serv() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 98 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="RamCloud is up!",onfail="RamCloud is down...") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 99 | main.step("Testing startup ONOS") |
| 100 | data = main.ONOS1.isup() |
| 101 | for i in range(3): |
| 102 | if data == main.FALSE: |
| 103 | #main.log.report("Something is funny... restarting ONOS") |
| 104 | #main.ONOS1.stop() |
| 105 | time.sleep(3) |
| 106 | #main.ONOS1.start() |
| 107 | #time.sleep(5) |
| 108 | data = main.ONOS1.isup() |
| 109 | else: |
| 110 | break |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 111 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 112 | time.sleep(20) |
| 113 | |
| 114 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 115 | #********************************************************************************************************************************************************************************************** |
| 116 | #Assign Controllers |
| 117 | #This test first checks the ip of a mininet host, to be certain that the mininet exists(Host is defined in Params as <CASE1><destination>). |
| 118 | #Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers. |
| 119 | #NOTE: The reason why all four controllers are assigned although one was already assigned as the master is due to the 'ovs-vsctl set-controller' command erases all present controllers if |
| 120 | # the controllers already assigned to the switch are not specified. |
| 121 | |
| 122 | def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches |
| 123 | import time |
| 124 | main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4") |
| 125 | main.case("Checking if one MN host exists") |
| 126 | main.step("Host IP Checking using checkIP") |
| 127 | result = main.Mininet1.checkIP(main.params['CASE1']['destination']) |
| 128 | main.step("Verifying the result") |
| 129 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured") |
| 130 | main.step("assigning ONOS controllers to switches") |
| 131 | for i in range(25): |
| 132 | if i < 3: |
| 133 | j=i+1 |
| 134 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) |
| 135 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 136 | 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']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 137 | elif i >= 3 and i < 5: |
| 138 | j=i+1 |
| 139 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2']) |
| 140 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 141 | 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']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 142 | elif i >= 5 and i < 15: |
| 143 | j=i+1 |
| 144 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3']) |
| 145 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 146 | 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']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 147 | else: |
| 148 | j=i+16 |
| 149 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4']) |
| 150 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 151 | 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']) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 152 | result = main.Mininet1.get_sw_controller("s1") |
| 153 | if result: |
| 154 | result = main.TRUE |
| 155 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="S1 assigned to controller",onfail="S1 not assigned to controller") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 156 | |
| 157 | for i in range(9): |
| 158 | if result == main.FALSE: |
| 159 | time.sleep(3) |
| 160 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 161 | else: |
| 162 | break |
| 163 | |
| 164 | # ********************************************************************************************************************************************************************************************** |
| 165 | #Add Flows |
| 166 | #Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test |
| 167 | #NOTE: THE FLOWDEF FILE MUST BE PRESENT ON TESTON VM!!! TestON will copy the file from its home machine into /tmp/flowtmp on the machine the ONOS instance is present on |
| 168 | |
| 169 | def CASE3(self,main) : #Delete any remnant flows, then add flows, and time how long it takes flow tables to update |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 170 | main.log.report("Delete any flows from previous tests, then add flows using intents and wait for switch flow tables to update") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 171 | import time |
| 172 | |
| 173 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 174 | for counter in range(9): |
| 175 | if result == main.FALSE: |
| 176 | time.sleep(3) |
| 177 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 178 | else: |
| 179 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 180 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 181 | |
| 182 | main.case("Taking care of these flows!") |
| 183 | main.step("Cleaning out any leftover flows...") |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 184 | #main.ONOS1.delete_flow("all") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 185 | main.ONOS1.rm_intents() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 186 | time.sleep(5) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 187 | main.ONOS1.purge_intents() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 188 | strtTime = time.time() |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 189 | main.ONOS1.add_intents() |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 190 | main.case("Checking flows with pings") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 191 | |
| 192 | pingAttempts = main.params['pingAttempts'] |
| 193 | pingSleep = main.params['pingSleep'] |
| 194 | |
| 195 | count = 1 |
| 196 | i = 6 |
| 197 | while i < 16 : |
| 198 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 199 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 200 | if ping == main.FALSE and count < int(pingAttempts): |
| 201 | count = count + 1 |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 202 | # i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 203 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 204 | time.sleep(int(pingSleep)) |
| 205 | elif ping == main.FALSE and count == int(pingAttempts): |
| 206 | main.log.error("Ping test failed") |
| 207 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 208 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 209 | elif ping == main.TRUE: |
| 210 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 211 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 212 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 213 | result = result and result2 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 214 | if result == main.TRUE: |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 215 | main.log.report("\n\t\t\t\tTime from pushing intents to successful ping test: "+str(round(endTime-strtTime,2))+" seconds") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 216 | else: |
| 217 | main.log.report("\tFlows failed check") |
| 218 | |
| 219 | main.step("Verifying the result") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 220 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 221 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 222 | |
| 223 | #********************************************************************************************************************************************************************************************** |
| 224 | #This test case removes Controllers 2,3, and 4 then performs a ping test. |
| 225 | #The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned. |
| 226 | #The ping test performs single pings on hosts from opposite sides of the topology. If one ping fails, the test waits 5 seconds before trying again. |
| 227 | #If the ping test fails 6 times, then the test case will return false |
| 228 | |
| 229 | def CASE4(self,main) : |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 230 | main.log.report("Assign all switches to just one ONOS instance then ping until all hosts are reachable or fail after 6 attempts") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 231 | import time |
| 232 | import random |
| 233 | |
| 234 | random.seed(None) |
| 235 | |
| 236 | num = random.randint(1,4) |
| 237 | if num == 1: |
| 238 | ip = main.params['CTRL']['ip1'] |
| 239 | port = main.params['CTRL']['port1'] |
| 240 | elif num == 2: |
| 241 | ip = main.params['CTRL']['ip2'] |
| 242 | port = main.params['CTRL']['port2'] |
| 243 | elif num == 3: |
| 244 | ip = main.params['CTRL']['ip3'] |
| 245 | port = main.params['CTRL']['port3'] |
| 246 | else: |
| 247 | ip = main.params['CTRL']['ip4'] |
| 248 | port = main.params['CTRL']['port4'] |
| 249 | |
| 250 | main.log.report("ONOS"+str(num)+" will be the sole controller") |
| 251 | for i in range(25): |
| 252 | if i < 15: |
| 253 | j=i+1 |
| 254 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port) #Assigning a single controller removes all other controllers |
| 255 | else: |
| 256 | j=i+16 |
| 257 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port) |
| 258 | |
| 259 | strtTime = time.time() |
| 260 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 261 | for counter in range(9): |
| 262 | if result == main.FALSE: |
| 263 | time.sleep(3) |
| 264 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 265 | else: |
| 266 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 267 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 268 | |
| 269 | pingAttempts = main.params['pingAttempts'] |
| 270 | pingSleep = main.params['pingSleep'] |
| 271 | |
| 272 | count = 1 |
| 273 | i = 6 |
| 274 | while i < 16 : |
| 275 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 276 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 277 | if ping == main.FALSE and count < int(pingAttempts): |
| 278 | count = count + 1 |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 279 | # i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 280 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 281 | time.sleep(int(pingSleep)) |
| 282 | elif ping == main.FALSE and count == int(pingAttempts): |
| 283 | main.log.error("Ping test failed") |
| 284 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 285 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 286 | elif ping == main.TRUE: |
| 287 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 288 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 289 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 290 | result = result and result2 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 291 | if result == main.TRUE: |
| 292 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 293 | else: |
| 294 | main.log.report("\tPING TEST FAIL") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 295 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 296 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 297 | |
| 298 | # ********************************************************************************************************************************************************************************************** |
| 299 | #This test case restores the controllers removed by Case 4 then performs a ping test. |
| 300 | |
| 301 | def CASE5(self,main) : |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 302 | main.log.report("Restore switch assignments to all 4 ONOS instances then ping until all hosts are reachable or fail after 6 attempts") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 303 | import time |
| 304 | for i in range(25): |
| 305 | if i < 15: |
| 306 | j=i+1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 307 | 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']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 308 | else: |
| 309 | j=i+16 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 310 | 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']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 311 | |
| 312 | strtTime = time.time() |
| 313 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 314 | for counter in range(9): |
| 315 | if result == main.FALSE: |
| 316 | time.sleep(3) |
| 317 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 318 | else: |
| 319 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 320 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 321 | |
| 322 | pingAttempts = main.params['pingAttempts'] |
| 323 | pingSleep = main.params['pingSleep'] |
| 324 | |
| 325 | count = 1 |
| 326 | i = 6 |
| 327 | while i < 16 : |
| 328 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 329 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 330 | if ping == main.FALSE and count < int(pingAttempts): |
| 331 | count = count + 1 |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 332 | # i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 333 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 334 | time.sleep(int(pingSleep)) |
| 335 | elif ping == main.FALSE and count == int(pingAttempts): |
| 336 | main.log.error("Ping test failed") |
| 337 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 338 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 339 | elif ping == main.TRUE: |
| 340 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 341 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 342 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 343 | result = result and result2 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 344 | if result == main.TRUE: |
| 345 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 346 | else: |
| 347 | main.log.report("\tPING TEST FAILED") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 348 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 349 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 350 | |
| 351 | # ********************************************************************************************************************************************************************************************** |
| 352 | #Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time |
| 353 | |
| 354 | def CASE6(self,main) : |
| 355 | main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts") |
| 356 | import time |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 357 | |
| 358 | #add a wait as a work around for a known bug where topology changes after a switch mastership change cuses intents to not reroute |
| 359 | time.sleep(30) |
| 360 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 361 | main.case("Bringing Link down... ") |
| 362 | result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down") |
| 363 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 364 | |
| 365 | #add a wait as a work around for a known bug where topology changes after a switch mastership change cuses intents to not reroute |
| 366 | time.sleep(30) |
| 367 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 368 | |
| 369 | strtTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 370 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 371 | for counter in range(9): |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 372 | if result1 == main.FALSE: |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 373 | time.sleep(3) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 374 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 375 | else: |
| 376 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 377 | utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 378 | |
| 379 | pingAttempts = main.params['pingAttempts'] |
| 380 | pingSleep = main.params['pingSleep'] |
| 381 | |
| 382 | count = 1 |
| 383 | i = 6 |
| 384 | while i < 16 : |
| 385 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 386 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 387 | if ping == main.FALSE and count < int(pingAttempts): |
| 388 | count = count + 1 |
| 389 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 390 | #i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 391 | time.sleep(int(pingSleep)) |
| 392 | elif ping == main.FALSE and count == int(pingAttempts): |
| 393 | main.log.error("Ping test failed") |
| 394 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 395 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 396 | elif ping == main.TRUE: |
| 397 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 398 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 399 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 400 | result = result and result2 and result1 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 401 | if result == main.TRUE: |
| 402 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 403 | else: |
| 404 | main.log.report("\tPING TEST FAILED") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 405 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 406 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 407 | |
| 408 | # ********************************************************************************************************************************************************************************************** |
| 409 | #Brings the link that Case 6 took down back up, then runs a ping test to view reroute time |
| 410 | |
| 411 | def CASE7(self,main) : |
| 412 | main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts") |
| 413 | import time |
| 414 | main.case("Bringing Link up... ") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 415 | |
| 416 | #add a wait as a work around for a known bug where topology changes after a switch mastership change cuses intents to not reroute |
| 417 | time.sleep(30) |
| 418 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 419 | result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up") |
| 420 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...") |
| 421 | |
| 422 | strtTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 423 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 424 | for counter in range(9): |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 425 | if result1 == main.FALSE: |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 426 | time.sleep(3) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 427 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 428 | else: |
| 429 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 430 | utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 431 | |
| 432 | pingAttempts = main.params['pingAttempts'] |
| 433 | pingSleep = main.params['pingSleep'] |
| 434 | |
| 435 | strtTime = time.time() |
| 436 | count = 1 |
| 437 | i = 6 |
| 438 | while i < 16 : |
| 439 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 440 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 441 | if ping == main.FALSE and count < int(pingAttempts): |
| 442 | count = count + 1 |
| 443 | main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 444 | #i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 445 | time.sleep(int(pingSleep)) |
| 446 | elif ping == main.FALSE and count == int(pingAttempts): |
| 447 | main.log.error("Ping test failed") |
| 448 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 449 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 450 | elif ping == main.TRUE: |
| 451 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 452 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 453 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 454 | result = result and result2 and result1 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 455 | if result == main.TRUE: |
| 456 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 457 | else: |
| 458 | main.log.report("\tPING TESTS FAILED") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 459 | |
| 460 | main.ONOS1.check_exceptions() |
| 461 | main.ONOS2.check_exceptions() |
| 462 | main.ONOS3.check_exceptions() |
| 463 | main.ONOS4.check_exceptions() |
| 464 | |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 465 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 466 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
| 467 | |
| 468 | #add a wait as a work around for a known bug where topology changes after a switch mastership change cuses intents to not reroute |
| 469 | time.sleep(30) |
| 470 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 471 | |
| 472 | |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 473 | # ********************************************************************************************************************************************************************************************** |
| 474 | # Runs reactive ping test |
| 475 | def CASE8(self,main) : |
| 476 | main.log.report("Reactive flow ping test:ping until the routes are active or fail after 10 attempts") |
| 477 | import time |
| 478 | |
| 479 | strtTime = time.time() |
| 480 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 481 | for counter in range(9): |
| 482 | if result == main.FALSE: |
| 483 | time.sleep(3) |
| 484 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 485 | else: |
| 486 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 487 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Topology check pass",onfail="Topology check FAIL") |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 488 | |
| 489 | pingAttempts = main.params['pingAttempts'] |
| 490 | pingSleep = main.params['pingSleep'] |
| 491 | |
| 492 | strtTime = time.time() |
| 493 | count = 1 |
| 494 | i = 6 |
| 495 | while i < 16 : |
| 496 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) ) |
| 497 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i)) |
| 498 | if ping == main.FALSE and count < int(pingAttempts): |
| 499 | count = count + 1 |
| 500 | main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds") |
| 501 | #i = 6 |
| 502 | time.sleep(int(pingSleep)) |
| 503 | elif ping == main.FALSE and count == int(pingAttempts): |
| 504 | main.log.error("Ping test failed") |
| 505 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 506 | result2 = main.FALSE |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 507 | elif ping == main.TRUE: |
| 508 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 509 | result2 = main.TRUE |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 510 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 511 | result = result and result2 |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 512 | if result == main.TRUE: |
| 513 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 514 | else: |
| 515 | main.log.report("\tPING TESTS FAILED") |
| 516 | |
| 517 | main.ONOS1.check_exceptions() |
| 518 | main.ONOS2.check_exceptions() |
| 519 | main.ONOS3.check_exceptions() |
| 520 | main.ONOS4.check_exceptions() |
| 521 | |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 522 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 523 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 524 | |
| 525 | |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame^] | 526 | # ****************************************************************************************************************************************************************** |
| 527 | # Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch |
| 528 | |
| 529 | def CASE9(self,main) : |
| 530 | main.case("Checking component status") |
| 531 | result = main.TRUE |
| 532 | |
| 533 | main.step("Checking Zookeeper status") |
| 534 | result1 = main.Zookeeper1.status() |
| 535 | if not result1: |
| 536 | main.log.report("Zookeeper1 encountered a tragic death!") |
| 537 | result2 = main.Zookeeper2.status() |
| 538 | if not result2: |
| 539 | main.log.report("Zookeeper2 encountered a tragic death!") |
| 540 | result3 = main.Zookeeper3.status() |
| 541 | if not result3: |
| 542 | main.log.report("Zookeeper3 encountered a tragic death!") |
| 543 | result4 = main.Zookeeper4.status() |
| 544 | if not result4: |
| 545 | main.log.report("Zookeeper4 encountered a tragic death!") |
| 546 | result = result and result1 and result2 and result3 and result4 |
| 547 | |
| 548 | main.step("Checking RamCloud status") |
| 549 | result5 = main.RamCloud1.status_coor() |
| 550 | if not result5: |
| 551 | main.log.report("RamCloud Coordinator1 encountered a tragic death!") |
| 552 | result6 = main.RamCloud1.status_serv() |
| 553 | if not result6: |
| 554 | main.log.report("RamCloud Server1 encountered a tragic death!") |
| 555 | result7 = main.RamCloud2.status_serv() |
| 556 | if not result7: |
| 557 | main.log.report("RamCloud Server2 encountered a tragic death!") |
| 558 | result8 = main.RamCloud3.status_serv() |
| 559 | if not result8: |
| 560 | main.log.report("RamCloud Server3 encountered a tragic death!") |
| 561 | result9 = main.RamCloud4.status_serv() |
| 562 | if not result9: |
| 563 | main.log.report("RamCloud Server4 encountered a tragic death!") |
| 564 | result = result and result5 and result6 and result7 and result8 and result9 |
| 565 | |
| 566 | |
| 567 | main.step("Checking ONOS status") |
| 568 | result10 = main.ONOS1.status() |
| 569 | if not result10: |
| 570 | main.log.report("ONOS1 core encountered a tragic death!") |
| 571 | result11 = main.ONOS2.status() |
| 572 | if not result11: |
| 573 | main.log.report("ONOS2 core encountered a tragic death!") |
| 574 | result12 = main.ONOS3.status() |
| 575 | if not result12: |
| 576 | main.log.report("ONOS3 core encountered a tragic death!") |
| 577 | result13 = main.ONOS4.status() |
| 578 | if not result13: |
| 579 | main.log.report("ONOS4 core encountered a tragic death!") |
| 580 | result = result and result10 and result11 and result12 and result13 |
| 581 | |
| 582 | |
| 583 | |
| 584 | rest_result = main.ONOS1.rest_status() |
| 585 | if not rest_result: |
| 586 | main.log.report("Simple Rest GUI server is not running on ONOS1") |
| 587 | |
| 588 | |
| 589 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="All Components are running",onfail="One or more components failed") |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 590 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 591 | # ****************************************************************************************************************************************************************** |
| 592 | # Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch |
| 593 | |
| 594 | def CASE21(self,main) : |
| 595 | import json |
| 596 | from drivers.common.api.onosrestapidriver import * |
| 597 | main.log.report("Test device discovery function, by attach/detach/move host h1 from s1->s6->s1.") |
| 598 | main.log.report("Check initially hostMAC exist on the mininet...") |
| 599 | host = main.params['YANK']['hostname'] |
| 600 | mac = main.params['YANK']['hostmac'] |
| 601 | RestIP1 = main.params['RESTCALL']['restIP1'] |
| 602 | RestIP2 = main.params['RESTCALL']['restIP2'] |
| 603 | RestPort = main.params['RESTCALL']['restPort'] |
| 604 | url = main.params['RESTCALL']['restURL'] |
| 605 | #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort) |
| 606 | |
| 607 | main.log.info("\n\t\t\t\t ping issue one ping from" + str(host) + "to generate arp to switch. Ping result is not important" ) |
| 608 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
| 609 | restcall = OnosRestApiDriver() |
| 610 | Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac) |
| 611 | try: |
| 612 | attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID'] |
| 613 | ip_found = Hoststatus[0]['ipv4'][0] |
| 614 | except: |
| 615 | Reststatus = 0 |
| 616 | |
| 617 | if Reststatus == 1: |
| 618 | main.log.report("\tFound host " + host + " attached to switchDPID = " + attachedSW) |
| 619 | if ip_found != None: |
| 620 | main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).") |
| 621 | result = main.TRUE |
| 622 | else: |
| 623 | main.log.report("\t Found host attached to switch, but no IP address discovered.") |
| 624 | result = main.FALSE |
| 625 | else: |
| 626 | main.log.report("\t Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED") |
| 627 | result = main.FALSE |
| 628 | |
| 629 | ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 ##### |
| 630 | |
| 631 | main.log.report("Yank out s1-eth1") |
| 632 | main.case("Yankout s6-eth1 (link to h1) from s1") |
| 633 | result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf']) |
| 634 | time.sleep(3) |
| 635 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...") |
| 636 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
| 637 | Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac) |
| 638 | try: |
| 639 | attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID'] |
| 640 | except: |
| 641 | Reststatus = 0 |
| 642 | if Reststatus == 0: |
| 643 | main.log.report("Attempt to yank out s1-eth1 from s1 sucessfully") |
| 644 | result = main.TRUE |
| 645 | else: |
| 646 | main.log.report("Attempt to yank out s1-eht1 from s1 failed.") |
| 647 | result = main.FALSE |
| 648 | |
| 649 | ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ###### |
| 650 | main.log.report("Plug s1-eth1 into s6") |
| 651 | main.case("Plug s1-eth1 to s6") |
| 652 | result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf']) |
| 653 | time.sleep(3) |
| 654 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...") |
| 655 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
| 656 | Reststatus, Hoststatus = restcall.find_host(RestIP2,RestPort,url,mac) |
| 657 | try: |
| 658 | attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID'] |
| 659 | ip_found = Hoststatus[0]['ipv4'][0] |
| 660 | except: |
| 661 | Reststatus = 0 |
| 662 | if Reststatus == 0: |
| 663 | main.log.report("Attempt to plug s1-eth1 to s6 FAILED") |
| 664 | result = main.FALSE |
| 665 | elif attachedSW == "00:00:00:00:00:00:00:06": |
| 666 | main.log.report("Attempt to plug s1-eht1 to s6 succeded.") |
| 667 | if ip_found != None: |
| 668 | main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).") |
| 669 | result = main.TRUE |
| 670 | else: |
| 671 | main.log.report("\t Found host attached to switch, but no IP address discovered.") |
| 672 | result = main.FALSE |
| 673 | else: |
| 674 | main.log.report( "FAILED to attach s1-eth1 to s6 correctly!") |
| 675 | result = main.FALSE |
| 676 | |
| 677 | ###### Step to put interface "s1-eth1" back to s1"##### |
| 678 | main.log.report("Move s1-eth1 back on to s1") |
| 679 | main.case("Move s1-eth1 back to s1") |
| 680 | result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf']) |
| 681 | time.sleep(3) |
| 682 | retult = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf']) |
| 683 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...") |
| 684 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
| 685 | Reststatus, Hoststatus = restcall.find_host(RestIP1,RestPort,url,mac) |
| 686 | try: |
| 687 | attachedSW = Hoststatus[0]['attachmentPoint'][0]['switchDPID'] |
| 688 | ip_found = Hoststatus[0]['ipv4'][0] |
| 689 | except: |
| 690 | Reststatus = 0 |
| 691 | if Reststatus == 0: |
| 692 | main.log.report("Attempt to plug s1-eth1 back to s1 FAILED") |
| 693 | result = main.FALSE |
| 694 | elif attachedSW == "00:00:00:00:00:00:00:01": |
| 695 | main.log.report("Attempt to plug s1-eht1 back to s1 succeded.") |
| 696 | if ip_found != None: |
| 697 | main.log.report("\t IP discovered is ip_found ( " + ip_found + " ).") |
| 698 | result = main.TRUE |
| 699 | else: |
| 700 | main.log.report("\t Found host attached to switch, but no IP address discovered.") |
| 701 | result = main.FALSE |
| 702 | else: |
| 703 | main.log.report( "FAIL to attach s1-eth1 to s1 correctly!") |
| 704 | result = main.FALSE |
| 705 | |
| 706 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED") |
| 707 | |
| 708 | |
| 709 | |
| 710 | |