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