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