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