andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1 | #TopoPerfNext |
| 2 | # |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 3 | #Topology Convergence scale-out test for ONOS-next |
| 4 | #NOTE: This test supports up to 7 nodes scale-out scenario |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 5 | # |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 6 | #NOTE: Ensure that you have 'tablet.json' file |
| 7 | # in the onos/tools/package/config directory |
| 8 | #NOTE: You must start this test initially with 3 nodes |
| 9 | # |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 10 | #andrew@onlab.us |
| 11 | |
| 12 | import time |
| 13 | import sys |
| 14 | import os |
| 15 | import re |
| 16 | |
| 17 | class TopoConvNext: |
| 18 | def __init__(self): |
| 19 | self.default = '' |
| 20 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 21 | def CASE1(self, main): |
| 22 | ''' |
| 23 | ONOS startup sequence |
| 24 | ''' |
| 25 | import time |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 26 | |
| 27 | #****** |
| 28 | #Global cluster count for scale-out purposes |
| 29 | global cluster_count |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 30 | global topo_iteration |
| 31 | topo_iteration = 1 |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 32 | cluster_count = 3 |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 33 | #****** |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 34 | cell_name = main.params['ENV']['cellName'] |
| 35 | |
| 36 | git_pull = main.params['GIT']['autoPull'] |
| 37 | checkout_branch = main.params['GIT']['checkout'] |
| 38 | |
| 39 | ONOS1_ip = main.params['CTRL']['ip1'] |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 40 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 41 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 42 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 43 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 44 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 45 | ONOS7_ip = main.params['CTRL']['ip7'] |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 46 | MN1_ip = main.params['MN']['ip1'] |
| 47 | BENCH_ip = main.params['BENCH']['ip'] |
| 48 | |
| 49 | main.case("Setting up test environment") |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 50 | main.step("copying topology event accumulator config file"+ |
| 51 | " to ONOS package/etc/ directory") |
| 52 | topo_config_name = main.params['TEST']['topo_config_name'] |
| 53 | topo_config =\ |
| 54 | main.params['TEST']['topo_accumulator_config'] |
| 55 | main.ONOSbench.handle.sendline("cp ~/"+topo_config+ |
| 56 | " ~/ONOS/tools/package/etc/"+ |
| 57 | topo_config_name) |
| 58 | main.ONOSbench.handle.expect("\$") |
| 59 | |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 60 | main.log.info("Uninstalling previous instances") |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 61 | #main.ONOSbench.onos_uninstall(node_ip = ONOS1_ip) |
| 62 | #main.ONOSbench.onos_uninstall(node_ip = ONOS2_ip) |
| 63 | #main.ONOSbench.onos_uninstall(node_ip = ONOS3_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 64 | main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip) |
| 65 | main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip) |
| 66 | main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip) |
| 67 | main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip) |
| 68 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 69 | main.log.report("Setting up test environment") |
| 70 | |
| 71 | main.step("Creating cell file") |
| 72 | cell_file_result = main.ONOSbench.create_cell_file( |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 73 | BENCH_ip, cell_name, MN1_ip, |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 74 | "onos-core,onos-app-metrics", |
| 75 | ONOS1_ip, ONOS2_ip, ONOS3_ip) |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 76 | |
| 77 | main.step("Applying cell file to environment") |
| 78 | cell_apply_result = main.ONOSbench.set_cell(cell_name) |
| 79 | verify_cell_result = main.ONOSbench.verify_cell() |
| 80 | |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 81 | main.step("Removing raft logs") |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 82 | main.ONOSbench.onos_remove_raft_logs() |
| 83 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 84 | main.step("Git checkout and pull "+checkout_branch) |
| 85 | if git_pull == 'on': |
| 86 | checkout_result = \ |
| 87 | main.ONOSbench.git_checkout(checkout_branch) |
| 88 | pull_result = main.ONOSbench.git_pull() |
| 89 | else: |
| 90 | checkout_result = main.TRUE |
| 91 | pull_result = main.TRUE |
| 92 | main.log.info("Skipped git checkout and pull") |
| 93 | |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 94 | main.log.report("Commit information - ") |
| 95 | main.ONOSbench.get_version() |
| 96 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 97 | main.step("Using mvn clean & install") |
| 98 | #mvn_result = main.ONOSbench.clean_install() |
| 99 | mvn_result = main.TRUE |
| 100 | |
| 101 | main.step("Set cell for ONOS cli env") |
| 102 | main.ONOS1cli.set_cell(cell_name) |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 103 | main.ONOS2cli.set_cell(cell_name) |
| 104 | main.ONOS3cli.set_cell(cell_name) |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 105 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 106 | main.step("Creating ONOS package") |
| 107 | package_result = main.ONOSbench.onos_package() |
| 108 | |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 109 | #Start test with single node only |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 110 | main.step("Installing ONOS package") |
| 111 | install1_result = main.ONOSbench.onos_install(node=ONOS1_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 112 | install2_result = main.ONOSbench.onos_install(node=ONOS2_ip) |
| 113 | install3_result = main.ONOSbench.onos_install(node=ONOS3_ip) |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 114 | |
| 115 | time.sleep(10) |
| 116 | |
| 117 | main.step("Start onos cli") |
| 118 | cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 119 | cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip) |
| 120 | cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip) |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 121 | |
| 122 | main.step("Enable metrics feature") |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 123 | #main.ONOS1cli.feature_install("onos-app-metrics") |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 124 | |
| 125 | utilities.assert_equals(expect=main.TRUE, |
| 126 | actual= cell_file_result and cell_apply_result and\ |
| 127 | verify_cell_result and checkout_result and\ |
| 128 | pull_result and mvn_result and\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 129 | install1_result and install2_result and\ |
| 130 | install3_result, |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 131 | onpass="Test Environment setup successful", |
| 132 | onfail="Failed to setup test environment") |
| 133 | |
| 134 | def CASE2(self, main): |
| 135 | ''' |
| 136 | 100 Switch discovery latency |
| 137 | |
| 138 | Important: |
| 139 | This test case can be potentially dangerous if |
| 140 | your machine has previously set iptables rules. |
| 141 | One of the steps of the test case will flush |
| 142 | all existing iptables rules. |
| 143 | Note: |
| 144 | You can specify the number of switches in the |
| 145 | params file to adjust the switch discovery size |
| 146 | (and specify the corresponding topology in Mininet1 |
| 147 | .topo file) |
| 148 | ''' |
| 149 | import time |
| 150 | import subprocess |
| 151 | import os |
| 152 | import requests |
| 153 | import json |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 154 | import numpy |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 155 | |
| 156 | ONOS_ip_list = [] |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 157 | ONOS_ip_list.append('0') |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 158 | ONOS_ip_list.append(main.params['CTRL']['ip1']) |
| 159 | ONOS_ip_list.append(main.params['CTRL']['ip2']) |
| 160 | ONOS_ip_list.append(main.params['CTRL']['ip3']) |
| 161 | ONOS_ip_list.append(main.params['CTRL']['ip4']) |
| 162 | ONOS_ip_list.append(main.params['CTRL']['ip5']) |
| 163 | ONOS_ip_list.append(main.params['CTRL']['ip6']) |
| 164 | ONOS_ip_list.append(main.params['CTRL']['ip7']) |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 165 | MN1_ip = main.params['MN']['ip1'] |
| 166 | ONOS_user = main.params['CTRL']['user'] |
| 167 | |
| 168 | default_sw_port = main.params['CTRL']['port1'] |
| 169 | |
| 170 | #Number of iterations of case |
| 171 | num_iter = main.params['TEST']['numIter'] |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 172 | iter_ignore = int(main.params['TEST']['iterIgnore']) |
| 173 | |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 174 | #*********** |
| 175 | #Global number of switches that change |
| 176 | #throughout the test |
| 177 | global num_sw |
| 178 | global topo_iteration |
| 179 | if topo_iteration == 1: |
| 180 | num_sw = main.params['TEST']['numSwitch1'] |
| 181 | elif topo_iteration == 2: |
| 182 | num_sw = main.params['TEST']['numSwitch2'] |
| 183 | elif topo_iteration == 3: |
| 184 | num_sw = main.params['TEST']['numSwitch3'] |
| 185 | #*********** |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 186 | |
| 187 | #Timestamp 'keys' for json metrics output. |
| 188 | #These are subject to change, hence moved into params |
| 189 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 190 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
| 191 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 192 | #Threshold for this test case |
| 193 | sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold'] |
| 194 | sw_disc_threshold_obj = sw_disc_threshold_str.split(",") |
| 195 | sw_disc_threshold_min = int(sw_disc_threshold_obj[0]) |
| 196 | sw_disc_threshold_max = int(sw_disc_threshold_obj[1]) |
| 197 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 198 | assertion = main.TRUE |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 199 | sw_discovery_lat_list = [] |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 200 | syn_ack_delta_list = [] |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 201 | |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 202 | main.case(str(num_sw)+" switches distributed across "+ |
| 203 | str(cluster_count)+" nodes convergence latency") |
andrewonlab | 0d4478f | 2014-11-11 20:31:20 -0500 | [diff] [blame] | 204 | |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 205 | main.log.report("Large topology convergence and scale-out test") |
andrewonlab | 0d4478f | 2014-11-11 20:31:20 -0500 | [diff] [blame] | 206 | main.log.report("Currently active ONOS node(s): ") |
| 207 | report_str = "Node " |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 208 | for node in range(1, cluster_count+1): |
| 209 | report_str += (str(node) + " ") |
andrewonlab | 0d4478f | 2014-11-11 20:31:20 -0500 | [diff] [blame] | 210 | main.log.report(report_str) |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 211 | main.log.report("Topology size: "+str(num_sw)+" switches") |
| 212 | |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 213 | main.step("Distributing "+num_sw+" switches to each ONOS") |
andrewonlab | 0d4478f | 2014-11-11 20:31:20 -0500 | [diff] [blame] | 214 | index = 1 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 215 | for node in range(1, cluster_count+1): |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 216 | for i in range(index, (int(num_sw)/cluster_count)+index): |
andrewonlab | 0d4478f | 2014-11-11 20:31:20 -0500 | [diff] [blame] | 217 | main.Mininet1.assign_sw_controller( |
| 218 | sw=str(i), |
| 219 | ip1=ONOS_ip_list[node], |
| 220 | port1=default_sw_port) |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 221 | index = i+1 |
| 222 | |
| 223 | main.log.info("Please check ptpd configuration to ensure "+\ |
| 224 | "all nodes' system times are in sync") |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 225 | |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 226 | time.sleep(10) |
| 227 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 228 | for i in range(0, int(num_iter)): |
| 229 | main.step("Set iptables rule to block sw connections") |
| 230 | |
| 231 | #INPUT rules |
| 232 | main.ONOS1.handle.sendline( |
| 233 | "sudo iptables -A INPUT -p tcp -s "+ |
| 234 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 235 | main.ONOS2.handle.sendline( |
| 236 | "sudo iptables -A INPUT -p tcp -s "+ |
| 237 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 238 | main.ONOS3.handle.sendline( |
| 239 | "sudo iptables -A INPUT -p tcp -s "+ |
| 240 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 241 | main.ONOS4.handle.sendline( |
| 242 | "sudo iptables -A INPUT -p tcp -s "+ |
| 243 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 244 | main.ONOS5.handle.sendline( |
| 245 | "sudo iptables -A INPUT -p tcp -s "+ |
| 246 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 247 | main.ONOS6.handle.sendline( |
| 248 | "sudo iptables -A INPUT -p tcp -s "+ |
| 249 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 250 | main.ONOS7.handle.sendline( |
| 251 | "sudo iptables -A INPUT -p tcp -s "+ |
| 252 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 253 | |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 254 | #OUTPUT rules |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 255 | main.ONOS1.handle.sendline( |
| 256 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 257 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 258 | main.ONOS2.handle.sendline( |
| 259 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 260 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 261 | main.ONOS3.handle.sendline( |
| 262 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 263 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 264 | main.ONOS4.handle.sendline( |
| 265 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 266 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 267 | main.ONOS5.handle.sendline( |
| 268 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 269 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 270 | main.ONOS6.handle.sendline( |
| 271 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 272 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
| 273 | main.ONOS7.handle.sendline( |
| 274 | "sudo iptables -A OUTPUT -p tcp -s "+ |
| 275 | MN1_ip+" --dport "+default_sw_port+" -j DROP") |
andrewonlab | 0d4478f | 2014-11-11 20:31:20 -0500 | [diff] [blame] | 276 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 277 | main.log.info("Please wait for switch connection to timeout") |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 278 | |
| 279 | |
| 280 | #time.sleep(60) |
| 281 | #if cluster_count >= 3: |
| 282 | # time.sleep(60) |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 283 | #if cluster_count >= 5: |
| 284 | # time.sleep(30) |
| 285 | #if cluster_count >= 6: |
| 286 | # time.sleep(30) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 287 | |
| 288 | if cluster_count >= 3: |
| 289 | main.ONOS1.tshark_grep("SYN, ACK", |
| 290 | "/tmp/syn_ack_onos1_iter"+str(i)+".txt") |
| 291 | main.ONOS2.tshark_grep("SYN, ACK", |
| 292 | "/tmp/syn_ack_onos2_iter"+str(i)+".txt") |
| 293 | main.ONOS3.tshark_grep("SYN, ACK", |
| 294 | "/tmp/syn_ack_onos3_iter"+str(i)+".txt") |
| 295 | if cluster_count >= 4: |
| 296 | main.ONOS4.tshark_grep("SYN, ACK", |
| 297 | "/tmp/syn_ack_onos4_iter"+str(i)+".txt") |
| 298 | if cluster_count >= 5: |
| 299 | main.ONOS5.tshark_grep("SYN, ACK", |
| 300 | "/tmp/syn_ack_onos5_iter"+str(i)+".txt") |
| 301 | if cluster_count >= 6: |
| 302 | main.ONOS6.tshark_grep("SYN, ACK", |
| 303 | "/tmp/syn_ack_onos6_iter"+str(i)+".txt") |
| 304 | if cluster_count == 7: |
| 305 | main.ONOS7.tshark_grep("SYN, ACK", |
| 306 | "/tmp/syn_ack_onos7_iter"+str(i)+".txt") |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 307 | |
| 308 | loop_count = 0 |
| 309 | device_count = 0 |
| 310 | while loop_count < 60: |
| 311 | main.log.info("Checking devices for device down") |
| 312 | device_str = main.ONOS1cli.devices() |
| 313 | device_json = json.loads(device_str) |
| 314 | for device in device_json: |
| 315 | if device['available'] == False: |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 316 | #print device_count |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 317 | device_count += 1 |
| 318 | else: |
| 319 | device_count = 0 |
| 320 | if device_count >= int(num_sw)*int(cluster_count): |
| 321 | main.step("Flushing iptables and obtaining t0") |
| 322 | t0_system = time.time()*1000 |
| 323 | main.ONOS1.handle.sendline("sudo iptables -F") |
| 324 | main.ONOS2.handle.sendline("sudo iptables -F") |
| 325 | main.ONOS3.handle.sendline("sudo iptables -F") |
| 326 | main.ONOS4.handle.sendline("sudo iptables -F") |
| 327 | main.ONOS5.handle.sendline("sudo iptables -F") |
| 328 | main.ONOS6.handle.sendline("sudo iptables -F") |
| 329 | main.ONOS7.handle.sendline("sudo iptables -F") |
| 330 | |
| 331 | break |
| 332 | |
| 333 | time.sleep(1) |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 334 | |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 335 | main.log.info("System time t0: "+str(t0_system)) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 336 | |
| 337 | counter_loop = 0 |
| 338 | counter_avail1 = 0 |
| 339 | counter_avail2 = 0 |
| 340 | counter_avail3 = 0 |
| 341 | counter_avail4 = 0 |
| 342 | counter_avail5 = 0 |
| 343 | counter_avail6 = 0 |
| 344 | counter_avail7 = 0 |
| 345 | onos1_dev = False |
| 346 | onos2_dev = False |
| 347 | onos3_dev = False |
| 348 | onos4_dev = False |
| 349 | onos5_dev = False |
| 350 | onos6_dev = False |
| 351 | onos7_dev = False |
| 352 | |
| 353 | #TODO: Think of a more elegant way to check all |
| 354 | # switches across all nodes |
| 355 | #Goodluck debugging this loop |
| 356 | while counter_loop < 60: |
| 357 | for node in range(1, cluster_count+1): |
| 358 | if node == 1 and not onos1_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 359 | main.log.info("Checking node 1 for device "+ |
| 360 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 361 | device_str_obj1 = main.ONOS1cli.devices() |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 362 | device_json1 = json.loads(device_str_obj1) |
| 363 | for device1 in device_json1: |
| 364 | if device1['available'] == True: |
| 365 | counter_avail1 += 1 |
| 366 | if counter_avail1 == int(num_sw): |
| 367 | onos1_dev = True |
| 368 | main.log.info("All devices have been"+ |
| 369 | " discovered on ONOS1") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 370 | else: |
| 371 | counter_avail1 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 372 | if node == 2 and not onos2_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 373 | main.log.info("Checking node 2 for device "+ |
| 374 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 375 | device_str_obj2 = main.ONOS2cli.devices() |
| 376 | device_json2 = json.loads(device_str_obj2) |
| 377 | for device2 in device_json2: |
| 378 | if device2['available'] == True: |
| 379 | counter_avail2 += 1 |
| 380 | if counter_avail2 == int(num_sw): |
| 381 | onos2_dev = True |
| 382 | main.log.info("All devices have been"+ |
| 383 | " discovered on ONOS2") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 384 | else: |
| 385 | counter_avail2 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 386 | if node == 3 and not onos3_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 387 | main.log.info("Checking node 3 for device "+ |
| 388 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 389 | device_str_obj3 = main.ONOS3cli.devices() |
| 390 | device_json3 = json.loads(device_str_obj3) |
| 391 | for device3 in device_json3: |
| 392 | if device3['available'] == True: |
| 393 | counter_avail3 += 1 |
| 394 | if counter_avail3 == int(num_sw): |
| 395 | onos3_dev = True |
| 396 | main.log.info("All devices have been"+ |
| 397 | " discovered on ONOS3") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 398 | else: |
| 399 | counter_avail3 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 400 | if node == 4 and not onos4_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 401 | main.log.info("Checking node 4 for device "+ |
| 402 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 403 | device_str_obj4 = main.ONOS4cli.devices() |
| 404 | device_json4 = json.loads(device_str_obj4) |
| 405 | for device4 in device_json4: |
| 406 | if device4['available'] == True: |
| 407 | counter_avail4 += 1 |
| 408 | if counter_avail4 == int(num_sw): |
| 409 | onos4_dev = True |
| 410 | main.log.info("All devices have been"+ |
| 411 | " discovered on ONOS4") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 412 | else: |
| 413 | counter_avail4 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 414 | if node == 5 and not onos5_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 415 | main.log.info("Checking node 5 for device "+ |
| 416 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 417 | device_str_obj5 = main.ONOS5cli.devices() |
| 418 | device_json5 = json.loads(device_str_obj5) |
| 419 | for device5 in device_json5: |
| 420 | if device5['available'] == True: |
| 421 | counter_avail5 += 1 |
| 422 | if counter_avail5 == int(num_sw): |
| 423 | onos5_dev = True |
| 424 | main.log.info("All devices have been"+ |
| 425 | " discovered on ONOS5") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 426 | else: |
| 427 | counter_avail5 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 428 | if node == 6 and not onos6_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 429 | main.log.info("Checking node 6 for device "+ |
| 430 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 431 | device_str_obj6 = main.ONOS6cli.devices() |
| 432 | device_json6 = json.loads(device_str_obj6) |
| 433 | for device6 in device_json6: |
| 434 | if device6['available'] == True: |
| 435 | counter_avail6 += 1 |
| 436 | if counter_avail6 == int(num_sw): |
| 437 | onos6_dev = True |
| 438 | main.log.info("All devices have been"+ |
| 439 | " discovered on ONOS6") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 440 | else: |
| 441 | counter_avail6 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 442 | if node == 7 and not onos7_dev: |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 443 | main.log.info("Checking node 7 for device "+ |
| 444 | "discovery") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 445 | device_str_obj7 = main.ONOS7cli.devices() |
| 446 | device_json7 = json.loads(device_str_obj7) |
| 447 | for device7 in device_json7: |
| 448 | if device7['available'] == True: |
| 449 | counter_avail7 += 1 |
| 450 | if counter_avail7 == int(num_sw): |
| 451 | onos7_dev = True |
| 452 | main.log.info("All devices have been"+ |
| 453 | " discovered on ONOS7") |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 454 | else: |
| 455 | counter_avail7 = 0 |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 456 | #END node loop |
| 457 | |
| 458 | #TODO: clean up this mess of an if statements if possible |
| 459 | #Treat each if as a separate test case with the given |
| 460 | # cluster count. Hence when the cluster count changes |
| 461 | # the desired calculations will be made |
| 462 | if cluster_count == 1: |
| 463 | if onos1_dev: |
| 464 | main.log.info("All devices have been discovered"+ |
| 465 | " on all ONOS instances") |
| 466 | json_str_metrics_1 =\ |
| 467 | main.ONOS1cli.topology_events_metrics() |
| 468 | json_obj_1 = json.loads(json_str_metrics_1) |
| 469 | graph_timestamp_1 =\ |
| 470 | json_obj_1[graphTimestamp]['value'] |
| 471 | |
| 472 | graph_lat_1 = \ |
| 473 | int(graph_timestamp_1) - int(t0_system) |
| 474 | |
| 475 | if graph_lat_1 > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 476 | and graph_lat_1 < sw_disc_threshold_max\ |
| 477 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 478 | sw_discovery_lat_list.append( |
| 479 | graph_lat_1) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 480 | main.log.info("Sw discovery latency of "+ |
| 481 | str(cluster_count)+" node(s): "+ |
| 482 | str(graph_lat_1)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 483 | else: |
| 484 | main.log.info("Switch discovery latency "+ |
| 485 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 486 | main.log.info(graph_lat_1) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 487 | #Break while loop |
| 488 | break |
| 489 | if cluster_count == 2: |
| 490 | if onos1_dev and onos2_dev: |
| 491 | main.log.info("All devices have been discovered"+ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 492 | " on all "+str(cluster_count)+ |
| 493 | " ONOS instances") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 494 | json_str_metrics_1 =\ |
| 495 | main.ONOS1cli.topology_events_metrics() |
| 496 | json_str_metrics_2 =\ |
| 497 | main.ONOS2cli.topology_events_metrics() |
| 498 | json_obj_1 = json.loads(json_str_metrics_1) |
| 499 | json_obj_2 = json.loads(json_str_metrics_2) |
| 500 | graph_timestamp_1 =\ |
| 501 | json_obj_1[graphTimestamp]['value'] |
| 502 | graph_timestamp_2 =\ |
| 503 | json_obj_2[graphTimestamp]['value'] |
| 504 | |
| 505 | graph_lat_1 = \ |
| 506 | int(graph_timestamp_1) - int(t0_system) |
| 507 | graph_lat_2 = \ |
| 508 | int(graph_timestamp_2) - int(t0_system) |
| 509 | |
| 510 | avg_graph_lat = \ |
| 511 | (int(graph_lat_1) +\ |
| 512 | int(graph_lat_2)) / 2 |
| 513 | |
| 514 | if avg_graph_lat > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 515 | and avg_graph_lat < sw_disc_threshold_max\ |
| 516 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 517 | sw_discovery_lat_list.append( |
| 518 | avg_graph_lat) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 519 | main.log.info("Sw discovery latency of "+ |
| 520 | str(cluster_count)+" node(s): "+ |
| 521 | str(avg_graph_lat)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 522 | else: |
| 523 | main.log.info("Switch discovery latency "+ |
| 524 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 525 | main.log.info(avg_graph_lat) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 526 | break |
| 527 | if cluster_count == 3: |
| 528 | if onos1_dev and onos2_dev and onos3_dev: |
| 529 | main.log.info("All devices have been discovered"+ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 530 | " on all "+str(cluster_count)+ |
| 531 | " ONOS instances") |
| 532 | |
| 533 | #TODO: Investigate this sleep |
| 534 | # added to 'pad' the results with |
| 535 | # plenty of time to 'catch up' |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 536 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 537 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 538 | json_str_metrics_1 =\ |
| 539 | main.ONOS1cli.topology_events_metrics() |
| 540 | json_str_metrics_2 =\ |
| 541 | main.ONOS2cli.topology_events_metrics() |
| 542 | json_str_metrics_3 =\ |
| 543 | main.ONOS3cli.topology_events_metrics() |
| 544 | json_obj_1 = json.loads(json_str_metrics_1) |
| 545 | json_obj_2 = json.loads(json_str_metrics_2) |
| 546 | json_obj_3 = json.loads(json_str_metrics_3) |
| 547 | graph_timestamp_1 =\ |
| 548 | json_obj_1[graphTimestamp]['value'] |
| 549 | graph_timestamp_2 =\ |
| 550 | json_obj_2[graphTimestamp]['value'] |
| 551 | graph_timestamp_3 =\ |
| 552 | json_obj_3[graphTimestamp]['value'] |
| 553 | |
| 554 | graph_lat_1 = \ |
| 555 | int(graph_timestamp_1) - int(t0_system) |
| 556 | graph_lat_2 = \ |
| 557 | int(graph_timestamp_2) - int(t0_system) |
| 558 | graph_lat_3 = \ |
| 559 | int(graph_timestamp_3) - int(t0_system) |
| 560 | |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 561 | main.log.info("DEBUG: graph_timestamp_1: "+ |
| 562 | str(graph_timestamp_1)) |
| 563 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 564 | avg_graph_lat = \ |
| 565 | (int(graph_lat_1) +\ |
| 566 | int(graph_lat_2) +\ |
| 567 | int(graph_lat_3)) / 3 |
| 568 | |
| 569 | if avg_graph_lat > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 570 | and avg_graph_lat < sw_disc_threshold_max\ |
| 571 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 572 | sw_discovery_lat_list.append( |
| 573 | avg_graph_lat) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 574 | main.log.info("Sw discovery latency of "+ |
| 575 | str(cluster_count)+" node(s): "+ |
| 576 | str(avg_graph_lat)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 577 | else: |
| 578 | main.log.info("Switch discovery latency "+ |
| 579 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 580 | main.log.info(avg_graph_lat) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 581 | |
| 582 | break |
| 583 | if cluster_count == 4: |
| 584 | if onos1_dev and onos2_dev and onos3_dev and\ |
| 585 | onos4_dev: |
| 586 | main.log.info("All devices have been discovered"+ |
| 587 | " on all ONOS instances") |
| 588 | json_str_metrics_1 =\ |
| 589 | main.ONOS1cli.topology_events_metrics() |
| 590 | json_str_metrics_2 =\ |
| 591 | main.ONOS2cli.topology_events_metrics() |
| 592 | json_str_metrics_3 =\ |
| 593 | main.ONOS3cli.topology_events_metrics() |
| 594 | json_str_metrics_4 =\ |
| 595 | main.ONOS4cli.topology_events_metrics() |
| 596 | json_obj_1 = json.loads(json_str_metrics_1) |
| 597 | json_obj_2 = json.loads(json_str_metrics_2) |
| 598 | json_obj_3 = json.loads(json_str_metrics_3) |
| 599 | json_obj_4 = json.loads(json_str_metrics_4) |
| 600 | graph_timestamp_1 =\ |
| 601 | json_obj_1[graphTimestamp]['value'] |
| 602 | graph_timestamp_2 =\ |
| 603 | json_obj_2[graphTimestamp]['value'] |
| 604 | graph_timestamp_3 =\ |
| 605 | json_obj_3[graphTimestamp]['value'] |
| 606 | graph_timestamp_4 =\ |
| 607 | json_obj_4[graphTimestamp]['value'] |
| 608 | |
| 609 | graph_lat_1 = \ |
| 610 | int(graph_timestamp_1) - int(t0_system) |
| 611 | graph_lat_2 = \ |
| 612 | int(graph_timestamp_2) - int(t0_system) |
| 613 | graph_lat_3 = \ |
| 614 | int(graph_timestamp_3) - int(t0_system) |
| 615 | graph_lat_4 = \ |
| 616 | int(graph_timestamp_4) - int(t0_system) |
| 617 | |
| 618 | avg_graph_lat = \ |
| 619 | (int(graph_lat_1) +\ |
| 620 | int(graph_lat_2) +\ |
| 621 | int(graph_lat_3) +\ |
| 622 | int(graph_lat_4)) / 4 |
| 623 | |
| 624 | if avg_graph_lat > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 625 | and avg_graph_lat < sw_disc_threshold_max\ |
| 626 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 627 | sw_discovery_lat_list.append( |
| 628 | avg_graph_lat) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 629 | main.log.info("Sw discovery latency of "+ |
| 630 | str(cluster_count)+" node(s): "+ |
| 631 | str(avg_graph_lat)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 632 | else: |
| 633 | main.log.info("Switch discovery latency "+ |
| 634 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 635 | main.log.info(avg_graph_lat) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 636 | |
| 637 | break |
| 638 | if cluster_count == 5: |
| 639 | if onos1_dev and onos2_dev and onos3_dev and\ |
| 640 | onos4_dev and onos5_dev: |
| 641 | main.log.info("All devices have been discovered"+ |
| 642 | " on all ONOS instances") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 643 | |
| 644 | #TODO: Investigate this sleep |
| 645 | # added to 'pad' the results with |
| 646 | # plenty of time to 'catch up' |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 647 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 648 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 649 | json_str_metrics_1 =\ |
| 650 | main.ONOS1cli.topology_events_metrics() |
| 651 | json_str_metrics_2 =\ |
| 652 | main.ONOS2cli.topology_events_metrics() |
| 653 | json_str_metrics_3 =\ |
| 654 | main.ONOS3cli.topology_events_metrics() |
| 655 | json_str_metrics_4 =\ |
| 656 | main.ONOS4cli.topology_events_metrics() |
| 657 | json_str_metrics_5 =\ |
| 658 | main.ONOS5cli.topology_events_metrics() |
| 659 | json_obj_1 = json.loads(json_str_metrics_1) |
| 660 | json_obj_2 = json.loads(json_str_metrics_2) |
| 661 | json_obj_3 = json.loads(json_str_metrics_3) |
| 662 | json_obj_4 = json.loads(json_str_metrics_4) |
| 663 | json_obj_5 = json.loads(json_str_metrics_5) |
| 664 | graph_timestamp_1 =\ |
| 665 | json_obj_1[graphTimestamp]['value'] |
| 666 | graph_timestamp_2 =\ |
| 667 | json_obj_2[graphTimestamp]['value'] |
| 668 | graph_timestamp_3 =\ |
| 669 | json_obj_3[graphTimestamp]['value'] |
| 670 | graph_timestamp_4 =\ |
| 671 | json_obj_4[graphTimestamp]['value'] |
| 672 | graph_timestamp_5 =\ |
| 673 | json_obj_5[graphTimestamp]['value'] |
| 674 | |
| 675 | graph_lat_1 = \ |
| 676 | int(graph_timestamp_1) - int(t0_system) |
| 677 | graph_lat_2 = \ |
| 678 | int(graph_timestamp_2) - int(t0_system) |
| 679 | graph_lat_3 = \ |
| 680 | int(graph_timestamp_3) - int(t0_system) |
| 681 | graph_lat_4 = \ |
| 682 | int(graph_timestamp_4) - int(t0_system) |
| 683 | graph_lat_5 = \ |
| 684 | int(graph_timestamp_5) - int(t0_system) |
| 685 | |
| 686 | avg_graph_lat = \ |
| 687 | (int(graph_lat_1) +\ |
| 688 | int(graph_lat_2) +\ |
| 689 | int(graph_lat_3) +\ |
| 690 | int(graph_lat_4) +\ |
| 691 | int(graph_lat_5)) / 5 |
| 692 | |
| 693 | if avg_graph_lat > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 694 | and avg_graph_lat < sw_disc_threshold_max\ |
| 695 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 696 | sw_discovery_lat_list.append( |
| 697 | avg_graph_lat) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 698 | main.log.info("Sw discovery latency of "+ |
| 699 | str(cluster_count)+" node(s): "+ |
| 700 | str(avg_graph_lat)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 701 | else: |
| 702 | main.log.info("Switch discovery latency "+ |
| 703 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 704 | main.log.info(avg_graph_lat) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 705 | |
| 706 | break |
| 707 | if cluster_count == 6: |
| 708 | if onos1_dev and onos2_dev and onos3_dev and\ |
| 709 | onos4_dev and onos5_dev and onos6_dev: |
| 710 | main.log.info("All devices have been discovered"+ |
| 711 | " on all ONOS instances") |
| 712 | json_str_metrics_1 =\ |
| 713 | main.ONOS1cli.topology_events_metrics() |
| 714 | json_str_metrics_2 =\ |
| 715 | main.ONOS2cli.topology_events_metrics() |
| 716 | json_str_metrics_3 =\ |
| 717 | main.ONOS3cli.topology_events_metrics() |
| 718 | json_str_metrics_4 =\ |
| 719 | main.ONOS4cli.topology_events_metrics() |
| 720 | json_str_metrics_5 =\ |
| 721 | main.ONOS5cli.topology_events_metrics() |
| 722 | json_str_metrics_6 =\ |
| 723 | main.ONOS6cli.topology_events_metrics() |
| 724 | json_obj_1 = json.loads(json_str_metrics_1) |
| 725 | json_obj_2 = json.loads(json_str_metrics_2) |
| 726 | json_obj_3 = json.loads(json_str_metrics_3) |
| 727 | json_obj_4 = json.loads(json_str_metrics_4) |
| 728 | json_obj_5 = json.loads(json_str_metrics_5) |
| 729 | json_obj_6 = json.loads(json_str_metrics_6) |
| 730 | graph_timestamp_1 =\ |
| 731 | json_obj_1[graphTimestamp]['value'] |
| 732 | graph_timestamp_2 =\ |
| 733 | json_obj_2[graphTimestamp]['value'] |
| 734 | graph_timestamp_3 =\ |
| 735 | json_obj_3[graphTimestamp]['value'] |
| 736 | graph_timestamp_4 =\ |
| 737 | json_obj_4[graphTimestamp]['value'] |
| 738 | graph_timestamp_5 =\ |
| 739 | json_obj_5[graphTimestamp]['value'] |
| 740 | graph_timestamp_6 =\ |
| 741 | json_obj_6[graphTimestamp]['value'] |
| 742 | |
| 743 | graph_lat_1 = \ |
| 744 | int(graph_timestamp_1) - int(t0_system) |
| 745 | graph_lat_2 = \ |
| 746 | int(graph_timestamp_2) - int(t0_system) |
| 747 | graph_lat_3 = \ |
| 748 | int(graph_timestamp_3) - int(t0_system) |
| 749 | graph_lat_4 = \ |
| 750 | int(graph_timestamp_4) - int(t0_system) |
| 751 | graph_lat_5 = \ |
| 752 | int(graph_timestamp_5) - int(t0_system) |
| 753 | graph_lat_6 = \ |
| 754 | int(graph_timestamp_6) - int(t0_system) |
| 755 | |
| 756 | avg_graph_lat = \ |
| 757 | (int(graph_lat_1) +\ |
| 758 | int(graph_lat_2) +\ |
| 759 | int(graph_lat_3) +\ |
| 760 | int(graph_lat_4) +\ |
| 761 | int(graph_lat_5) +\ |
| 762 | int(graph_lat_6)) / 6 |
| 763 | |
| 764 | if avg_graph_lat > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 765 | and avg_graph_lat < sw_disc_threshold_max\ |
| 766 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 767 | sw_discovery_lat_list.append( |
| 768 | avg_graph_lat) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 769 | main.log.info("Sw discovery latency of "+ |
| 770 | str(cluster_count)+" node(s): "+ |
| 771 | str(avg_graph_lat)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 772 | else: |
| 773 | main.log.info("Switch discovery latency "+ |
| 774 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 775 | main.log.info(avg_graph_lat) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 776 | |
| 777 | break |
| 778 | if cluster_count == 7: |
| 779 | if onos1_dev and onos2_dev and onos3_dev and\ |
| 780 | onos4_dev and onos5_dev and onos6_dev and\ |
| 781 | onos7_dev: |
| 782 | main.log.info("All devices have been discovered"+ |
| 783 | " on all ONOS instances") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 784 | |
| 785 | #TODO: Investigate this sleep |
| 786 | # added to 'pad' the results with |
| 787 | # plenty of time to 'catch up' |
andrewonlab | 6274902 | 2014-11-19 19:19:58 -0500 | [diff] [blame] | 788 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 789 | |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 790 | json_str_metrics_1 =\ |
| 791 | main.ONOS1cli.topology_events_metrics() |
| 792 | json_str_metrics_2 =\ |
| 793 | main.ONOS2cli.topology_events_metrics() |
| 794 | json_str_metrics_3 =\ |
| 795 | main.ONOS3cli.topology_events_metrics() |
| 796 | json_str_metrics_4 =\ |
| 797 | main.ONOS4cli.topology_events_metrics() |
| 798 | json_str_metrics_5 =\ |
| 799 | main.ONOS5cli.topology_events_metrics() |
| 800 | json_str_metrics_6 =\ |
| 801 | main.ONOS6cli.topology_events_metrics() |
| 802 | json_str_metrics_7 =\ |
| 803 | main.ONOS7cli.topology_events_metrics() |
| 804 | json_obj_1 = json.loads(json_str_metrics_1) |
| 805 | json_obj_2 = json.loads(json_str_metrics_2) |
| 806 | json_obj_3 = json.loads(json_str_metrics_3) |
| 807 | json_obj_4 = json.loads(json_str_metrics_4) |
| 808 | json_obj_5 = json.loads(json_str_metrics_5) |
| 809 | json_obj_6 = json.loads(json_str_metrics_6) |
| 810 | json_obj_7 = json.loads(json_str_metrics_7) |
| 811 | graph_timestamp_1 =\ |
| 812 | json_obj_1[graphTimestamp]['value'] |
| 813 | graph_timestamp_2 =\ |
| 814 | json_obj_2[graphTimestamp]['value'] |
| 815 | graph_timestamp_3 =\ |
| 816 | json_obj_3[graphTimestamp]['value'] |
| 817 | graph_timestamp_4 =\ |
| 818 | json_obj_4[graphTimestamp]['value'] |
| 819 | graph_timestamp_5 =\ |
| 820 | json_obj_5[graphTimestamp]['value'] |
| 821 | graph_timestamp_6 =\ |
| 822 | json_obj_6[graphTimestamp]['value'] |
| 823 | graph_timestamp_7 =\ |
| 824 | json_obj_7[graphTimestamp]['value'] |
| 825 | |
| 826 | graph_lat_1 = \ |
| 827 | int(graph_timestamp_1) - int(t0_system) |
| 828 | graph_lat_2 = \ |
| 829 | int(graph_timestamp_2) - int(t0_system) |
| 830 | graph_lat_3 = \ |
| 831 | int(graph_timestamp_3) - int(t0_system) |
| 832 | graph_lat_4 = \ |
| 833 | int(graph_timestamp_4) - int(t0_system) |
| 834 | graph_lat_5 = \ |
| 835 | int(graph_timestamp_5) - int(t0_system) |
| 836 | graph_lat_6 = \ |
| 837 | int(graph_timestamp_6) - int(t0_system) |
| 838 | graph_lat_7 = \ |
| 839 | int(graph_timestamp_7) - int(t0_system) |
| 840 | |
| 841 | avg_graph_lat = \ |
| 842 | (int(graph_lat_1) +\ |
| 843 | int(graph_lat_2) +\ |
| 844 | int(graph_lat_3) +\ |
| 845 | int(graph_lat_4) +\ |
| 846 | int(graph_lat_5) +\ |
| 847 | int(graph_lat_6) +\ |
| 848 | int(graph_lat_7)) / 7 |
| 849 | |
| 850 | if avg_graph_lat > sw_disc_threshold_min\ |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 851 | and avg_graph_lat < sw_disc_threshold_max\ |
| 852 | and int(i) > iter_ignore: |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 853 | sw_discovery_lat_list.append( |
| 854 | avg_graph_lat) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 855 | main.log.info("Sw discovery latency of "+ |
| 856 | str(cluster_count)+" node(s): "+ |
| 857 | str(avg_graph_lat)+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 858 | else: |
| 859 | main.log.info("Switch discovery latency "+ |
| 860 | "exceeded the threshold.") |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 861 | main.log.info(avg_graph_lat) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 862 | |
| 863 | break |
| 864 | |
| 865 | counter_loop += 1 |
| 866 | time.sleep(3) |
| 867 | #END WHILE LOOP |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 868 | |
| 869 | main.ONOS1.tshark_stop() |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 870 | syn_ack_timestamp_list = [] |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 871 | |
| 872 | if cluster_count >= 3: |
| 873 | main.ONOS2.tshark_stop() |
| 874 | main.ONOS3.tshark_stop() |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 875 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 876 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 877 | "/tmp/syn_ack_onos1_iter"+str(i)+".txt /tmp/") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 878 | os.system("scp "+ONOS_user+"@"+ONOS2_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 879 | "/tmp/syn_ack_onos2_iter"+str(i)+".txt /tmp/") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 880 | os.system("scp "+ONOS_user+"@"+ONOS3_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 881 | "/tmp/syn_ack_onos3_iter"+str(i)+".txt /tmp/") |
| 882 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 883 | #Read each of the files and append all |
| 884 | #SYN / ACK timestamps to the list |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 885 | with open("/tmp/syn_ack_onos1_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 886 | f_onos1: |
| 887 | for line in f_onos1: |
| 888 | line = line.split(" ") |
| 889 | syn_ack_timestamp_list.append(line[1]) |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 890 | with open("/tmp/syn_ack_onos2_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 891 | f_onos2: |
| 892 | for line in f_onos2: |
| 893 | line = line.split(" ") |
| 894 | syn_ack_timestamp_list.append(line[1]) |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 895 | with open("/tmp/syn_ack_onos3_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 896 | f_onos3: |
| 897 | for line in f_onos3: |
| 898 | line = line.split(" ") |
| 899 | syn_ack_timestamp_list.append(line[1]) |
| 900 | if cluster_count >= 4: |
| 901 | main.ONOS4.tshark_stop() |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 902 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 903 | os.system("scp "+ONOS_user+"@"+ONOS4_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 904 | "/tmp/syn_ack_onos4_iter"+str(i)+".txt /tmp/") |
| 905 | time.sleep(5) |
| 906 | with open("/tmp/syn_ack_onos4_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 907 | f_onos4: |
| 908 | for line in f_onos4: |
| 909 | line = line.split(" ") |
| 910 | syn_ack_timestamp_list.append(line[1]) |
| 911 | if cluster_count >= 5: |
| 912 | main.ONOS5.tshark_stop() |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 913 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 914 | os.system("scp "+ONOS_user+"@"+ONOS5_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 915 | "/tmp/syn_ack_onos5_iter"+str(i)+".txt /tmp/") |
| 916 | time.sleep(5) |
| 917 | with open("/tmp/syn_ack_onos5_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 918 | f_onos5: |
| 919 | for line in f_onos5: |
| 920 | line = line.split(" ") |
| 921 | syn_ack_timestamp_list.append(line[1]) |
| 922 | if cluster_count >= 6: |
| 923 | main.ONOS6.tshark_stop() |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 924 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 925 | os.system("scp "+ONOS_user+"@"+ONOS6_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 926 | "/tmp/syn_ack_onos6_iter"+str(i)+".txt /tmp/") |
| 927 | time.sleep(5) |
| 928 | with open("/tmp/syn_ack_onos6_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 929 | f_onos6: |
| 930 | for line in f_onos6: |
| 931 | line = line.split(" ") |
| 932 | syn_ack_timestamp_list.append(line[1]) |
| 933 | if cluster_count == 7: |
| 934 | main.ONOS7.tshark_stop() |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 935 | time.sleep(5) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 936 | os.system("scp "+ONOS_user+"@"+ONOS7_ip+":"+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 937 | "/tmp/syn_ack_onos7_iter"+str(i)+".txt /tmp/") |
| 938 | time.sleep(5) |
| 939 | with open("/tmp/syn_ack_onos7_iter"+str(i)+".txt") as\ |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 940 | f_onos7: |
| 941 | for line in f_onos7: |
| 942 | line = line.split(" ") |
| 943 | syn_ack_timestamp_list.append(line[1]) |
| 944 | |
| 945 | #Sort the list by timestamp |
| 946 | syn_ack_timestamp_list = sorted(syn_ack_timestamp_list) |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 947 | |
| 948 | syn_ack_delta =\ |
| 949 | int(float(syn_ack_timestamp_list[-1])*1000) -\ |
| 950 | int(float(syn_ack_timestamp_list[0])*1000) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 951 | |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 952 | main.log.info("Switch connection attempt delta iteration "+ |
| 953 | str(i)+": "+str(syn_ack_delta)) |
| 954 | syn_ack_delta_list.append(syn_ack_delta) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 955 | #END ITERATION LOOP |
| 956 | #REPORT HERE |
| 957 | |
| 958 | if len(sw_discovery_lat_list) > 0: |
| 959 | sw_lat_avg = sum(sw_discovery_lat_list) / \ |
| 960 | len(sw_discovery_lat_list) |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 961 | sw_lat_dev = numpy.std(sw_discovery_lat_list) |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 962 | else: |
| 963 | assertion = main.FALSE |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 964 | |
| 965 | main.log.report("Switch connection attempt time avg "+ |
andrewonlab | d784d4f | 2014-11-17 17:47:32 -0500 | [diff] [blame] | 966 | "(last sw SYN/ACK time - first sw SYN/ACK time) "+ |
andrewonlab | a127217 | 2014-11-17 17:30:35 -0500 | [diff] [blame] | 967 | str(sum(syn_ack_delta_list)/len(syn_ack_delta_list)) + |
| 968 | " ms") |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 969 | main.log.report(str(num_sw)+" Switch discovery lat for "+\ |
| 970 | str(cluster_count)+" instance(s): ") |
| 971 | main.log.report("Avg: "+str(sw_lat_avg)+" ms "+ |
| 972 | "Std Deviation: "+str(round(sw_lat_dev,1))+" ms") |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 973 | |
| 974 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 975 | onpass="Switch discovery convergence latency" +\ |
andrewonlab | fd8325f | 2014-11-12 19:14:06 -0500 | [diff] [blame] | 976 | " for "+str(cluster_count)+" nodes successful", |
andrewonlab | 51b180b | 2014-11-12 18:19:28 -0500 | [diff] [blame] | 977 | onfail="Switch discovery convergence latency" +\ |
| 978 | " test failed") |
| 979 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 980 | def CASE3(self, main): |
| 981 | ''' |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 982 | Increase number of nodes and initiate CLI |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 983 | ''' |
| 984 | import time |
| 985 | import subprocess |
| 986 | import os |
| 987 | import requests |
| 988 | import json |
| 989 | |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 990 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 991 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 992 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 993 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 994 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 995 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 996 | ONOS7_ip = main.params['CTRL']['ip7'] |
| 997 | |
| 998 | cell_name = main.params['ENV']['cellName'] |
| 999 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1000 | MN1_ip = main.params['MN']['ip1'] |
| 1001 | BENCH_ip = main.params['BENCH']['ip'] |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 1002 | |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1003 | #NOTE:We start with cluster_count at 3. The first |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1004 | #case already initialized ONOS1. Increase the |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1005 | #cluster count and start from 3. |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1006 | #You can optionally change the increment to |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1007 | #test steps of node sizes, such as 3,5,7 |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 1008 | |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1009 | global cluster_count |
andrewonlab | 54cec4b | 2014-11-12 13:30:23 -0500 | [diff] [blame] | 1010 | cluster_count += 2 |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 1011 | main.log.report("Increasing cluster size to "+ |
| 1012 | str(cluster_count)) |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1013 | |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1014 | install_result = main.FALSE |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1015 | #Supports up to 7 node configuration |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1016 | #TODO: Cleanup this ridiculous repetitive code |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1017 | if cluster_count == 4: |
| 1018 | main.log.info("Installing ONOS on node 4") |
| 1019 | install_result = \ |
| 1020 | main.ONOSbench.onos_install(node=ONOS4_ip) |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1021 | time.sleep(5) |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1022 | main.log.info("Starting CLI") |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1023 | main.ONOS4cli.start_onos_cli(ONOS4_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1024 | main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip) |
| 1025 | |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1026 | elif cluster_count == 5: |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1027 | main.log.info("Installing ONOS on nodes 4 and 5") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1028 | install_result1 = \ |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1029 | main.ONOSbench.onos_install(node=ONOS4_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1030 | install_result2 = \ |
| 1031 | main.ONOSbench.onos_install(node=ONOS5_ip) |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1032 | time.sleep(5) |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1033 | main.log.info("Starting CLI") |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1034 | main.ONOS4cli.start_onos_cli(ONOS4_ip) |
| 1035 | main.ONOS5cli.start_onos_cli(ONOS5_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1036 | main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip) |
| 1037 | main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip) |
| 1038 | install_result = install_result1 and install_result2 |
| 1039 | |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1040 | elif cluster_count == 6: |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1041 | main.log.info("Installing ONOS on nodes 4, 5,and 6") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1042 | install_result1 = \ |
| 1043 | main.ONOSbench.onos_install(options="",node=ONOS4_ip) |
| 1044 | install_result2 = \ |
| 1045 | main.ONOSbench.onos_install(options="",node=ONOS5_ip) |
| 1046 | install_result3 = \ |
| 1047 | main.ONOSbench.onos_install(node=ONOS6_ip) |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1048 | time.sleep(5) |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1049 | main.log.info("Starting CLI") |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1050 | main.ONOS4cli.start_onos_cli(ONOS4_ip) |
| 1051 | main.ONOS5cli.start_onos_cli(ONOS5_ip) |
| 1052 | main.ONOS6cli.start_onos_cli(ONOS6_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1053 | main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip) |
| 1054 | main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip) |
| 1055 | main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip) |
| 1056 | install_result = install_result1 and install_result2 and\ |
| 1057 | install_result3 |
| 1058 | |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1059 | elif cluster_count == 7: |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1060 | main.log.info("Installing ONOS on nodes 4, 5, 6,and 7") |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1061 | install_result1 = \ |
| 1062 | main.ONOSbench.onos_install(options="",node=ONOS4_ip) |
| 1063 | install_result2 = \ |
| 1064 | main.ONOSbench.onos_install(options="",node=ONOS5_ip) |
| 1065 | install_result3 = \ |
| 1066 | main.ONOSbench.onos_install(options="",node=ONOS6_ip) |
| 1067 | install_result4 = \ |
| 1068 | main.ONOSbench.onos_install(node=ONOS7_ip) |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1069 | main.log.info("Starting CLI") |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1070 | main.ONOS4cli.start_onos_cli(ONOS4_ip) |
| 1071 | main.ONOS5cli.start_onos_cli(ONOS5_ip) |
| 1072 | main.ONOS6cli.start_onos_cli(ONOS6_ip) |
| 1073 | main.ONOS7cli.start_onos_cli(ONOS7_ip) |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1074 | main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip) |
| 1075 | main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip) |
| 1076 | main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip) |
| 1077 | main.ONOS1cli.add_node(ONOS7_ip, ONOS7_ip) |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1078 | |
andrewonlab | a036b40 | 2014-11-17 13:47:46 -0500 | [diff] [blame] | 1079 | install_result = install_result1 and install_result2 and\ |
| 1080 | install_result3 and install_result4 |
andrewonlab | 81763ee | 2014-11-13 17:31:34 -0500 | [diff] [blame] | 1081 | |
| 1082 | time.sleep(5) |
andrewonlab | add2fd6 | 2014-11-11 18:37:35 -0500 | [diff] [blame] | 1083 | |
andrewonlab | 0cfc7ad | 2014-11-13 16:29:26 -0500 | [diff] [blame] | 1084 | if install_result == main.TRUE: |
| 1085 | assertion = main.TRUE |
| 1086 | else: |
| 1087 | assertion = main.FALSE |
| 1088 | |
| 1089 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 1090 | onpass="Scale out to "+str(cluster_count)+\ |
| 1091 | " nodes successful", |
| 1092 | onfail="Scale out to "+str(cluster_count)+\ |
| 1093 | " nodes failed") |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1094 | |
| 1095 | |
| 1096 | def CASE4(self, main): |
| 1097 | ''' |
| 1098 | Cleanup ONOS nodes and Increase topology size |
| 1099 | ''' |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 1100 | #TODO: use meaningful assertion |
| 1101 | assertion=main.TRUE |
andrewonlab | 7b4e8ba | 2014-11-20 17:45:04 -0500 | [diff] [blame] | 1102 | |
| 1103 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 1104 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 1105 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 1106 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 1107 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 1108 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 1109 | ONOS7_ip = main.params['CTRL']['ip7'] |
| 1110 | MN1_ip = main.params['MN']['ip1'] |
| 1111 | BENCH_ip = main.params['BENCH']['ip'] |
| 1112 | |
| 1113 | main.log.info("Uninstalling previous instances") |
| 1114 | main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip) |
| 1115 | main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip) |
| 1116 | main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip) |
| 1117 | main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip) |
| 1118 | |
| 1119 | global topo_iteration |
| 1120 | global cluster_count |
| 1121 | cluster_count = 3 |
| 1122 | topo_iteration += 1 |
| 1123 | |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 1124 | main.log.report("Increasing topology size") |
| 1125 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 1126 | onpass="Topology size increased successfully", |
| 1127 | onfail="Topology size was not increased") |