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 | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 12 | main.ONOS1.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties") |
| 13 | main.ONOS2.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties") |
| 14 | main.ONOS3.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties") |
| 15 | main.ONOS4.handle.sendline("cp ~/onos.properties.reactive ~/ONOS/conf/onos.properties") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 16 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 17 | main.ONOS1.stop_all() |
| 18 | main.ONOS2.stop_all() |
| 19 | main.ONOS3.stop_all() |
| 20 | main.ONOS4.stop_all() |
SeanCorcoran | f4ee258 | 2014-04-16 17:12:30 -0700 | [diff] [blame] | 21 | main.Zookeeper1.start() |
SeanCorcoran | f4ee258 | 2014-04-16 17:12:30 -0700 | [diff] [blame] | 22 | main.Zookeeper2.start() |
| 23 | main.Zookeeper3.start() |
| 24 | main.Zookeeper4.start() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 25 | main.RamCloud1.stop_coor() |
| 26 | main.RamCloud1.stop_serv() |
| 27 | main.RamCloud2.stop_serv() |
| 28 | main.RamCloud3.stop_serv() |
| 29 | main.RamCloud4.stop_serv() |
| 30 | time.sleep(10) |
| 31 | main.RamCloud1.del_db() |
| 32 | main.RamCloud2.del_db() |
| 33 | main.RamCloud3.del_db() |
| 34 | main.RamCloud4.del_db() |
| 35 | time.sleep(10) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 36 | main.log.report("Pulling latest code from github to all nodes") |
| 37 | for i in range(2): |
| 38 | uptodate = main.ONOS1.git_pull() |
| 39 | main.ONOS2.git_pull() |
| 40 | main.ONOS3.git_pull() |
| 41 | main.ONOS4.git_pull() |
| 42 | ver1 = main.ONOS1.get_version() |
| 43 | ver2 = main.ONOS4.get_version() |
| 44 | if ver1==ver2: |
| 45 | break |
| 46 | elif i==1: |
| 47 | main.ONOS2.git_pull("ONOS1 master") |
| 48 | main.ONOS3.git_pull("ONOS1 master") |
| 49 | main.ONOS4.git_pull("ONOS1 master") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 50 | #if uptodate==0 |
| 51 | if 1: |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 52 | main.ONOS1.git_compile() |
| 53 | main.ONOS2.git_compile() |
| 54 | main.ONOS3.git_compile() |
| 55 | main.ONOS4.git_compile() |
| 56 | main.ONOS1.print_version() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 57 | # main.RamCloud1.git_pull() |
| 58 | # main.RamCloud2.git_pull() |
| 59 | # main.RamCloud3.git_pull() |
| 60 | # main.RamCloud4.git_pull() |
| 61 | # main.ONOS1.get_version() |
| 62 | # main.ONOS2.get_version() |
| 63 | # main.ONOS3.get_version() |
| 64 | # main.ONOS4.get_version() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 65 | main.RamCloud1.start_coor() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 66 | time.sleep(1) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 67 | main.RamCloud1.start_serv() |
| 68 | main.RamCloud2.start_serv() |
| 69 | main.RamCloud3.start_serv() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 70 | main.RamCloud4.start_serv() |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 71 | main.ONOS1.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 72 | time.sleep(5) |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 73 | main.ONOS2.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ") |
| 74 | main.ONOS3.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ") |
| 75 | main.ONOS4.start("env JVM_OPTS=\"-Xmx2g -Xms2g -Xmn800m\" ") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 76 | main.ONOS1.start_rest() |
| 77 | time.sleep(10) |
| 78 | test= main.ONOS1.rest_status() |
| 79 | if test == main.FALSE: |
| 80 | main.ONOS1.start_rest() |
| 81 | main.ONOS1.get_version() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 82 | main.log.report("Startup check Zookeeper1, RamCloud1, and ONOS1 connections") |
| 83 | main.case("Checking if the startup was clean...") |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 84 | main.step("Testing startup Zookeeper") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 85 | data = main.Zookeeper1.isup() |
| 86 | 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] | 87 | main.step("Testing startup RamCloud") |
| 88 | data = main.RamCloud1.status_serv() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 89 | if data == main.FALSE: |
| 90 | main.RamCloud1.stop_coor() |
| 91 | main.RamCloud1.stop_serv() |
| 92 | main.RamCloud2.stop_serv() |
| 93 | main.RamCloud3.stop_serv() |
| 94 | main.RamCloud4.stop_serv() |
| 95 | |
| 96 | time.sleep(5) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 97 | main.RamCloud1.start_coor() |
| 98 | main.RamCloud1.start_serv() |
| 99 | main.RamCloud2.start_serv() |
| 100 | main.RamCloud3.start_serv() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 101 | main.RamCloud4.start_serv() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 102 | 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] | 103 | main.step("Testing startup ONOS") |
| 104 | data = main.ONOS1.isup() |
| 105 | for i in range(3): |
| 106 | if data == main.FALSE: |
| 107 | #main.log.report("Something is funny... restarting ONOS") |
| 108 | #main.ONOS1.stop() |
| 109 | time.sleep(3) |
| 110 | #main.ONOS1.start() |
| 111 | #time.sleep(5) |
| 112 | data = main.ONOS1.isup() |
| 113 | else: |
| 114 | break |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 115 | utilities.assert_equals(expect=main.TRUE,actual=data,onpass="ONOS is up and running!",onfail="ONOS didn't start...") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 116 | time.sleep(10) |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 117 | |
| 118 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 119 | #********************************************************************************************************************************************************************************************** |
| 120 | #Assign Controllers |
| 121 | #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>). |
| 122 | #Then the program assignes each ONOS instance a single controller to a switch(To be the initial master), then assigns all controllers. |
| 123 | #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 |
| 124 | # the controllers already assigned to the switch are not specified. |
| 125 | |
| 126 | def CASE2(self,main) : #Make sure mininet exists, then assign controllers to switches |
| 127 | import time |
| 128 | main.log.report("Check if mininet started properly, then assign controllers ONOS 1,2,3 and 4") |
| 129 | main.case("Checking if one MN host exists") |
| 130 | main.step("Host IP Checking using checkIP") |
| 131 | result = main.Mininet1.checkIP(main.params['CASE1']['destination']) |
| 132 | main.step("Verifying the result") |
| 133 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host IP address configured",onfail="Host IP address not configured") |
| 134 | main.step("assigning ONOS controllers to switches") |
| 135 | for i in range(25): |
| 136 | if i < 3: |
| 137 | j=i+1 |
| 138 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1']) |
| 139 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 140 | 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] | 141 | elif i >= 3 and i < 5: |
| 142 | j=i+1 |
| 143 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port2']) |
| 144 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 145 | 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] | 146 | elif i >= 5 and i < 15: |
| 147 | j=i+1 |
| 148 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port3']) |
| 149 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 150 | 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] | 151 | else: |
| 152 | j=i+16 |
| 153 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port4']) |
| 154 | time.sleep(1) |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 155 | 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] | 156 | result = main.Mininet1.get_sw_controller("s1") |
| 157 | if result: |
| 158 | result = main.TRUE |
| 159 | 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] | 160 | |
| 161 | for i in range(9): |
| 162 | if result == main.FALSE: |
| 163 | time.sleep(3) |
| 164 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 165 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 166 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 167 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 168 | main.ONOS4.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] | 169 | break |
| 170 | |
| 171 | # ********************************************************************************************************************************************************************************************** |
| 172 | #Add Flows |
| 173 | #Deletes any remnant flows from any previous test, add flows from the file labeled <FLOWDEF>, then runs the check flow test |
| 174 | #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 |
| 175 | |
| 176 | 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] | 177 | 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] | 178 | import time |
| 179 | |
| 180 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 181 | for counter in range(9): |
| 182 | if result == main.FALSE: |
| 183 | time.sleep(3) |
| 184 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 185 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 186 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 187 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 188 | main.ONOS4.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] | 189 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 190 | 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] | 191 | |
| 192 | main.case("Taking care of these flows!") |
| 193 | main.step("Cleaning out any leftover flows...") |
Jon Hall | 0e09e6a | 2014-04-25 13:42:15 -0700 | [diff] [blame] | 194 | #main.ONOS1.delete_flow("all") |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 195 | main.ONOS1.rm_intents() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 196 | time.sleep(5) |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 197 | main.ONOS1.purge_intents() |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 198 | strtTime = time.time() |
Jon Hall | bd795bf | 2014-06-18 09:46:32 -0700 | [diff] [blame] | 199 | main.ONOS1.add_intents() |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 200 | main.case("Checking flows with pings") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 201 | |
| 202 | pingAttempts = main.params['pingAttempts'] |
| 203 | pingSleep = main.params['pingSleep'] |
| 204 | |
| 205 | count = 1 |
| 206 | i = 6 |
| 207 | while i < 16 : |
| 208 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 209 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 210 | if ping == main.FALSE and count < int(pingAttempts): |
| 211 | count = count + 1 |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 212 | # i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 213 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 214 | time.sleep(int(pingSleep)) |
| 215 | elif ping == main.FALSE and count == int(pingAttempts): |
| 216 | main.log.error("Ping test failed") |
| 217 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 218 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 219 | elif ping == main.TRUE: |
| 220 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 221 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 222 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 223 | result = result and result2 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 224 | if result == main.TRUE: |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 225 | 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] | 226 | else: |
| 227 | main.log.report("\tFlows failed check") |
| 228 | |
| 229 | main.step("Verifying the result") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 230 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 231 | 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] | 232 | |
| 233 | #********************************************************************************************************************************************************************************************** |
| 234 | #This test case removes Controllers 2,3, and 4 then performs a ping test. |
| 235 | #The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned. |
| 236 | #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. |
| 237 | #If the ping test fails 6 times, then the test case will return false |
| 238 | |
| 239 | def CASE4(self,main) : |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 240 | 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] | 241 | import time |
| 242 | import random |
| 243 | |
| 244 | random.seed(None) |
| 245 | |
| 246 | num = random.randint(1,4) |
| 247 | if num == 1: |
| 248 | ip = main.params['CTRL']['ip1'] |
| 249 | port = main.params['CTRL']['port1'] |
| 250 | elif num == 2: |
| 251 | ip = main.params['CTRL']['ip2'] |
| 252 | port = main.params['CTRL']['port2'] |
| 253 | elif num == 3: |
| 254 | ip = main.params['CTRL']['ip3'] |
| 255 | port = main.params['CTRL']['port3'] |
| 256 | else: |
| 257 | ip = main.params['CTRL']['ip4'] |
| 258 | port = main.params['CTRL']['port4'] |
| 259 | |
| 260 | main.log.report("ONOS"+str(num)+" will be the sole controller") |
| 261 | for i in range(25): |
| 262 | if i < 15: |
| 263 | j=i+1 |
| 264 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port) #Assigning a single controller removes all other controllers |
| 265 | else: |
| 266 | j=i+16 |
| 267 | main.Mininet1.assign_sw_controller(sw=str(j),ip1=ip,port1=port) |
| 268 | |
| 269 | strtTime = time.time() |
| 270 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 271 | for counter in range(9): |
| 272 | if result == main.FALSE: |
| 273 | time.sleep(3) |
| 274 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 275 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 276 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 277 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 278 | main.ONOS4.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] | 279 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 280 | 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] | 281 | |
| 282 | pingAttempts = main.params['pingAttempts'] |
| 283 | pingSleep = main.params['pingSleep'] |
| 284 | |
| 285 | count = 1 |
| 286 | i = 6 |
| 287 | while i < 16 : |
| 288 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 289 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 290 | if ping == main.FALSE and count < int(pingAttempts): |
| 291 | count = count + 1 |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 292 | # i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 293 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 294 | time.sleep(int(pingSleep)) |
| 295 | elif ping == main.FALSE and count == int(pingAttempts): |
| 296 | main.log.error("Ping test failed") |
| 297 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 298 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 299 | elif ping == main.TRUE: |
| 300 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 301 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 302 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 303 | result = result and result2 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 304 | if result == main.TRUE: |
| 305 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 306 | else: |
| 307 | main.log.report("\tPING TEST FAIL") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 308 | main.ONOS1.show_intent(main.params['RestIP']) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 309 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 310 | 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] | 311 | |
| 312 | # ********************************************************************************************************************************************************************************************** |
| 313 | #This test case restores the controllers removed by Case 4 then performs a ping test. |
| 314 | |
| 315 | def CASE5(self,main) : |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 316 | 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] | 317 | import time |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 318 | |
| 319 | #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute |
| 320 | time.sleep(10) |
| 321 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 322 | for i in range(25): |
| 323 | if i < 15: |
| 324 | j=i+1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 325 | 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] | 326 | else: |
| 327 | j=i+16 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 328 | 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] | 329 | |
| 330 | strtTime = time.time() |
| 331 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 332 | for counter in range(9): |
| 333 | if result == main.FALSE: |
| 334 | time.sleep(3) |
| 335 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 336 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 337 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 338 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 339 | main.ONOS4.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] | 340 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 341 | 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] | 342 | |
| 343 | pingAttempts = main.params['pingAttempts'] |
| 344 | pingSleep = main.params['pingSleep'] |
| 345 | |
| 346 | count = 1 |
| 347 | i = 6 |
| 348 | while i < 16 : |
| 349 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 350 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 351 | if ping == main.FALSE and count < int(pingAttempts): |
| 352 | count = count + 1 |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 353 | # i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 354 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 355 | time.sleep(int(pingSleep)) |
| 356 | elif ping == main.FALSE and count == int(pingAttempts): |
| 357 | main.log.error("Ping test failed") |
| 358 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 359 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 360 | elif ping == main.TRUE: |
| 361 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 362 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 363 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 364 | result = result and result2 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 365 | if result == main.TRUE: |
| 366 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 367 | else: |
| 368 | main.log.report("\tPING TEST FAILED") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 369 | main.ONOS1.show_intent(main.params['RestIP']) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 370 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 371 | 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] | 372 | |
| 373 | # ********************************************************************************************************************************************************************************************** |
| 374 | #Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time |
| 375 | |
| 376 | def CASE6(self,main) : |
| 377 | main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts") |
| 378 | import time |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 379 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 380 | #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute |
| 381 | time.sleep(10) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 382 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 383 | main.case("Bringing Link down... ") |
| 384 | result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down") |
| 385 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...") |
| 386 | |
| 387 | strtTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 388 | 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] | 389 | for counter in range(9): |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 390 | if result1 == main.FALSE: |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 391 | time.sleep(3) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 392 | 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] | 393 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 394 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 395 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 396 | main.ONOS4.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] | 397 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 398 | 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] | 399 | |
| 400 | pingAttempts = main.params['pingAttempts'] |
| 401 | pingSleep = main.params['pingSleep'] |
| 402 | |
| 403 | count = 1 |
| 404 | i = 6 |
| 405 | while i < 16 : |
| 406 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 407 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 408 | if ping == main.FALSE and count < int(pingAttempts): |
| 409 | count = count + 1 |
| 410 | 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] | 411 | #i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 412 | time.sleep(int(pingSleep)) |
| 413 | elif ping == main.FALSE and count == int(pingAttempts): |
| 414 | main.log.error("Ping test failed") |
| 415 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 416 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 417 | elif ping == main.TRUE: |
| 418 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 419 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 420 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 421 | result = result and result2 and result1 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 422 | if result == main.TRUE: |
| 423 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 424 | else: |
| 425 | main.log.report("\tPING TEST FAILED") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 426 | main.ONOS1.show_intent(main.params['RestIP']) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 427 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 428 | 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] | 429 | |
| 430 | # ********************************************************************************************************************************************************************************************** |
| 431 | #Brings the link that Case 6 took down back up, then runs a ping test to view reroute time |
| 432 | |
| 433 | def CASE7(self,main) : |
| 434 | main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts") |
| 435 | import time |
| 436 | main.case("Bringing Link up... ") |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 437 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 438 | #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute |
| 439 | time.sleep(10) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 440 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 441 | result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up") |
| 442 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...") |
| 443 | |
| 444 | strtTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 445 | 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] | 446 | for counter in range(9): |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 447 | if result1 == main.FALSE: |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 448 | time.sleep(3) |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 449 | 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] | 450 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 451 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 452 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 453 | main.ONOS4.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] | 454 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 455 | 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] | 456 | |
| 457 | pingAttempts = main.params['pingAttempts'] |
| 458 | pingSleep = main.params['pingSleep'] |
| 459 | |
| 460 | strtTime = time.time() |
| 461 | count = 1 |
| 462 | i = 6 |
| 463 | while i < 16 : |
| 464 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(i+25) ) |
| 465 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+25)) |
| 466 | if ping == main.FALSE and count < int(pingAttempts): |
| 467 | count = count + 1 |
| 468 | 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] | 469 | #i = 6 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 470 | time.sleep(int(pingSleep)) |
| 471 | elif ping == main.FALSE and count == int(pingAttempts): |
| 472 | main.log.error("Ping test failed") |
| 473 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 474 | result2 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 475 | elif ping == main.TRUE: |
| 476 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 477 | result2 = main.TRUE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 478 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 479 | result = result and result2 and result1 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 480 | if result == main.TRUE: |
| 481 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 482 | else: |
| 483 | main.log.report("\tPING TESTS FAILED") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 484 | main.ONOS1.show_intent(main.params['RestIP']) |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 485 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 486 | print main.ONOS1.check_exceptions() |
| 487 | print main.ONOS2.check_exceptions() |
| 488 | print main.ONOS3.check_exceptions() |
| 489 | print main.ONOS4.check_exceptions() |
Jon Hall | 010f541 | 2014-05-21 15:10:12 -0700 | [diff] [blame] | 490 | |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 491 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 492 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
| 493 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 494 | |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 495 | # ********************************************************************************************************************************************************************************************** |
| 496 | # Runs reactive ping test |
| 497 | def CASE8(self,main) : |
| 498 | main.log.report("Reactive flow ping test:ping until the routes are active or fail after 10 attempts") |
| 499 | import time |
| 500 | |
| 501 | strtTime = time.time() |
| 502 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 503 | for counter in range(9): |
| 504 | if result == main.FALSE: |
| 505 | time.sleep(3) |
| 506 | result = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 507 | else: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 508 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 509 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 510 | main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 511 | break |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 512 | 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] | 513 | |
| 514 | pingAttempts = main.params['pingAttempts'] |
| 515 | pingSleep = main.params['pingSleep'] |
| 516 | |
| 517 | strtTime = time.time() |
| 518 | count = 1 |
| 519 | i = 6 |
| 520 | while i < 16 : |
| 521 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) ) |
| 522 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i)) |
| 523 | if ping == main.FALSE and count < int(pingAttempts): |
| 524 | count = count + 1 |
| 525 | main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds") |
| 526 | #i = 6 |
| 527 | time.sleep(int(pingSleep)) |
| 528 | elif ping == main.FALSE and count == int(pingAttempts): |
| 529 | main.log.error("Ping test failed") |
| 530 | i = 17 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 531 | result2 = main.FALSE |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 532 | elif ping == main.TRUE: |
| 533 | i = i + 1 |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 534 | result2 = main.TRUE |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 535 | endTime = time.time() |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 536 | result = result and result2 |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 537 | if result == main.TRUE: |
| 538 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 539 | else: |
| 540 | main.log.report("\tPING TESTS FAILED") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 541 | main.ONOS1.show_intent(main.params['RestIP']) |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 542 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 543 | print main.ONOS1.check_exceptions() |
| 544 | print main.ONOS2.check_exceptions() |
| 545 | print main.ONOS3.check_exceptions() |
| 546 | print main.ONOS4.check_exceptions() |
| 547 | |
| 548 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 549 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
| 550 | # ********************************************************************************************************************************************************************************************** |
| 551 | #Brings a link that all flows pass through in the mininet down, then runs a ping test to view reroute time |
| 552 | # This is the same as case 6, but specifically for the reactive tests |
| 553 | |
| 554 | def CASE61(self,main) : |
| 555 | main.log.report("Bring Link between s1 and s2 down, then ping until all hosts are reachable or fail after 10 attempts") |
| 556 | import time |
| 557 | |
| 558 | #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute |
| 559 | time.sleep(10) |
| 560 | |
| 561 | main.case("Bringing Link down... ") |
| 562 | result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="down") |
| 563 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link DOWN!",onfail="Link not brought down...") |
| 564 | |
| 565 | strtTime = time.time() |
| 566 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 567 | for counter in range(9): |
| 568 | if result1 == main.FALSE: |
| 569 | time.sleep(3) |
| 570 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 571 | else: |
| 572 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 573 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 574 | main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],str(int(main.params['NR_Links'])-2)) |
| 575 | break |
| 576 | utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL") |
| 577 | |
| 578 | pingAttempts = main.params['pingAttempts'] |
| 579 | pingSleep = main.params['pingSleep'] |
| 580 | |
| 581 | count = 1 |
| 582 | i = 6 |
| 583 | while i < 16 : |
| 584 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) ) |
| 585 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i)) |
| 586 | if ping == main.FALSE and count < int(pingAttempts): |
| 587 | count = count + 1 |
| 588 | main.log.report("Ping failed, making attempt number "+str(count)+" in "+str(pingSleep)+" seconds") |
| 589 | #i = 6 |
| 590 | time.sleep(int(pingSleep)) |
| 591 | elif ping == main.FALSE and count == int(pingAttempts): |
| 592 | main.log.error("Ping test failed") |
| 593 | i = 17 |
| 594 | result2 = main.FALSE |
| 595 | elif ping == main.TRUE: |
| 596 | i = i + 1 |
| 597 | result2 = main.TRUE |
| 598 | endTime = time.time() |
| 599 | result = result and result2 and result1 |
| 600 | if result == main.TRUE: |
| 601 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 602 | else: |
| 603 | main.log.report("\tPING TEST FAILED") |
| 604 | main.ONOS1.show_intent(main.params['RestIP']) |
| 605 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 606 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Testcase passed",onfail="Testcase failed") |
| 607 | |
| 608 | |
| 609 | # ********************************************************************************************************************************************************************************************** |
| 610 | #Brings the link that Case 6 took down back up, then runs a ping test to view reroute time |
| 611 | # Specifically for the Reactive tests |
| 612 | |
| 613 | def CASE71(self,main) : |
| 614 | main.log.report("Bring Link between s1 and s2 up, then ping until all hosts are reachable or fail after 10 attempts") |
| 615 | import time |
| 616 | main.case("Bringing Link up... ") |
| 617 | |
| 618 | #add a wait as a work around for a known bug where topology changes after a switch mastership change causes intents to not reroute |
| 619 | time.sleep(10) |
| 620 | |
| 621 | result = main.Mininet1.link(END1=main.params['LINK']['begin'],END2=main.params['LINK']['end'],OPTION="up") |
| 622 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Link UP!",onfail="Link not brought up...") |
| 623 | |
| 624 | strtTime = time.time() |
| 625 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 626 | for counter in range(9): |
| 627 | if result1 == main.FALSE: |
| 628 | time.sleep(3) |
| 629 | result1 = main.ONOS1.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 630 | else: |
| 631 | main.ONOS2.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 632 | main.ONOS3.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 633 | main.ONOS4.check_status_report(main.params['RestIP'],main.params['NR_Switches'],main.params['NR_Links']) |
| 634 | break |
| 635 | utilities.assert_equals(expect=main.TRUE,actual=result1,onpass="Topology check pass",onfail="Topology check FAIL") |
| 636 | |
| 637 | pingAttempts = main.params['pingAttempts'] |
| 638 | pingSleep = main.params['pingSleep'] |
| 639 | |
| 640 | strtTime = time.time() |
| 641 | count = 1 |
| 642 | i = 6 |
| 643 | while i < 16 : |
| 644 | main.log.info("\n\t\t\t\th"+str(i)+" IS PINGING h"+str(46-i) ) |
| 645 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(46-i)) |
| 646 | if ping == main.FALSE and count < int(pingAttempts): |
| 647 | count = count + 1 |
| 648 | main.log.report("Ping failed, making attempt number "+str(count)+" in " +str(pingSleep)+" seconds") |
| 649 | #i = 6 |
| 650 | time.sleep(int(pingSleep)) |
| 651 | elif ping == main.FALSE and count == int(pingAttempts): |
| 652 | main.log.error("Ping test failed") |
| 653 | i = 17 |
| 654 | result2 = main.FALSE |
| 655 | elif ping == main.TRUE: |
| 656 | i = i + 1 |
| 657 | result2 = main.TRUE |
| 658 | endTime = time.time() |
| 659 | result = result and result2 and result1 |
| 660 | if result == main.TRUE: |
| 661 | main.log.report("\tTime to complete ping test: "+str(round(endTime-strtTime,2))+" seconds") |
| 662 | else: |
| 663 | main.log.report("\tPING TESTS FAILED") |
| 664 | main.ONOS1.show_intent(main.params['RestIP']) |
| 665 | |
| 666 | print main.ONOS1.check_exceptions() |
| 667 | print main.ONOS2.check_exceptions() |
| 668 | print main.ONOS3.check_exceptions() |
| 669 | print main.ONOS4.check_exceptions() |
Jon Hall | f794798 | 2014-05-22 10:44:45 -0700 | [diff] [blame] | 670 | |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 671 | utilities.assert_equals(expect=main.TRUE,actual=result2,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE") |
| 672 | 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] | 673 | |
| 674 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 675 | |
| 676 | |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 677 | # ****************************************************************************************************************************************************************** |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 678 | # Check for ONOS Components health |
Jon Hall | 670808c | 2014-06-23 16:07:22 -0700 | [diff] [blame] | 679 | |
| 680 | def CASE9(self,main) : |
| 681 | main.case("Checking component status") |
| 682 | result = main.TRUE |
| 683 | |
| 684 | main.step("Checking Zookeeper status") |
| 685 | result1 = main.Zookeeper1.status() |
| 686 | if not result1: |
| 687 | main.log.report("Zookeeper1 encountered a tragic death!") |
| 688 | result2 = main.Zookeeper2.status() |
| 689 | if not result2: |
| 690 | main.log.report("Zookeeper2 encountered a tragic death!") |
| 691 | result3 = main.Zookeeper3.status() |
| 692 | if not result3: |
| 693 | main.log.report("Zookeeper3 encountered a tragic death!") |
| 694 | result4 = main.Zookeeper4.status() |
| 695 | if not result4: |
| 696 | main.log.report("Zookeeper4 encountered a tragic death!") |
| 697 | result = result and result1 and result2 and result3 and result4 |
| 698 | |
| 699 | main.step("Checking RamCloud status") |
| 700 | result5 = main.RamCloud1.status_coor() |
| 701 | if not result5: |
| 702 | main.log.report("RamCloud Coordinator1 encountered a tragic death!") |
| 703 | result6 = main.RamCloud1.status_serv() |
| 704 | if not result6: |
| 705 | main.log.report("RamCloud Server1 encountered a tragic death!") |
| 706 | result7 = main.RamCloud2.status_serv() |
| 707 | if not result7: |
| 708 | main.log.report("RamCloud Server2 encountered a tragic death!") |
| 709 | result8 = main.RamCloud3.status_serv() |
| 710 | if not result8: |
| 711 | main.log.report("RamCloud Server3 encountered a tragic death!") |
| 712 | result9 = main.RamCloud4.status_serv() |
| 713 | if not result9: |
| 714 | main.log.report("RamCloud Server4 encountered a tragic death!") |
| 715 | result = result and result5 and result6 and result7 and result8 and result9 |
| 716 | |
| 717 | |
| 718 | main.step("Checking ONOS status") |
| 719 | result10 = main.ONOS1.status() |
| 720 | if not result10: |
| 721 | main.log.report("ONOS1 core encountered a tragic death!") |
| 722 | result11 = main.ONOS2.status() |
| 723 | if not result11: |
| 724 | main.log.report("ONOS2 core encountered a tragic death!") |
| 725 | result12 = main.ONOS3.status() |
| 726 | if not result12: |
| 727 | main.log.report("ONOS3 core encountered a tragic death!") |
| 728 | result13 = main.ONOS4.status() |
| 729 | if not result13: |
| 730 | main.log.report("ONOS4 core encountered a tragic death!") |
| 731 | result = result and result10 and result11 and result12 and result13 |
| 732 | |
| 733 | |
| 734 | |
| 735 | rest_result = main.ONOS1.rest_status() |
| 736 | if not rest_result: |
| 737 | main.log.report("Simple Rest GUI server is not running on ONOS1") |
| 738 | |
| 739 | |
| 740 | 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] | 741 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 742 | # ****************************************************************************************************************************************************************** |
| 743 | # Test Device Discovery function by yanking s6:s6-eth0 interface and re-plug it into a switch |
| 744 | |
| 745 | def CASE21(self,main) : |
| 746 | import json |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 747 | main.log.report("Test device discovery function, by attach, detach, and move host h1 from s1->s6->s1. Per mininet naming, the name of the switch port the host attaches to will remain as 's1-eth1' throughout the test.") |
| 748 | main.log.report("Check initially hostMAC/IP exist on the mininet...") |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 749 | host = main.params['YANK']['hostname'] |
| 750 | mac = main.params['YANK']['hostmac'] |
| 751 | RestIP1 = main.params['RESTCALL']['restIP1'] |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 752 | RestPort = main.params['RESTCALL']['restPort'] |
| 753 | url = main.params['RESTCALL']['restURL'] |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 754 | |
| 755 | t_topowait = 5 |
| 756 | t_restwait = 0 |
| 757 | main.log.report( "Wait time from topo change to ping set to " + str(t_topowait)) |
| 758 | main.log.report( "Wait time from ping to rest call set to " + str(t_restwait)) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 759 | #print "host=" + host + "; RestIP=" + RestIP1 + "; RestPort=" + str(RestPort) |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 760 | time.sleep(t_topowait) |
| 761 | 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" ) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 762 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 763 | time.sleep(t_restwait) |
| 764 | Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac) |
| 765 | main.log.report("Number of host with MAC address = " + mac + " found by ONOS is: " + str(Reststatus)) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 766 | if Reststatus == 1: |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 767 | main.log.report("\t PASSED - Found host mac = " + mac + "; attached to switchDPID = " +"".join(Switch) + "; at port = " + str(Port[0])) |
| 768 | result1 = main.TRUE |
| 769 | elif Reststatus > 1: |
| 770 | main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " has " + str(Reststatus) + " duplicated mac addresses. FAILED") |
| 771 | main.log.report("switches are: " + "; ".join(Switch)) |
| 772 | main.log.report("Ports are: " + "; ".join(Port)) |
| 773 | result1 = main.FALSE |
| 774 | elif Reststatus == 0 and Switch == []: |
| 775 | main.log.report("\t FAILED - Host " + host + " with MAC:" + mac + " does not exist. FAILED") |
| 776 | result1 = main.FALSE |
| 777 | else:# check if rest server is working |
| 778 | main.log.error("Issue with find host") |
| 779 | result1 = main.FALSE |
| 780 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 781 | |
| 782 | ##### Step to yank out "s1-eth1" from s1, which is on autoONOS1 ##### |
| 783 | |
| 784 | main.log.report("Yank out s1-eth1") |
| 785 | main.case("Yankout s6-eth1 (link to h1) from s1") |
| 786 | result = main.Mininet1.yank(SW=main.params['YANK']['sw1'],INTF=main.params['YANK']['intf']) |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 787 | time.sleep(t_topowait) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 788 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank command suceeded",onfail="Yank command failed...") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 789 | |
| 790 | 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" ) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 791 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 792 | time.sleep(t_restwait) |
| 793 | Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac) |
| 794 | |
| 795 | main.log.report("Number of host with MAC = " + mac + " found by ONOS is: " + str(Reststatus)) |
| 796 | if Reststatus == 1: |
| 797 | main.log.report("\tFAILED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port)) |
| 798 | result2 = main.FALSE |
| 799 | elif Reststatus > 1: |
| 800 | main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED") |
| 801 | main.log.report("switches are: " + "; ".join(Switch)) |
| 802 | main.log.report("Ports are: " + "; ".join(Port)) |
| 803 | main.log.report("MACs are: " + "; ".join(MAC)) |
| 804 | result2 = main.FALSE |
| 805 | elif Reststatus == 0 and Switch == []: |
| 806 | main.log.report("\t PASSED - Host " + host + " with MAC:" + str(mac) + " does not exist. PASSED - host is not supposed to be attached to the switch.") |
| 807 | result2 = main.TRUE |
| 808 | else:# check if rest server is working |
| 809 | main.log.error("Issue with find host") |
| 810 | result2 = main.FALSE |
| 811 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 812 | ##### Step to plug "s1-eth1" to s6, which is on autoONOS3 ###### |
| 813 | main.log.report("Plug s1-eth1 into s6") |
| 814 | main.case("Plug s1-eth1 to s6") |
| 815 | result = main.Mininet1.plug(SW=main.params['PLUG']['sw6'],INTF=main.params['PLUG']['intf']) |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 816 | time.sleep(t_topowait) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 817 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Plug command suceeded",onfail="Plug command failed...") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 818 | 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" ) |
| 819 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 820 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 821 | time.sleep(t_restwait) |
| 822 | Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac) |
| 823 | |
| 824 | main.log.report("Number of host with MAC " + mac + " found by ONOS is: " + str(Reststatus)) |
| 825 | if Reststatus == 1: |
| 826 | main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0])) |
| 827 | result3 = main.TRUE |
| 828 | elif Reststatus > 1: |
| 829 | main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatus) + " duplicated IP addresses. FAILED") |
| 830 | main.log.report("switches are: " + "; ".join(Switch)) |
| 831 | main.log.report("Ports are: " + "; ".join(Port)) |
| 832 | main.log.report("MACs are: " + "; ".join(MAC)) |
| 833 | result3 = main.FALSE |
| 834 | elif Reststatus == 0 and Switch == []: |
| 835 | main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED") |
| 836 | result3 = main.FALSE |
| 837 | else:# check if rest server is working |
| 838 | main.log.error("Issue with find host") |
| 839 | result3 = main.FALSE |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 840 | |
| 841 | ###### Step to put interface "s1-eth1" back to s1"##### |
| 842 | main.log.report("Move s1-eth1 back on to s1") |
| 843 | main.case("Move s1-eth1 back to s1") |
| 844 | result = main.Mininet1.yank(SW=main.params['YANK']['sw6'],INTF=main.params['YANK']['intf']) |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 845 | time.sleep(t_topowait) |
| 846 | result = main.Mininet1.plug(SW=main.params['PLUG']['sw1'],INTF=main.params['PLUG']['intf']) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 847 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Yank/Plug command suceeded",onfail="Yank/Plug command failed...") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 848 | 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" ) |
| 849 | |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 850 | ping = main.Mininet1.pingHost(src = str(host),target = "10.0.0.254") |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 851 | time.sleep(t_restwait) |
| 852 | Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url, mac) |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 853 | |
Jon Hall | bb650fe | 2014-07-14 14:54:48 -0700 | [diff] [blame] | 854 | main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus)) |
| 855 | if Reststatus == 1: |
| 856 | main.log.report("\tPASSED - Found host MAC = " + mac + "; attached to switchDPID = " + "".join(Switch) + "; at port = " + str(Port[0])) |
| 857 | result4 = main.TRUE |
| 858 | elif Reststatus > 1: |
| 859 | main.log.report("\t FAILED - Host " + host + " with MAC:" + str(mac) + " has " + str(Reststatuas) + " duplicated IP addresses. FAILED") |
| 860 | main.log.report("switches are: " + "; ".join(Switch)) |
| 861 | main.log.report("Ports are: " + "; ".join(Port)) |
| 862 | main.log.report("MACs are: " + "; ".join(MAC)) |
| 863 | result4 = main.FALSE |
| 864 | elif Reststatus == 0 and Switch == []: |
| 865 | main.log.report("\t FAILED -Host " + host + " with MAC:" + str(mac) + " does not exist. FAILED") |
| 866 | result4 = main.FALSE |
| 867 | else:# check if rest server is working |
| 868 | main.log.error("Issue with find host") |
| 869 | result4 = main.FALSE |
| 870 | time.sleep(20) |
| 871 | Reststatus, Switch, Port = main.ONOS1.find_host(RestIP1,RestPort,url,mac) |
| 872 | main.log.report("Number of host with IP=10.0.0.1 found by ONOS is: " + str(Reststatus)) |
| 873 | if Reststatus ==1: |
| 874 | main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout") |
| 875 | elif Reststatus>1: |
| 876 | main.log.report("\t FAILED - Host " + host + "with MAC:" + str(mac) + "was still found after expected timeout(multiple found)") |
| 877 | elif Reststatus==0: |
| 878 | main.log.report("\t PASSED - Device cleared after timeout") |
| 879 | |
| 880 | result = result1 and result2 and result3 and result4 |
SeanCorcoran | c3ed743 | 2014-04-09 16:32:27 -0700 | [diff] [blame] | 881 | utilities.assert_equals(expect=main.TRUE,actual=result,onpass="DEVICE DISCOVERY TEST PASSED PLUG/UNPLUG/MOVE TEST",onfail="DEVICE DISCOVERY TEST FAILED") |
| 882 | |