Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 1 | ''' |
| 2 | Description: This test is to determine if the HA test setup is |
| 3 | working correctly. There are no failures so this test should |
| 4 | have a 100% pass rate |
| 5 | |
| 6 | List of test cases: |
| 7 | CASE1: Compile ONOS and push it to the test machines |
| 8 | CASE2: Assign mastership to controllers |
| 9 | CASE3: Assign intents |
| 10 | CASE4: Ping across added host intents |
| 11 | CASE5: Reading state of ONOS |
| 12 | CASE6: The Failure case. Since this is the Sanity test, we do nothing. |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 13 | CASE7: Check state after control plane failure |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 14 | CASE8: Compare topo |
| 15 | CASE9: Link s3-s28 down |
| 16 | CASE10: Link s3-s28 up |
| 17 | CASE11: Switch down |
| 18 | CASE12: Switch up |
| 19 | CASE13: Clean up |
| 20 | ''' |
| 21 | class HATestSanity: |
| 22 | |
| 23 | def __init__(self) : |
| 24 | self.default = '' |
| 25 | |
| 26 | def CASE1(self,main) : |
| 27 | ''' |
| 28 | CASE1 is to compile ONOS and push it to the test machines |
| 29 | |
| 30 | Startup sequence: |
| 31 | git pull |
| 32 | mvn clean install |
| 33 | onos-package |
| 34 | cell <name> |
| 35 | onos-verify-cell |
| 36 | NOTE: temporary - onos-remove-raft-logs |
| 37 | onos-install -f |
| 38 | onos-wait-for-start |
| 39 | ''' |
| 40 | import time |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 41 | main.log.report("ONOS HA Sanity test - initialization") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 42 | main.case("Setting up test environment") |
| 43 | |
| 44 | # load some vairables from the params file |
| 45 | PULL_CODE = False |
| 46 | if main.params['Git'] == 'True': |
| 47 | PULL_CODE = True |
| 48 | cell_name = main.params['ENV']['cellName'] |
| 49 | |
| 50 | #set global variables |
| 51 | global ONOS1_ip |
| 52 | global ONOS1_port |
| 53 | global ONOS2_ip |
| 54 | global ONOS2_port |
| 55 | global ONOS3_ip |
| 56 | global ONOS3_port |
| 57 | global ONOS4_ip |
| 58 | global ONOS4_port |
| 59 | global ONOS5_ip |
| 60 | global ONOS5_port |
| 61 | global ONOS6_ip |
| 62 | global ONOS6_port |
| 63 | global ONOS7_ip |
| 64 | global ONOS7_port |
| 65 | |
| 66 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 67 | ONOS1_port = main.params['CTRL']['port1'] |
| 68 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 69 | ONOS2_port = main.params['CTRL']['port2'] |
| 70 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 71 | ONOS3_port = main.params['CTRL']['port3'] |
| 72 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 73 | ONOS4_port = main.params['CTRL']['port4'] |
| 74 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 75 | ONOS5_port = main.params['CTRL']['port5'] |
| 76 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 77 | ONOS6_port = main.params['CTRL']['port6'] |
| 78 | ONOS7_ip = main.params['CTRL']['ip7'] |
| 79 | ONOS7_port = main.params['CTRL']['port7'] |
| 80 | |
| 81 | |
| 82 | main.step("Applying cell variable to environment") |
| 83 | cell_result = main.ONOSbench.set_cell(cell_name) |
| 84 | verify_result = main.ONOSbench.verify_cell() |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 85 | |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 86 | #FIXME:this is short term fix |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 87 | main.log.report("Removing raft logs") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 88 | main.ONOSbench.onos_remove_raft_logs() |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 89 | main.log.report("Uninstalling ONOS") |
| 90 | main.ONOSbench.onos_uninstall(ONOS1_ip) |
| 91 | main.ONOSbench.onos_uninstall(ONOS2_ip) |
| 92 | main.ONOSbench.onos_uninstall(ONOS3_ip) |
| 93 | main.ONOSbench.onos_uninstall(ONOS4_ip) |
| 94 | main.ONOSbench.onos_uninstall(ONOS5_ip) |
| 95 | main.ONOSbench.onos_uninstall(ONOS6_ip) |
| 96 | main.ONOSbench.onos_uninstall(ONOS7_ip) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 97 | |
| 98 | clean_install_result = main.TRUE |
| 99 | git_pull_result = main.TRUE |
| 100 | |
| 101 | main.step("Compiling the latest version of ONOS") |
| 102 | if PULL_CODE: |
| 103 | main.step("Git checkout and pull master") |
| 104 | main.ONOSbench.git_checkout("master") |
| 105 | git_pull_result = main.ONOSbench.git_pull() |
| 106 | |
| 107 | main.step("Using mvn clean & install") |
| 108 | clean_install_result = main.TRUE |
| 109 | if git_pull_result == main.TRUE: |
| 110 | clean_install_result = main.ONOSbench.clean_install() |
| 111 | else: |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 112 | main.log.warn("Did not pull new code so skipping mvn "+ \ |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 113 | "clean install") |
| 114 | main.ONOSbench.get_version(report=True) |
| 115 | |
| 116 | main.step("Creating ONOS package") |
| 117 | package_result = main.ONOSbench.onos_package() |
| 118 | |
| 119 | main.step("Installing ONOS package") |
| 120 | onos1_install_result = main.ONOSbench.onos_install(options="-f", |
| 121 | node=ONOS1_ip) |
| 122 | onos2_install_result = main.ONOSbench.onos_install(options="-f", |
| 123 | node=ONOS2_ip) |
| 124 | onos3_install_result = main.ONOSbench.onos_install(options="-f", |
| 125 | node=ONOS3_ip) |
| 126 | onos4_install_result = main.ONOSbench.onos_install(options="-f", |
| 127 | node=ONOS4_ip) |
| 128 | onos5_install_result = main.ONOSbench.onos_install(options="-f", |
| 129 | node=ONOS5_ip) |
| 130 | onos6_install_result = main.ONOSbench.onos_install(options="-f", |
| 131 | node=ONOS6_ip) |
| 132 | onos7_install_result = main.ONOSbench.onos_install(options="-f", |
| 133 | node=ONOS7_ip) |
| 134 | onos_install_result = onos1_install_result and onos2_install_result\ |
| 135 | and onos3_install_result and onos4_install_result\ |
| 136 | and onos5_install_result and onos6_install_result\ |
| 137 | and onos7_install_result |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 138 | ''' |
| 139 | #FIXME: work around until onos is less fragile |
| 140 | main.ONOSbench.handle.sendline("onos-cluster-install") |
| 141 | print main.ONOSbench.handle.expect("\$") |
| 142 | onos_install_result = main.TRUE |
| 143 | ''' |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 144 | |
| 145 | |
| 146 | main.step("Checking if ONOS is up yet") |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 147 | #TODO: Refactor |
| 148 | # check bundle:list? |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 149 | onos1_isup = main.ONOSbench.isup(ONOS1_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 150 | if not onos1_isup: |
| 151 | main.log.report("ONOS1 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 152 | onos2_isup = main.ONOSbench.isup(ONOS2_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 153 | if not onos2_isup: |
| 154 | main.log.report("ONOS2 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 155 | onos3_isup = main.ONOSbench.isup(ONOS3_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 156 | if not onos3_isup: |
| 157 | main.log.report("ONOS3 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 158 | onos4_isup = main.ONOSbench.isup(ONOS4_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 159 | if not onos4_isup: |
| 160 | main.log.report("ONOS4 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 161 | onos5_isup = main.ONOSbench.isup(ONOS5_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 162 | if not onos5_isup: |
| 163 | main.log.report("ONOS5 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 164 | onos6_isup = main.ONOSbench.isup(ONOS6_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 165 | if not onos6_isup: |
| 166 | main.log.report("ONOS6 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 167 | onos7_isup = main.ONOSbench.isup(ONOS7_ip) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 168 | if not onos7_isup: |
| 169 | main.log.report("ONOS7 didn't start!") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 170 | onos_isup_result = onos1_isup and onos2_isup and onos3_isup\ |
| 171 | and onos4_isup and onos5_isup and onos6_isup and onos7_isup |
| 172 | # TODO: if it becomes an issue, we can retry this step a few times |
| 173 | |
| 174 | |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 175 | cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip) |
| 176 | cli_result2 = main.ONOScli2.start_onos_cli(ONOS2_ip) |
| 177 | cli_result3 = main.ONOScli3.start_onos_cli(ONOS3_ip) |
| 178 | cli_result4 = main.ONOScli4.start_onos_cli(ONOS4_ip) |
| 179 | cli_result5 = main.ONOScli5.start_onos_cli(ONOS5_ip) |
| 180 | cli_result6 = main.ONOScli6.start_onos_cli(ONOS6_ip) |
| 181 | cli_result7 = main.ONOScli7.start_onos_cli(ONOS7_ip) |
| 182 | cli_results = cli_result1 and cli_result2 and cli_result3 and\ |
| 183 | cli_result4 and cli_result5 and cli_result6 and cli_result7 |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 184 | |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 185 | main.step("Start Packet Capture MN") |
| 186 | main.Mininet2.start_tcpdump( |
| 187 | str(main.params['MNtcpdump']['folder'])+str(main.TEST)+"-MN.pcap", |
| 188 | intf = main.params['MNtcpdump']['intf'], |
| 189 | port = main.params['MNtcpdump']['port']) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 190 | |
| 191 | |
| 192 | case1_result = (clean_install_result and package_result and |
| 193 | cell_result and verify_result and onos_install_result and |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 194 | onos_isup_result and cli_results) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 195 | |
| 196 | utilities.assert_equals(expect=main.TRUE, actual=case1_result, |
| 197 | onpass="Test startup successful", |
| 198 | onfail="Test startup NOT successful") |
| 199 | |
| 200 | |
| 201 | #if case1_result==main.FALSE: |
| 202 | # main.cleanup() |
| 203 | # main.exit() |
| 204 | |
| 205 | def CASE2(self,main) : |
| 206 | ''' |
| 207 | Assign mastership to controllers |
| 208 | ''' |
| 209 | import time |
| 210 | import json |
| 211 | import re |
| 212 | |
| 213 | |
| 214 | ''' |
| 215 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 216 | ONOS1_port = main.params['CTRL']['port1'] |
| 217 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 218 | ONOS2_port = main.params['CTRL']['port2'] |
| 219 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 220 | ONOS3_port = main.params['CTRL']['port3'] |
| 221 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 222 | ONOS4_port = main.params['CTRL']['port4'] |
| 223 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 224 | ONOS5_port = main.params['CTRL']['port5'] |
| 225 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 226 | ONOS6_port = main.params['CTRL']['port6'] |
| 227 | ONOS7_ip = main.params['CTRL']['ip7'] |
| 228 | ONOS7_port = main.params['CTRL']['port7'] |
| 229 | ''' |
| 230 | |
| 231 | |
| 232 | main.log.report("Assigning switches to controllers") |
| 233 | main.case("Assigning Controllers") |
| 234 | main.step("Assign switches to controllers") |
| 235 | |
| 236 | for i in range (1,29): |
| 237 | main.Mininet1.assign_sw_controller(sw=str(i),count=7, |
| 238 | ip1=ONOS1_ip,port1=ONOS1_port, |
| 239 | ip2=ONOS2_ip,port2=ONOS2_port, |
| 240 | ip3=ONOS3_ip,port3=ONOS3_port, |
| 241 | ip4=ONOS4_ip,port4=ONOS4_port, |
| 242 | ip5=ONOS5_ip,port5=ONOS5_port, |
| 243 | ip6=ONOS6_ip,port6=ONOS6_port, |
| 244 | ip7=ONOS7_ip,port7=ONOS7_port) |
| 245 | |
| 246 | mastership_check = main.TRUE |
| 247 | for i in range (1,29): |
| 248 | response = main.Mininet1.get_sw_controller("s"+str(i)) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 249 | main.log.info(repr(response)) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 250 | if re.search("tcp:"+ONOS1_ip,response)\ |
| 251 | and re.search("tcp:"+ONOS2_ip,response)\ |
| 252 | and re.search("tcp:"+ONOS3_ip,response)\ |
| 253 | and re.search("tcp:"+ONOS4_ip,response)\ |
| 254 | and re.search("tcp:"+ONOS5_ip,response)\ |
| 255 | and re.search("tcp:"+ONOS6_ip,response)\ |
| 256 | and re.search("tcp:"+ONOS7_ip,response): |
| 257 | mastership_check = mastership_check and main.TRUE |
| 258 | else: |
| 259 | mastership_check = main.FALSE |
| 260 | if mastership_check == main.TRUE: |
| 261 | main.log.report("Switch mastership assigned correctly") |
| 262 | utilities.assert_equals(expect = main.TRUE,actual=mastership_check, |
| 263 | onpass="Switch mastership assigned correctly", |
| 264 | onfail="Switches not assigned correctly to controllers") |
| 265 | |
| 266 | #TODO: If assign roles is working reliably then manually |
| 267 | # assign mastership to the controller we want |
| 268 | |
| 269 | |
| 270 | def CASE3(self,main) : |
| 271 | """ |
| 272 | Assign intents |
| 273 | |
| 274 | """ |
| 275 | import time |
| 276 | import json |
| 277 | import re |
| 278 | main.log.report("Adding host intents") |
| 279 | main.case("Adding host Intents") |
| 280 | |
| 281 | main.step("Discovering Hosts( Via pingall for now)") |
| 282 | #FIXME: Once we have a host discovery mechanism, use that instead |
| 283 | |
| 284 | #REACTIVE FWD test |
| 285 | ping_result = main.FALSE |
| 286 | time1 = time.time() |
| 287 | ping_result = main.Mininet1.pingall() |
| 288 | time2 = time.time() |
| 289 | main.log.info("Time for pingall: %2f seconds" % (time2 - time1)) |
| 290 | |
| 291 | #uninstall onos-app-fwd |
| 292 | main.log.info("Uninstall reactive forwarding app") |
| 293 | main.ONOScli1.feature_uninstall("onos-app-fwd") |
| 294 | main.ONOScli2.feature_uninstall("onos-app-fwd") |
| 295 | main.ONOScli3.feature_uninstall("onos-app-fwd") |
| 296 | main.ONOScli4.feature_uninstall("onos-app-fwd") |
| 297 | main.ONOScli5.feature_uninstall("onos-app-fwd") |
| 298 | main.ONOScli6.feature_uninstall("onos-app-fwd") |
| 299 | main.ONOScli7.feature_uninstall("onos-app-fwd") |
| 300 | |
| 301 | main.step("Add host intents") |
| 302 | #TODO: move the host numbers to params |
| 303 | import json |
| 304 | intents_json= json.loads(main.ONOScli1.hosts()) |
| 305 | intent_add_result = main.FALSE |
| 306 | for i in range(8,18): |
| 307 | main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10)) |
| 308 | host1 = "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper() |
| 309 | host2 = "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper() |
| 310 | #NOTE: get host can return None |
| 311 | #TODO: handle this |
| 312 | host1_id = main.ONOScli1.get_host(host1)['id'] |
| 313 | host2_id = main.ONOScli1.get_host(host2)['id'] |
| 314 | tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id ) |
| 315 | intent_add_result = intent_add_result and tmp_result |
| 316 | #TODO Check if intents all exist in datastore |
| 317 | #NOTE: Do we need to print this once the test is working? |
| 318 | #main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)), |
| 319 | # sort_keys=True, indent=4, separators=(',', ': ') ) ) |
| 320 | |
| 321 | def CASE4(self,main) : |
| 322 | """ |
| 323 | Ping across added host intents |
| 324 | """ |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 325 | description = " Ping across added host intents" |
| 326 | main.log.report(description) |
| 327 | main.case(description) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 328 | Ping_Result = main.TRUE |
| 329 | for i in range(8,18): |
| 330 | ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10)) |
| 331 | Ping_Result = Ping_Result and ping |
| 332 | if ping==main.FALSE: |
| 333 | main.log.warn("Ping failed between h"+str(i)+" and h" + str(i+10)) |
| 334 | elif ping==main.TRUE: |
| 335 | main.log.info("Ping test passed!") |
| 336 | Ping_Result = main.TRUE |
| 337 | if Ping_Result==main.FALSE: |
| 338 | main.log.report("Intents have not been installed correctly, pings failed.") |
| 339 | if Ping_Result==main.TRUE: |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 340 | main.log.report("Intents have been installed correctly and verified by pings") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 341 | utilities.assert_equals(expect = main.TRUE,actual=Ping_Result, |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 342 | onpass="Intents have been installed correctly and pings work", |
| 343 | onfail ="Intents have not been installed correctly, pings failed." ) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 344 | |
| 345 | def CASE5(self,main) : |
| 346 | ''' |
| 347 | Reading state of ONOS |
| 348 | ''' |
| 349 | import time |
| 350 | import json |
| 351 | from subprocess import Popen, PIPE |
| 352 | from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH |
| 353 | |
| 354 | main.log.report("Setting up and gathering data for current state") |
| 355 | main.case("Setting up and gathering data for current state") |
| 356 | #The general idea for this test case is to pull the state of (intents,flows, topology,...) from each ONOS node |
| 357 | #We can then compare them with eachother and also with past states |
| 358 | |
| 359 | main.step("Get the Mastership of each switch from each controller") |
| 360 | global mastership_state |
| 361 | ONOS1_mastership = main.ONOScli1.roles() |
| 362 | ONOS2_mastership = main.ONOScli2.roles() |
| 363 | ONOS3_mastership = main.ONOScli3.roles() |
| 364 | ONOS4_mastership = main.ONOScli4.roles() |
| 365 | ONOS5_mastership = main.ONOScli5.roles() |
| 366 | ONOS6_mastership = main.ONOScli6.roles() |
| 367 | ONOS7_mastership = main.ONOScli7.roles() |
| 368 | #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': ')) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 369 | if "Error" in ONOS1_mastership or not ONOS1_mastership\ |
| 370 | or "Error" in ONOS2_mastership or not ONOS2_mastership\ |
| 371 | or "Error" in ONOS3_mastership or not ONOS3_mastership\ |
| 372 | or "Error" in ONOS4_mastership or not ONOS4_mastership\ |
| 373 | or "Error" in ONOS5_mastership or not ONOS5_mastership\ |
| 374 | or "Error" in ONOS6_mastership or not ONOS6_mastership\ |
| 375 | or "Error" in ONOS7_mastership or not ONOS7_mastership: |
| 376 | main.log.report("Error in getting ONOS roles") |
| 377 | main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership)) |
| 378 | main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership)) |
| 379 | main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership)) |
| 380 | main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership)) |
| 381 | main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership)) |
| 382 | main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership)) |
| 383 | main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership)) |
| 384 | consistent_mastership = main.FALSE |
| 385 | elif ONOS1_mastership == ONOS2_mastership\ |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 386 | and ONOS1_mastership == ONOS3_mastership\ |
| 387 | and ONOS1_mastership == ONOS4_mastership\ |
| 388 | and ONOS1_mastership == ONOS5_mastership\ |
| 389 | and ONOS1_mastership == ONOS6_mastership\ |
| 390 | and ONOS1_mastership == ONOS7_mastership: |
| 391 | mastership_state = ONOS1_mastership |
| 392 | consistent_mastership = main.TRUE |
| 393 | main.log.report("Switch roles are consistent across all ONOS nodes") |
| 394 | else: |
| 395 | main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership), |
| 396 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 397 | main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership), |
| 398 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 399 | main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership), |
| 400 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 401 | main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership), |
| 402 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 403 | main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership), |
| 404 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 405 | main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership), |
| 406 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 407 | main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership), |
| 408 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 409 | consistent_mastership = main.FALSE |
| 410 | utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership, |
| 411 | onpass="Switch roles are consistent across all ONOS nodes", |
| 412 | onfail="ONOS nodes have different views of switch roles") |
| 413 | |
| 414 | |
| 415 | main.step("Get the intents from each controller") |
| 416 | global intent_state |
| 417 | ONOS1_intents = main.ONOScli1.intents( json_format=True ) |
| 418 | ONOS2_intents = main.ONOScli2.intents( json_format=True ) |
| 419 | ONOS3_intents = main.ONOScli3.intents( json_format=True ) |
| 420 | ONOS4_intents = main.ONOScli4.intents( json_format=True ) |
| 421 | ONOS5_intents = main.ONOScli5.intents( json_format=True ) |
| 422 | ONOS6_intents = main.ONOScli6.intents( json_format=True ) |
| 423 | ONOS7_intents = main.ONOScli7.intents( json_format=True ) |
| 424 | intent_check = main.FALSE |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 425 | if "Error" in ONOS1_intents or not ONOS1_intents\ |
| 426 | or "Error" in ONOS2_intents or not ONOS2_intents\ |
| 427 | or "Error" in ONOS3_intents or not ONOS3_intents\ |
| 428 | or "Error" in ONOS4_intents or not ONOS4_intents\ |
| 429 | or "Error" in ONOS5_intents or not ONOS5_intents\ |
| 430 | or "Error" in ONOS6_intents or not ONOS6_intents\ |
| 431 | or "Error" in ONOS7_intents or not ONOS7_intents: |
| 432 | main.log.report("Error in getting ONOS intents") |
| 433 | main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents)) |
| 434 | main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents)) |
| 435 | main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents)) |
| 436 | main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents)) |
| 437 | main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents)) |
| 438 | main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents)) |
| 439 | main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents)) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 440 | elif ONOS1_intents == ONOS2_intents\ |
| 441 | and ONOS1_intents == ONOS3_intents\ |
| 442 | and ONOS1_intents == ONOS4_intents\ |
| 443 | and ONOS1_intents == ONOS5_intents\ |
| 444 | and ONOS1_intents == ONOS6_intents\ |
| 445 | and ONOS1_intents == ONOS7_intents: |
| 446 | intent_state = ONOS1_intents |
| 447 | intent_check = main.TRUE |
| 448 | main.log.report("Intents are consistent across all ONOS nodes") |
| 449 | else: |
| 450 | main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents), |
| 451 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 452 | main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents), |
| 453 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 454 | main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents), |
| 455 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 456 | main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents), |
| 457 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 458 | main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents), |
| 459 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 460 | main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents), |
| 461 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 462 | main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents), |
| 463 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 464 | utilities.assert_equals(expect = main.TRUE,actual=intent_check, |
| 465 | onpass="Intents are consistent across all ONOS nodes", |
| 466 | onfail="ONOS nodes have different views of intents") |
| 467 | |
| 468 | |
| 469 | main.step("Get the flows from each controller") |
| 470 | global flow_state |
| 471 | ONOS1_flows = main.ONOScli1.flows( json_format=True ) |
| 472 | ONOS2_flows = main.ONOScli2.flows( json_format=True ) |
| 473 | ONOS3_flows = main.ONOScli3.flows( json_format=True ) |
| 474 | ONOS4_flows = main.ONOScli4.flows( json_format=True ) |
| 475 | ONOS5_flows = main.ONOScli5.flows( json_format=True ) |
| 476 | ONOS6_flows = main.ONOScli6.flows( json_format=True ) |
| 477 | ONOS7_flows = main.ONOScli7.flows( json_format=True ) |
| 478 | flow_check = main.FALSE |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 479 | if "Error" in ONOS1_flows or not ONOS1_flows\ |
| 480 | or "Error" in ONOS2_flows or not ONOS2_flows\ |
| 481 | or "Error" in ONOS3_flows or not ONOS3_flows\ |
| 482 | or "Error" in ONOS4_flows or not ONOS4_flows\ |
| 483 | or "Error" in ONOS5_flows or not ONOS5_flows\ |
| 484 | or "Error" in ONOS6_flows or not ONOS6_flows\ |
| 485 | or "Error" in ONOS7_flows or not ONOS7_flows: |
| 486 | main.log.report("Error in getting ONOS intents") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 487 | main.log.warn("ONOS1 flows repsponse: "+ ONOS1_flows) |
| 488 | main.log.warn("ONOS2 flows repsponse: "+ ONOS2_flows) |
| 489 | main.log.warn("ONOS3 flows repsponse: "+ ONOS3_flows) |
| 490 | main.log.warn("ONOS4 flows repsponse: "+ ONOS4_flows) |
| 491 | main.log.warn("ONOS5 flows repsponse: "+ ONOS5_flows) |
| 492 | main.log.warn("ONOS6 flows repsponse: "+ ONOS6_flows) |
| 493 | main.log.warn("ONOS7 flows repsponse: "+ ONOS7_flows) |
| 494 | elif len(json.loads(ONOS1_flows)) == len(json.loads(ONOS2_flows))\ |
| 495 | and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS3_flows))\ |
| 496 | and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS4_flows))\ |
| 497 | and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS5_flows))\ |
| 498 | and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS6_flows))\ |
| 499 | and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS7_flows)): |
| 500 | #TODO: Do a better check, maybe compare flows on switches? |
| 501 | flow_state = ONOS1_flows |
| 502 | flow_check = main.TRUE |
| 503 | main.log.report("Flow count is consistent across all ONOS nodes") |
| 504 | else: |
| 505 | main.log.warn("ONOS1 flows: "+ json.dumps(json.loads(ONOS1_flows), |
| 506 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 507 | main.log.warn("ONOS2 flows: "+ json.dumps(json.loads(ONOS2_flows), |
| 508 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 509 | main.log.warn("ONOS3 flows: "+ json.dumps(json.loads(ONOS3_flows), |
| 510 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 511 | main.log.warn("ONOS4 flows: "+ json.dumps(json.loads(ONOS4_flows), |
| 512 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 513 | main.log.warn("ONOS5 flows: "+ json.dumps(json.loads(ONOS5_flows), |
| 514 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 515 | main.log.warn("ONOS6 flows: "+ json.dumps(json.loads(ONOS6_flows), |
| 516 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 517 | main.log.warn("ONOS7 flows: "+ json.dumps(json.loads(ONOS7_flows), |
| 518 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 519 | utilities.assert_equals(expect = main.TRUE,actual=flow_check, |
| 520 | onpass="The flow count is consistent across all ONOS nodes", |
| 521 | onfail="ONOS nodes have different flow counts") |
| 522 | |
| 523 | |
| 524 | main.step("Get the OF Table entries") |
| 525 | global flows |
| 526 | flows=[] |
| 527 | for i in range(1,29): |
| 528 | flows.append(main.Mininet2.get_flowTable("s"+str(i),1.0)) |
| 529 | |
| 530 | #TODO: Compare switch flow tables with ONOS flow tables |
| 531 | |
| 532 | main.step("Start continuous pings") |
| 533 | main.Mininet2.pingLong(src=main.params['PING']['source1'], |
| 534 | target=main.params['PING']['target1'],pingTime=500) |
| 535 | main.Mininet2.pingLong(src=main.params['PING']['source2'], |
| 536 | target=main.params['PING']['target2'],pingTime=500) |
| 537 | main.Mininet2.pingLong(src=main.params['PING']['source3'], |
| 538 | target=main.params['PING']['target3'],pingTime=500) |
| 539 | main.Mininet2.pingLong(src=main.params['PING']['source4'], |
| 540 | target=main.params['PING']['target4'],pingTime=500) |
| 541 | main.Mininet2.pingLong(src=main.params['PING']['source5'], |
| 542 | target=main.params['PING']['target5'],pingTime=500) |
| 543 | main.Mininet2.pingLong(src=main.params['PING']['source6'], |
| 544 | target=main.params['PING']['target6'],pingTime=500) |
| 545 | main.Mininet2.pingLong(src=main.params['PING']['source7'], |
| 546 | target=main.params['PING']['target7'],pingTime=500) |
| 547 | main.Mininet2.pingLong(src=main.params['PING']['source8'], |
| 548 | target=main.params['PING']['target8'],pingTime=500) |
| 549 | main.Mininet2.pingLong(src=main.params['PING']['source9'], |
| 550 | target=main.params['PING']['target9'],pingTime=500) |
| 551 | main.Mininet2.pingLong(src=main.params['PING']['source10'], |
| 552 | target=main.params['PING']['target10'],pingTime=500) |
| 553 | |
| 554 | main.step("Create TestONTopology object") |
| 555 | ctrls = [] |
| 556 | count = 1 |
| 557 | while True: |
| 558 | temp = () |
| 559 | if ('ip' + str(count)) in main.params['CTRL']: |
| 560 | temp = temp + (getattr(main,('ONOS' + str(count))),) |
| 561 | temp = temp + ("ONOS"+str(count),) |
| 562 | temp = temp + (main.params['CTRL']['ip'+str(count)],) |
| 563 | temp = temp + (eval(main.params['CTRL']['port'+str(count)]),) |
| 564 | ctrls.append(temp) |
| 565 | count = count + 1 |
| 566 | else: |
| 567 | break |
| 568 | MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations |
| 569 | |
| 570 | main.step("Collecting topology information from ONOS") |
| 571 | devices = [] |
| 572 | devices.append( main.ONOScli1.devices() ) |
| 573 | devices.append( main.ONOScli2.devices() ) |
| 574 | devices.append( main.ONOScli3.devices() ) |
| 575 | devices.append( main.ONOScli4.devices() ) |
| 576 | devices.append( main.ONOScli5.devices() ) |
| 577 | devices.append( main.ONOScli6.devices() ) |
| 578 | devices.append( main.ONOScli7.devices() ) |
| 579 | ''' |
| 580 | hosts = [] |
| 581 | hosts.append( main.ONOScli1.hosts() ) |
| 582 | hosts.append( main.ONOScli2.hosts() ) |
| 583 | hosts.append( main.ONOScli3.hosts() ) |
| 584 | hosts.append( main.ONOScli4.hosts() ) |
| 585 | hosts.append( main.ONOScli5.hosts() ) |
| 586 | hosts.append( main.ONOScli6.hosts() ) |
| 587 | hosts.append( main.ONOScli7.hosts() ) |
| 588 | ''' |
| 589 | ports = [] |
| 590 | ports.append( main.ONOScli1.ports() ) |
| 591 | ports.append( main.ONOScli2.ports() ) |
| 592 | ports.append( main.ONOScli3.ports() ) |
| 593 | ports.append( main.ONOScli4.ports() ) |
| 594 | ports.append( main.ONOScli5.ports() ) |
| 595 | ports.append( main.ONOScli6.ports() ) |
| 596 | ports.append( main.ONOScli7.ports() ) |
| 597 | links = [] |
| 598 | links.append( main.ONOScli1.links() ) |
| 599 | links.append( main.ONOScli2.links() ) |
| 600 | links.append( main.ONOScli3.links() ) |
| 601 | links.append( main.ONOScli4.links() ) |
| 602 | links.append( main.ONOScli5.links() ) |
| 603 | links.append( main.ONOScli6.links() ) |
| 604 | links.append( main.ONOScli7.links() ) |
| 605 | |
| 606 | |
| 607 | main.step("Comparing ONOS topology to MN") |
| 608 | devices_results = main.TRUE |
| 609 | ports_results = main.TRUE |
| 610 | links_results = main.TRUE |
| 611 | for controller in range(7): #TODO parameterize the number of controllers |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 612 | if devices[controller] or not "Error" in devices[controller]: |
| 613 | current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller])) |
| 614 | else: |
| 615 | current_devices_result = main.FALSE |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 616 | utilities.assert_equals(expect=main.TRUE, actual=current_devices_result, |
| 617 | onpass="ONOS"+str(int(controller+1))+" Switches view is correct", |
| 618 | onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect") |
| 619 | |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 620 | if ports[controller] or not "Error" in ports[controller]: |
| 621 | current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller])) |
| 622 | else: |
| 623 | current_ports_result = main.FALSE |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 624 | utilities.assert_equals(expect=main.TRUE, actual=current_ports_result, |
| 625 | onpass="ONOS"+str(int(controller+1))+" ports view is correct", |
| 626 | onfail="ONOS"+str(int(controller+1))+" ports view is incorrect") |
| 627 | |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 628 | if links[controller] or not "Error" in links[controller]: |
| 629 | current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller])) |
| 630 | else: |
| 631 | current_links_result = main.FALSE |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 632 | utilities.assert_equals(expect=main.TRUE, actual=current_links_result, |
| 633 | onpass="ONOS"+str(int(controller+1))+" links view is correct", |
| 634 | onfail="ONOS"+str(int(controller+1))+" links view is incorrect") |
| 635 | |
| 636 | devices_results = devices_results and current_devices_result |
| 637 | ports_results = ports_results and current_ports_result |
| 638 | links_results = links_results and current_links_result |
| 639 | |
| 640 | topo_result = devices_results and ports_results and links_results |
| 641 | utilities.assert_equals(expect=main.TRUE, actual=topo_result, |
| 642 | onpass="Topology Check Test successful", |
| 643 | onfail="Topology Check Test NOT successful") |
| 644 | |
| 645 | final_assert = main.TRUE |
| 646 | final_assert = final_assert and topo_result and flow_check \ |
| 647 | and intent_check and consistent_mastership |
| 648 | utilities.assert_equals(expect=main.TRUE, actual=final_assert, |
| 649 | onpass="State check successful", |
| 650 | onfail="State check NOT successful") |
| 651 | |
| 652 | |
| 653 | def CASE6(self,main) : |
| 654 | ''' |
| 655 | The Failure case. Since this is the Sanity test, we do nothing. |
| 656 | ''' |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 657 | import time |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 658 | main.log.report("Wait 60 seconds instead of inducing a failure") |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 659 | time.sleep(60) |
| 660 | utilities.assert_equals(expect=main.TRUE, actual=main.TRUE, |
| 661 | onpass="Sleeping 60 seconds", |
| 662 | onfail="Something is terribly wrong with my math") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 663 | |
| 664 | def CASE7(self,main) : |
| 665 | ''' |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 666 | Check state after ONOS failure |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 667 | ''' |
| 668 | import os |
| 669 | import json |
| 670 | main.case("Running ONOS Constant State Tests") |
| 671 | |
| 672 | main.step("Check if switch roles are consistent across all nodes") |
| 673 | ONOS1_mastership = main.ONOScli1.roles() |
| 674 | ONOS2_mastership = main.ONOScli2.roles() |
| 675 | ONOS3_mastership = main.ONOScli3.roles() |
| 676 | ONOS4_mastership = main.ONOScli4.roles() |
| 677 | ONOS5_mastership = main.ONOScli5.roles() |
| 678 | ONOS6_mastership = main.ONOScli6.roles() |
| 679 | ONOS7_mastership = main.ONOScli7.roles() |
| 680 | #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': ')) |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 681 | if "Error" in ONOS1_mastership or not ONOS1_mastership\ |
| 682 | or "Error" in ONOS2_mastership or not ONOS2_mastership\ |
| 683 | or "Error" in ONOS3_mastership or not ONOS3_mastership\ |
| 684 | or "Error" in ONOS4_mastership or not ONOS4_mastership\ |
| 685 | or "Error" in ONOS5_mastership or not ONOS5_mastership\ |
| 686 | or "Error" in ONOS6_mastership or not ONOS6_mastership\ |
| 687 | or "Error" in ONOS7_mastership or not ONOS7_mastership: |
| 688 | main.log.error("Error in getting ONOS mastership") |
| 689 | main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership)) |
| 690 | main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership)) |
| 691 | main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership)) |
| 692 | main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership)) |
| 693 | main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership)) |
| 694 | main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership)) |
| 695 | main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership)) |
| 696 | consistent_mastership = main.FALSE |
| 697 | elif ONOS1_mastership == ONOS2_mastership\ |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 698 | and ONOS1_mastership == ONOS3_mastership\ |
| 699 | and ONOS1_mastership == ONOS4_mastership\ |
| 700 | and ONOS1_mastership == ONOS5_mastership\ |
| 701 | and ONOS1_mastership == ONOS6_mastership\ |
| 702 | and ONOS1_mastership == ONOS7_mastership: |
| 703 | #mastership_state = ONOS1_mastership |
| 704 | consistent_mastership = main.TRUE |
| 705 | main.log.report("Switch roles are consistent across all ONOS nodes") |
| 706 | else: |
| 707 | main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership), |
| 708 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 709 | main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership), |
| 710 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 711 | main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership), |
| 712 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 713 | main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership), |
| 714 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 715 | main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership), |
| 716 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 717 | main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership), |
| 718 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 719 | main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership), |
| 720 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 721 | consistent_mastership = main.FALSE |
| 722 | utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership, |
| 723 | onpass="Switch roles are consistent across all ONOS nodes", |
| 724 | onfail="ONOS nodes have different views of switch roles") |
| 725 | |
| 726 | |
| 727 | description2 = "Compare switch roles from before failure" |
| 728 | main.step(description2) |
| 729 | |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 730 | current_json = json.loads(ONOS1_mastership) |
| 731 | old_json = json.loads(mastership_state) |
| 732 | mastership_check = main.TRUE |
| 733 | for i in range(1,29): |
| 734 | switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i))) |
| 735 | |
| 736 | current = [switch['master'] for switch in current_json if switchDPID in switch['id']] |
| 737 | old = [switch['master'] for switch in old_json if switchDPID in switch['id']] |
| 738 | if current == old: |
| 739 | mastership_check = mastership_check and main.TRUE |
| 740 | else: |
| 741 | main.log.warn("Mastership of switch %s changed" % switchDPID) |
| 742 | mastership_check = main.FALSE |
| 743 | if mastership_check == main.TRUE: |
| 744 | main.log.report("Mastership of Switches was not changed") |
| 745 | utilities.assert_equals(expect=main.TRUE,actual=mastership_check, |
| 746 | onpass="Mastership of Switches was not changed", |
| 747 | onfail="Mastership of some switches changed") |
| 748 | mastership_check = mastership_check and consistent_mastership |
| 749 | |
| 750 | |
| 751 | |
| 752 | main.step("Get the intents and compare across all nodes") |
| 753 | ONOS1_intents = main.ONOScli1.intents( json_format=True ) |
| 754 | ONOS2_intents = main.ONOScli2.intents( json_format=True ) |
| 755 | ONOS3_intents = main.ONOScli3.intents( json_format=True ) |
| 756 | ONOS4_intents = main.ONOScli4.intents( json_format=True ) |
| 757 | ONOS5_intents = main.ONOScli5.intents( json_format=True ) |
| 758 | ONOS6_intents = main.ONOScli6.intents( json_format=True ) |
| 759 | ONOS7_intents = main.ONOScli7.intents( json_format=True ) |
| 760 | intent_check = main.FALSE |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 761 | if "Error" in ONOS1_intents or not ONOS1_intents\ |
| 762 | or "Error" in ONOS2_intents or not ONOS2_intents\ |
| 763 | or "Error" in ONOS3_intents or not ONOS3_intents\ |
| 764 | or "Error" in ONOS4_intents or not ONOS4_intents\ |
| 765 | or "Error" in ONOS5_intents or not ONOS5_intents\ |
| 766 | or "Error" in ONOS6_intents or not ONOS6_intents\ |
| 767 | or "Error" in ONOS7_intents or not ONOS7_intents: |
| 768 | main.log.report("Error in getting ONOS intents") |
| 769 | main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents)) |
| 770 | main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents)) |
| 771 | main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents)) |
| 772 | main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents)) |
| 773 | main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents)) |
| 774 | main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents)) |
| 775 | main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents)) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 776 | elif ONOS1_intents == ONOS2_intents\ |
| 777 | and ONOS1_intents == ONOS3_intents\ |
| 778 | and ONOS1_intents == ONOS4_intents\ |
| 779 | and ONOS1_intents == ONOS5_intents\ |
| 780 | and ONOS1_intents == ONOS6_intents\ |
| 781 | and ONOS1_intents == ONOS7_intents: |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 782 | intent_check = main.TRUE |
| 783 | main.log.report("Intents are consistent across all ONOS nodes") |
| 784 | else: |
| 785 | main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents), |
| 786 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 787 | main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents), |
| 788 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 789 | main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents), |
| 790 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 791 | main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents), |
| 792 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 793 | main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents), |
| 794 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 795 | main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents), |
| 796 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 797 | main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents), |
| 798 | sort_keys=True, indent=4, separators=(',', ': '))) |
| 799 | utilities.assert_equals(expect = main.TRUE,actual=intent_check, |
| 800 | onpass="Intents are consistent across all ONOS nodes", |
| 801 | onfail="ONOS nodes have different views of intents") |
| 802 | |
| 803 | main.step("Compare current intents with intents before the failure") |
| 804 | if intent_state == ONOS1_intents: |
| 805 | same_intents = main.TRUE |
| 806 | main.log.report("Intents are consistent with before failure") |
| 807 | #TODO: possibly the states have changed? we may need to figure out what the aceptable states are |
| 808 | else: |
| 809 | same_intents = main.FALSE |
| 810 | utilities.assert_equals(expect = main.TRUE,actual=same_intents, |
| 811 | onpass="Intents are consistent with before failure", |
| 812 | onfail="The Intents changed during failure") |
| 813 | intent_check = intent_check and same_intents |
| 814 | |
| 815 | |
| 816 | |
| 817 | main.step("Get the OF Table entries and compare to before component failure") |
| 818 | Flow_Tables = main.TRUE |
| 819 | flows2=[] |
| 820 | for i in range(28): |
| 821 | main.log.info("Checking flow table on s" + str(i+1)) |
| 822 | tmp_flows = main.Mininet2.get_flowTable("s"+str(i+1),1.0) |
| 823 | flows2.append(tmp_flows) |
| 824 | Flow_Tables = Flow_Tables and main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows) |
| 825 | if Flow_Tables == main.FALSE: |
| 826 | main.log.info("Differences in flow table for switch: "+str(i+1)) |
| 827 | break |
| 828 | if Flow_Tables == main.TRUE: |
| 829 | main.log.report("No changes were found in the flow tables") |
| 830 | utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables, |
| 831 | onpass="No changes were found in the flow tables", |
| 832 | onfail="Changes were found in the flow tables") |
| 833 | |
| 834 | main.step("Check the continuous pings to ensure that no packets were dropped during component failure") |
| 835 | #FIXME: This check is always failing. Investigate cause |
| 836 | #NOTE: this may be something to do with file permsissions |
| 837 | # or slight change in format |
| 838 | main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP']) |
| 839 | Loss_In_Pings = main.FALSE |
| 840 | #NOTE: checkForLoss returns main.FALSE with 0% packet loss |
| 841 | for i in range(8,18): |
| 842 | main.log.info("Checking for a loss in pings along flow from s" + str(i)) |
| 843 | Loss_In_Pings = Loss_In_Pings or main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) |
| 844 | if Loss_In_Pings == main.TRUE: |
| 845 | main.log.info("Loss in ping detected") |
| 846 | elif Loss_In_Pings == main.ERROR: |
| 847 | main.log.info("There are multiple mininet process running") |
| 848 | elif Loss_In_Pings == main.FALSE: |
| 849 | main.log.info("No Loss in the pings") |
| 850 | main.log.report("No loss of dataplane connectivity") |
| 851 | utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings, |
| 852 | onpass="No Loss of connectivity", |
| 853 | onfail="Loss of dataplane connectivity detected") |
| 854 | |
| 855 | |
| 856 | #TODO:add topology to this or leave as a seperate case? |
| 857 | result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) |
| 858 | result = int(result) |
| 859 | if result == main.TRUE: |
| 860 | main.log.report("Constant State Tests Passed") |
| 861 | utilities.assert_equals(expect=main.TRUE,actual=result, |
| 862 | onpass="Constant State Tests Passed", |
| 863 | onfail="Constant state tests failed") |
| 864 | |
| 865 | def CASE8 (self,main): |
| 866 | ''' |
| 867 | Compare topo |
| 868 | ''' |
| 869 | import sys |
| 870 | sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params |
| 871 | from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH |
| 872 | import json |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 873 | import time |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 874 | |
| 875 | description ="Compare ONOS Topology view to Mininet topology" |
| 876 | main.case(description) |
| 877 | main.log.report(description) |
| 878 | main.step("Create TestONTopology object") |
| 879 | ctrls = [] |
| 880 | count = 1 |
| 881 | while True: |
| 882 | temp = () |
| 883 | if ('ip' + str(count)) in main.params['CTRL']: |
| 884 | temp = temp + (getattr(main,('ONOS' + str(count))),) |
| 885 | temp = temp + ("ONOS"+str(count),) |
| 886 | temp = temp + (main.params['CTRL']['ip'+str(count)],) |
| 887 | temp = temp + (eval(main.params['CTRL']['port'+str(count)]),) |
| 888 | ctrls.append(temp) |
| 889 | count = count + 1 |
| 890 | else: |
| 891 | break |
| 892 | MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations |
| 893 | |
| 894 | main.step("Collecting topology information from ONOS") |
| 895 | devices = [] |
| 896 | devices.append( main.ONOScli1.devices() ) |
| 897 | devices.append( main.ONOScli2.devices() ) |
| 898 | devices.append( main.ONOScli3.devices() ) |
| 899 | devices.append( main.ONOScli4.devices() ) |
| 900 | devices.append( main.ONOScli5.devices() ) |
| 901 | devices.append( main.ONOScli6.devices() ) |
| 902 | devices.append( main.ONOScli7.devices() ) |
| 903 | ''' |
| 904 | hosts = [] |
| 905 | hosts.append( main.ONOScli1.hosts() ) |
| 906 | hosts.append( main.ONOScli2.hosts() ) |
| 907 | hosts.append( main.ONOScli3.hosts() ) |
| 908 | hosts.append( main.ONOScli4.hosts() ) |
| 909 | hosts.append( main.ONOScli5.hosts() ) |
| 910 | hosts.append( main.ONOScli6.hosts() ) |
| 911 | hosts.append( main.ONOScli7.hosts() ) |
| 912 | ''' |
| 913 | ports = [] |
| 914 | ports.append( main.ONOScli1.ports() ) |
| 915 | ports.append( main.ONOScli2.ports() ) |
| 916 | ports.append( main.ONOScli3.ports() ) |
| 917 | ports.append( main.ONOScli4.ports() ) |
| 918 | ports.append( main.ONOScli5.ports() ) |
| 919 | ports.append( main.ONOScli6.ports() ) |
| 920 | ports.append( main.ONOScli7.ports() ) |
| 921 | links = [] |
| 922 | links.append( main.ONOScli1.links() ) |
| 923 | links.append( main.ONOScli2.links() ) |
| 924 | links.append( main.ONOScli3.links() ) |
| 925 | links.append( main.ONOScli4.links() ) |
| 926 | links.append( main.ONOScli5.links() ) |
| 927 | links.append( main.ONOScli6.links() ) |
| 928 | links.append( main.ONOScli7.links() ) |
| 929 | |
| 930 | |
| 931 | main.step("Comparing ONOS topology to MN") |
| 932 | devices_results = main.TRUE |
| 933 | ports_results = main.TRUE |
| 934 | links_results = main.TRUE |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 935 | topo_result = main.FALSE |
| 936 | start_time = time.time() |
| 937 | elapsed = 0 |
| 938 | while topo_result == main.FALSE and elapsed < 120: |
| 939 | try: |
| 940 | for controller in range(7): #TODO parameterize the number of controllers |
| 941 | if devices[controller] or not "Error" in devices[controller]: |
| 942 | current_devices_result = main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller])) |
| 943 | else: |
| 944 | current_devices_result = main.FALSE |
| 945 | utilities.assert_equals(expect=main.TRUE, actual=current_devices_result, |
| 946 | onpass="ONOS"+str(int(controller+1))+" Switches view is correct", |
| 947 | onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 948 | |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 949 | if ports[controller] or not "Error" in ports[controller]: |
| 950 | current_ports_result = main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller])) |
| 951 | else: |
| 952 | current_ports_result = main.FALSE |
| 953 | utilities.assert_equals(expect=main.TRUE, actual=current_ports_result, |
| 954 | onpass="ONOS"+str(int(controller+1))+" ports view is correct", |
| 955 | onfail="ONOS"+str(int(controller+1))+" ports view is incorrect") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 956 | |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 957 | if links[controller] or not "Error" in links[controller]: |
| 958 | current_links_result = main.Mininet1.compare_links(MNTopo, json.loads(links[controller])) |
| 959 | else: |
| 960 | current_links_result = main.FALSE |
| 961 | utilities.assert_equals(expect=main.TRUE, actual=current_links_result, |
| 962 | onpass="ONOS"+str(int(controller+1))+" links view is correct", |
| 963 | onfail="ONOS"+str(int(controller+1))+" links view is incorrect") |
| 964 | except: |
| 965 | main.log.error("something went wrong in topo comparison") |
| 966 | main.log.warn( repr( devices ) ) |
| 967 | main.log.warn( repr( ports ) ) |
| 968 | main.log.warn( repr( links ) ) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 969 | |
| 970 | devices_results = devices_results and current_devices_result |
| 971 | ports_results = ports_results and current_ports_result |
| 972 | links_results = links_results and current_links_result |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 973 | elapsed = time.time()-start_time() |
| 974 | time_threshold = elapsed < 1 |
| 975 | topo_result = devices_results and ports_results and links_results and time_threshold |
| 976 | #TODO make sure this step is non-blocking. IE add a timeout |
| 977 | main.log.report("Very crass estimate for topology discovery/convergence: " + str(elapsed) + " seconds") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 978 | utilities.assert_equals(expect=main.TRUE, actual=topo_result, |
| 979 | onpass="Topology Check Test successful", |
| 980 | onfail="Topology Check Test NOT successful") |
| 981 | if topo_result == main.TRUE: |
| 982 | main.log.report("ONOS topology view matches Mininet topology") |
| 983 | |
| 984 | |
| 985 | def CASE9 (self,main): |
| 986 | ''' |
| 987 | Link s3-s28 down |
| 988 | ''' |
| 989 | #NOTE: You should probably run a topology check after this |
| 990 | |
| 991 | link_sleep = int(main.params['timers']['LinkDiscovery']) |
| 992 | |
| 993 | description = "Turn off a link to ensure that Link Discovery is working properly" |
| 994 | main.log.report(description) |
| 995 | main.case(description) |
| 996 | |
| 997 | |
| 998 | main.step("Kill Link between s3 and s28") |
| 999 | Link_Down = main.Mininet1.link(END1="s3",END2="s28",OPTION="down") |
| 1000 | main.log.info("Waiting " + str(link_sleep) + " seconds for link down to be discovered") |
| 1001 | time.sleep(link_sleep) |
| 1002 | utilities.assert_equals(expect=main.TRUE,actual=Link_Down, |
| 1003 | onpass="Link down succesful", |
| 1004 | onfail="Failed to bring link down") |
| 1005 | #TODO do some sort of check here |
| 1006 | |
| 1007 | def CASE10 (self,main): |
| 1008 | ''' |
| 1009 | Link s3-s28 up |
| 1010 | ''' |
| 1011 | #NOTE: You should probably run a topology check after this |
| 1012 | |
| 1013 | link_sleep = int(main.params['timers']['LinkDiscovery']) |
| 1014 | |
| 1015 | description = "Restore a link to ensure that Link Discovery is working properly" |
| 1016 | main.log.report(description) |
| 1017 | main.case(description) |
| 1018 | |
| 1019 | main.step("Bring link between s3 and s28 back up") |
| 1020 | Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up") |
| 1021 | main.log.info("Waiting " + str(link_sleep) + " seconds for link up to be discovered") |
| 1022 | time.sleep(link_sleep) |
| 1023 | utilities.assert_equals(expect=main.TRUE,actual=Link_Up, |
| 1024 | onpass="Link up succesful", |
| 1025 | onfail="Failed to bring link up") |
| 1026 | #TODO do some sort of check here |
| 1027 | |
| 1028 | |
| 1029 | def CASE11 (self, main) : |
| 1030 | ''' |
| 1031 | Switch Down |
| 1032 | ''' |
| 1033 | #NOTE: You should probably run a topology check after this |
| 1034 | import time |
| 1035 | |
| 1036 | switch_sleep = int(main.params['timers']['SwitchDiscovery']) |
| 1037 | |
| 1038 | description = "Killing a switch to ensure it is discovered correctly" |
| 1039 | main.log.report(description) |
| 1040 | main.case(description) |
| 1041 | |
| 1042 | #TODO: Make this switch parameterizable |
| 1043 | main.step("Kill s28 ") |
| 1044 | main.log.report("Deleting s28") |
| 1045 | #FIXME: use new dynamic topo functions |
| 1046 | main.Mininet1.del_switch("s28") |
| 1047 | main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered") |
| 1048 | time.sleep(switch_sleep) |
| 1049 | #Peek at the deleted switch |
| 1050 | main.log.warn(main.ONOScli1.get_device(dpid="0028")) |
| 1051 | #TODO do some sort of check here |
| 1052 | |
| 1053 | def CASE12 (self, main) : |
| 1054 | ''' |
| 1055 | Switch Up |
| 1056 | ''' |
| 1057 | #NOTE: You should probably run a topology check after this |
| 1058 | import time |
| 1059 | #FIXME: use new dynamic topo functions |
| 1060 | description = "Adding a switch to ensure it is discovered correctly" |
| 1061 | main.log.report(description) |
| 1062 | main.case(description) |
| 1063 | |
| 1064 | main.step("Add back s28") |
| 1065 | main.log.report("Adding back s28") |
| 1066 | main.Mininet1.add_switch("s28", dpid = '0000000000002800') |
| 1067 | #TODO: New dpid or same? Ask Thomas? |
| 1068 | main.Mininet1.add_link('s28', 's3') |
| 1069 | main.Mininet1.add_link('s28', 's6') |
| 1070 | main.Mininet1.add_link('s28', 'h28') |
| 1071 | main.Mininet1.assign_sw_controller(sw="28",count=7, |
| 1072 | ip1=ONOS1_ip,port1=ONOS1_port, |
| 1073 | ip2=ONOS2_ip,port2=ONOS2_port, |
| 1074 | ip3=ONOS3_ip,port3=ONOS3_port, |
| 1075 | ip4=ONOS4_ip,port4=ONOS4_port, |
| 1076 | ip5=ONOS5_ip,port5=ONOS5_port, |
| 1077 | ip6=ONOS6_ip,port6=ONOS6_port, |
| 1078 | ip7=ONOS7_ip,port7=ONOS7_port) |
| 1079 | main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered") |
| 1080 | time.sleep(switch_sleep) |
| 1081 | #Peek at the added switch |
| 1082 | main.log.warn(main.ONOScli1.get_device(dpid="0028")) |
| 1083 | #TODO do some sort of check here |
| 1084 | |
| 1085 | def CASE13 (self, main) : |
| 1086 | ''' |
| 1087 | Clean up |
| 1088 | ''' |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 1089 | import os |
| 1090 | import time |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 1091 | description = "Test Cleanup" |
| 1092 | main.log.report(description) |
| 1093 | main.case(description) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 1094 | main.step("Killing tcpdumps") |
| 1095 | main.Mininet2.stop_tcpdump() |
| 1096 | |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 1097 | main.step("Copying MN pcap and ONOS log files to test station") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 1098 | testname = main.TEST |
Jon Hall | 73cf9cc | 2014-11-20 22:28:38 -0800 | [diff] [blame] | 1099 | #NOTE: MN Pcap file is being saved to ~/packet_captures |
| 1100 | # scp this file as MN and TestON aren't necessarily the same vm |
| 1101 | #FIXME: scp |
| 1102 | #####mn files |
| 1103 | #TODO: Load these from params |
| 1104 | #NOTE: must end in / |
| 1105 | log_folder = "/opt/onos/log/" |
| 1106 | log_files = ["karaf.log", "karaf.log.1"] |
| 1107 | #NOTE: must end in / |
| 1108 | dst_dir = "~/packet_captures/" |
| 1109 | for f in log_files: |
| 1110 | main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\ |
| 1111 | dst_dir + str(testname) + "-ONOS1-"+f ) |
| 1112 | main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\ |
| 1113 | dst_dir + str(testname) + "-ONOS2-"+f ) |
| 1114 | main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\ |
| 1115 | dst_dir + str(testname) + "-ONOS3-"+f ) |
| 1116 | main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\ |
| 1117 | dst_dir + str(testname) + "-ONOS4-"+f ) |
| 1118 | main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\ |
| 1119 | dst_dir + str(testname) + "-ONOS5-"+f ) |
| 1120 | main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\ |
| 1121 | dst_dir + str(testname) + "-ONOS6-"+f ) |
| 1122 | main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\ |
| 1123 | dst_dir + str(testname) + "-ONOS7-"+f ) |
| 1124 | |
| 1125 | #std*.log's |
| 1126 | #NOTE: must end in / |
| 1127 | log_folder = "/opt/onos/var/" |
| 1128 | log_files = ["stderr.log", "stdout.log"] |
| 1129 | #NOTE: must end in / |
| 1130 | dst_dir = "~/packet_captures/" |
| 1131 | for f in log_files: |
| 1132 | main.ONOSbench.secureCopy( "sdn", ONOS1_ip,log_folder+f,"rocks",\ |
| 1133 | dst_dir + str(testname) + "-ONOS1-"+f ) |
| 1134 | main.ONOSbench.secureCopy( "sdn", ONOS2_ip,log_folder+f,"rocks",\ |
| 1135 | dst_dir + str(testname) + "-ONOS2-"+f ) |
| 1136 | main.ONOSbench.secureCopy( "sdn", ONOS3_ip,log_folder+f,"rocks",\ |
| 1137 | dst_dir + str(testname) + "-ONOS3-"+f ) |
| 1138 | main.ONOSbench.secureCopy( "sdn", ONOS4_ip,log_folder+f,"rocks",\ |
| 1139 | dst_dir + str(testname) + "-ONOS4-"+f ) |
| 1140 | main.ONOSbench.secureCopy( "sdn", ONOS5_ip,log_folder+f,"rocks",\ |
| 1141 | dst_dir + str(testname) + "-ONOS5-"+f ) |
| 1142 | main.ONOSbench.secureCopy( "sdn", ONOS6_ip,log_folder+f,"rocks",\ |
| 1143 | dst_dir + str(testname) + "-ONOS6-"+f ) |
| 1144 | main.ONOSbench.secureCopy( "sdn", ONOS7_ip,log_folder+f,"rocks",\ |
| 1145 | dst_dir + str(testname) + "-ONOS7-"+f ) |
| 1146 | |
| 1147 | |
| 1148 | |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 1149 | |
| 1150 | #sleep so scp can finish |
| 1151 | time.sleep(10) |
| 1152 | main.step("Packing and rotating pcap archives") |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 1153 | os.system("~/TestON/dependencies/rotate.sh "+ str(testname)) |
Jon Hall | b1290e8 | 2014-11-18 16:17:48 -0500 | [diff] [blame] | 1154 | |
Jon Hall | 368769f | 2014-11-19 15:43:35 -0800 | [diff] [blame] | 1155 | |
| 1156 | #TODO: actually check something here |
| 1157 | utilities.assert_equals(expect=main.TRUE, actual=main.TRUE, |
| 1158 | onpass="Test cleanup successful", |
| 1159 | onfail="Test cleanup NOT successful") |