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