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