andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1 | #TopoPerfNext |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 2 | # |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 3 | #Topology Performance test for ONOS-next |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 4 | # |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 5 | #andrew@onlab.us |
andrewonlab | 4f50ec9 | 2014-11-11 14:24:45 -0500 | [diff] [blame] | 6 | # |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 7 | #If your machine does not come with numpy |
| 8 | #run the following command: |
| 9 | #sudo apt-get install python-numpy python-scipy |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 10 | |
| 11 | import time |
| 12 | import sys |
| 13 | import os |
| 14 | import re |
| 15 | |
| 16 | class TopoPerfNext: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 17 | def __init__(self): |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 18 | self.default = '' |
| 19 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 20 | def CASE1(self, main): |
| 21 | ''' |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 22 | ONOS startup sequence |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 23 | ''' |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 24 | import time |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 25 | |
| 26 | ## Global cluster count for scale-out purposes |
| 27 | global cluster_count |
| 28 | #Set initial cluster count |
| 29 | cluster_count = 1 |
| 30 | ## |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 31 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 32 | cell_name = main.params['ENV']['cellName'] |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 33 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 34 | git_pull = main.params['GIT']['autoPull'] |
| 35 | checkout_branch = main.params['GIT']['checkout'] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 36 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 37 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 38 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 39 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 40 | |
andrewonlab | 6c8bbeb | 2014-11-14 12:43:48 -0500 | [diff] [blame] | 41 | #### Hardcoded ONOS nodes particular to my env #### |
| 42 | ONOS4_ip = "10.128.174.4" |
| 43 | ONOS5_ip = "10.128.174.5" |
| 44 | ONOS6_ip = "10.128.174.6" |
| 45 | ONOS7_ip = "10.128.174.7" |
| 46 | #### #### |
| 47 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 48 | MN1_ip = main.params['MN']['ip1'] |
| 49 | BENCH_ip = main.params['BENCH']['ip'] |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 50 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 51 | topo_cfg_file = main.params['TEST']['topo_config_file'] |
| 52 | topo_cfg_name = main.params['TEST']['topo_config_name'] |
| 53 | |
| 54 | main.case("Setting up test environment") |
| 55 | main.log.info("Copying topology event accumulator config"+\ |
| 56 | " to ONOS /package/etc") |
| 57 | main.ONOSbench.handle.sendline("cp ~/"+\ |
| 58 | topo_cfg_file+\ |
| 59 | " ~/ONOS/tools/package/etc/"+\ |
| 60 | topo_cfg_name) |
| 61 | main.ONOSbench.handle.expect("\$") |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 62 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 63 | main.log.report("Setting up test environment") |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 64 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 65 | main.step("Cleaning previously installed ONOS if any") |
| 66 | main.ONOSbench.onos_uninstall(node_ip=ONOS2_ip) |
| 67 | main.ONOSbench.onos_uninstall(node_ip=ONOS3_ip) |
| 68 | main.ONOSbench.onos_uninstall(node_ip=ONOS4_ip) |
| 69 | main.ONOSbench.onos_uninstall(node_ip=ONOS5_ip) |
| 70 | main.ONOSbench.onos_uninstall(node_ip=ONOS6_ip) |
| 71 | main.ONOSbench.onos_uninstall(node_ip=ONOS7_ip) |
andrewonlab | 6c8bbeb | 2014-11-14 12:43:48 -0500 | [diff] [blame] | 72 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 73 | main.step("Creating cell file") |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 74 | cell_file_result = main.ONOSbench.create_cell_file( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 75 | BENCH_ip, cell_name, MN1_ip, |
| 76 | "onos-core,onos-app-metrics,onos-app-gui", |
| 77 | ONOS1_ip) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 78 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 79 | main.step("Applying cell file to environment") |
| 80 | cell_apply_result = main.ONOSbench.set_cell(cell_name) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 81 | verify_cell_result = main.ONOSbench.verify_cell() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 82 | |
| 83 | #NOTE: This step may be removed after proper |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 84 | # copy cat log functionality |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 85 | main.step("Removing raft/copy-cat logs from ONOS nodes") |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 86 | main.ONOSbench.onos_remove_raft_logs() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 87 | time.sleep(30) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 88 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 89 | main.step("Git checkout and pull "+checkout_branch) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 90 | if git_pull == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 91 | #checkout_result = \ |
| 92 | # main.ONOSbench.git_checkout(checkout_branch) |
| 93 | checkout_result = main.TRUE |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 94 | pull_result = main.ONOSbench.git_pull() |
| 95 | else: |
| 96 | checkout_result = main.TRUE |
| 97 | pull_result = main.TRUE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 98 | main.log.info("Skipped git checkout and pull") |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 99 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 100 | main.log.report("Commit information - ") |
| 101 | main.ONOSbench.get_version(report=True) |
andrewonlab | 9284434 | 2014-11-18 16:39:11 -0500 | [diff] [blame] | 102 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 103 | main.step("Using mvn clean & install") |
| 104 | mvn_result = main.ONOSbench.clean_install() |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 105 | mvn_result = main.TRUE |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 106 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 107 | main.step("Set cell for ONOS cli env") |
| 108 | main.ONOS1cli.set_cell(cell_name) |
| 109 | #main.ONOS2cli.set_cell(cell_name) |
| 110 | #main.ONOS3cli.set_cell(cell_name) |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 111 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 112 | main.step("Creating ONOS package") |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 113 | package_result = main.ONOSbench.onos_package() |
| 114 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 115 | main.step("Installing ONOS package") |
| 116 | install1_result = main.ONOSbench.onos_install(node=ONOS1_ip) |
| 117 | #install2_result = main.ONOSbench.onos_install(node=ONOS2_ip) |
| 118 | #install3_result = main.ONOSbench.onos_install(node=ONOS3_ip) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 119 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 120 | time.sleep(10) |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 121 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 122 | main.step("Start onos cli") |
| 123 | cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip) |
| 124 | #cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip) |
| 125 | #cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip) |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 126 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 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\ |
| 131 | install1_result, #and install2_result and\ |
| 132 | #install3_result, |
| 133 | onpass="Test Environment setup successful", |
| 134 | onfail="Failed to setup test environment") |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 135 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 136 | def CASE2(self, main): |
| 137 | ''' |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 138 | Assign s1 to ONOS1 and measure latency |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 139 | |
andrewonlab | 3a7c3c7 | 2014-10-24 17:21:03 -0400 | [diff] [blame] | 140 | There are 4 levels of latency measurements to this test: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 141 | 1) End-to-end measurement: Complete end-to-end measurement |
| 142 | from TCP (SYN/ACK) handshake to Graph change |
| 143 | 2) OFP-to-graph measurement: 'ONOS processing' snippet of |
andrewonlab | 3a7c3c7 | 2014-10-24 17:21:03 -0400 | [diff] [blame] | 144 | measurement from OFP Vendor message to Graph change |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 145 | 3) OFP-to-device measurement: 'ONOS processing without |
andrewonlab | 3a7c3c7 | 2014-10-24 17:21:03 -0400 | [diff] [blame] | 146 | graph change' snippet of measurement from OFP vendor |
| 147 | message to Device change timestamp |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 148 | 4) T0-to-device measurement: Measurement that includes |
| 149 | the switch handshake to devices timestamp without |
| 150 | the graph view change. (TCP handshake -> Device |
| 151 | change) |
| 152 | ''' |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 153 | import time |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 154 | import subprocess |
| 155 | import json |
| 156 | import requests |
| 157 | import os |
andrewonlab | 4f50ec9 | 2014-11-11 14:24:45 -0500 | [diff] [blame] | 158 | import numpy |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 159 | global cluster_count |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 160 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 161 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 162 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 163 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 164 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 165 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 166 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 167 | ONOS7_ip = main.params['CTRL']['ip7'] |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 168 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 169 | ONOS_user = main.params['CTRL']['user'] |
andrewonlab | 4b5c8b9 | 2014-11-10 16:04:33 -0500 | [diff] [blame] | 170 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 171 | default_sw_port = main.params['CTRL']['port1'] |
| 172 | |
| 173 | #Number of iterations of case |
| 174 | num_iter = main.params['TEST']['numIter'] |
| 175 | #Number of first 'x' iterations to ignore: |
| 176 | iter_ignore = int(main.params['TEST']['iterIgnore']) |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 177 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 178 | #Timestamp 'keys' for json metrics output. |
| 179 | #These are subject to change, hence moved into params |
| 180 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 181 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 182 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 183 | debug_mode = main.params['TEST']['debugMode'] |
| 184 | onos_log = main.params['TEST']['onosLogFile'] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 185 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 186 | #Threshold for the test |
| 187 | threshold_str = main.params['TEST']['singleSwThreshold'] |
| 188 | threshold_obj = threshold_str.split(",") |
| 189 | threshold_min = int(threshold_obj[0]) |
| 190 | threshold_max = int(threshold_obj[1]) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 191 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 192 | #List of switch add latency collected from |
| 193 | #all iterations |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 194 | latency_end_to_end_list = [] |
| 195 | latency_ofp_to_graph_list = [] |
| 196 | latency_ofp_to_device_list = [] |
| 197 | latency_t0_to_device_list = [] |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 198 | latency_tcp_to_ofp_list = [] |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 199 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 200 | #Directory/file to store tshark results |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 201 | tshark_of_output = "/tmp/tshark_of_topo.txt" |
| 202 | tshark_tcp_output = "/tmp/tshark_tcp_topo.txt" |
| 203 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 204 | #String to grep in tshark output |
| 205 | tshark_tcp_string = "TCP 74 "+default_sw_port |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 206 | tshark_of_string = "OFP 86 Vendor" |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 207 | |
| 208 | #Initialize assertion to TRUE |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 209 | assertion = main.TRUE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 210 | |
| 211 | local_time = time.strftime('%x %X') |
| 212 | local_time = local_time.replace("/","") |
| 213 | local_time = local_time.replace(" ","_") |
| 214 | local_time = local_time.replace(":","") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 215 | if debug_mode == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 216 | main.ONOS1.tshark_pcap("eth0", |
| 217 | "/tmp/single_sw_lat_pcap_"+local_time) |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 218 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 219 | main.log.info("Debug mode is on") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 220 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 221 | main.log.report("Latency of adding one switch to controller") |
| 222 | main.log.report("First "+str(iter_ignore)+" iterations ignored"+ |
| 223 | " for jvm warmup time") |
| 224 | main.log.report("Total iterations of test: "+str(num_iter)) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 225 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 226 | for i in range(0, int(num_iter)): |
| 227 | main.log.info("Starting tshark capture") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 228 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 229 | #* TCP [ACK, SYN] is used as t0_a, the |
| 230 | # very first "exchange" between ONOS and |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 231 | # the switch for end-to-end measurement |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 232 | #* OFP [Stats Reply] is used for t0_b |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 233 | # the very last OFP message between ONOS |
| 234 | # and the switch for ONOS measurement |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 235 | main.ONOS1.tshark_grep(tshark_tcp_string, |
| 236 | tshark_tcp_output) |
| 237 | main.ONOS1.tshark_grep(tshark_of_string, |
| 238 | tshark_of_output) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 239 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 240 | #Wait and ensure tshark is started and |
| 241 | #capturing |
| 242 | time.sleep(10) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 243 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 244 | main.log.info("Assigning s1 to controller") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 245 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 246 | main.Mininet1.assign_sw_controller(sw="1", |
| 247 | ip1=ONOS1_ip, port1=default_sw_port) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 248 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 249 | #Wait and ensure switch is assigned |
| 250 | #before stopping tshark |
| 251 | time.sleep(30) |
| 252 | |
| 253 | main.log.info("Stopping all Tshark processes") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 254 | main.ONOS1.stop_tshark() |
| 255 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 256 | #tshark output is saved in ONOS. Use subprocess |
| 257 | #to copy over files to TestON for parsing |
| 258 | main.log.info("Copying over tshark files") |
| 259 | |
| 260 | #TCP CAPTURE **** |
| 261 | #Copy the tshark output from ONOS machine to |
| 262 | #TestON machine in tshark_tcp_output directory>file |
| 263 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 264 | tshark_tcp_output+" /tmp/") |
| 265 | tcp_file = open(tshark_tcp_output, 'r') |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 266 | temp_text = tcp_file.readline() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 267 | temp_text = temp_text.split(" ") |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 268 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 269 | main.log.info("Object read in from TCP capture: "+ |
| 270 | str(temp_text)) |
| 271 | if len(temp_text) > 1: |
| 272 | t0_tcp = float(temp_text[1])*1000.0 |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 273 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 274 | main.log.error("Tshark output file for TCP"+ |
| 275 | " returned unexpected results") |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 276 | t0_tcp = 0 |
| 277 | assertion = main.FALSE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 278 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 279 | tcp_file.close() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 280 | #**************** |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 281 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 282 | #OF CAPTURE **** |
| 283 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 284 | tshark_of_output+" /tmp/") |
| 285 | of_file = open(tshark_of_output, 'r') |
| 286 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 287 | line_ofp = "" |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 288 | #Read until last line of file |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 289 | while True: |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 290 | temp_text = of_file.readline() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 291 | if temp_text !='': |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 292 | line_ofp = temp_text |
| 293 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 294 | break |
| 295 | obj = line_ofp.split(" ") |
| 296 | |
| 297 | main.log.info("Object read in from OFP capture: "+ |
| 298 | str(line_ofp)) |
| 299 | |
| 300 | if len(line_ofp) > 1: |
| 301 | t0_ofp = float(obj[1])*1000.0 |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 302 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 303 | main.log.error("Tshark output file for OFP"+ |
| 304 | " returned unexpected results") |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 305 | t0_ofp = 0 |
| 306 | assertion = main.FALSE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 307 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 308 | of_file.close() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 309 | #**************** |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 310 | |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 311 | json_str_1 = main.ONOS1cli.topology_events_metrics() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 312 | #Initialize scale-out variables |
| 313 | json_str_2 = "" |
| 314 | json_str_3 = "" |
| 315 | json_str_4 = "" |
| 316 | json_str_5 = "" |
| 317 | json_str_6 = "" |
| 318 | json_str_7 = "" |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 319 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 320 | json_obj_1 = json.loads(json_str_1) |
| 321 | #Initialize scale-out variables |
| 322 | json_obj_2 = "" |
| 323 | json_obj_3 = "" |
| 324 | json_obj_4 = "" |
| 325 | json_obj_5 = "" |
| 326 | json_obj_6 = "" |
| 327 | json_obj_7 = "" |
| 328 | |
| 329 | #Obtain graph timestamp. This timestsamp captures |
| 330 | #the epoch time at which the topology graph was updated. |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 331 | graph_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 332 | json_obj_1[graphTimestamp]['value'] |
| 333 | #Obtain device timestamp. This timestamp captures |
| 334 | #the epoch time at which the device event happened |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 335 | device_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 336 | json_obj_1[deviceTimestamp]['value'] |
| 337 | |
| 338 | #t0 to device processing latency |
| 339 | delta_device_1 = int(device_timestamp_1) - int(t0_tcp) |
| 340 | |
| 341 | #t0 to graph processing latency (end-to-end) |
| 342 | delta_graph_1 = int(graph_timestamp_1) - int(t0_tcp) |
| 343 | |
| 344 | #ofp to graph processing latency (ONOS processing) |
| 345 | delta_ofp_graph_1 = int(graph_timestamp_1) - int(t0_ofp) |
| 346 | |
| 347 | #ofp to device processing latency (ONOS processing) |
| 348 | delta_ofp_device_1 = float(device_timestamp_1) - float(t0_ofp) |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 349 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 350 | #TODO: Create even cluster number events |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 351 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 352 | #Include scale-out measurements when applicable |
| 353 | if cluster_count >= 3: |
| 354 | json_str_2 = main.ONOS2cli.topology_events_metrics() |
| 355 | json_str_3 = main.ONOS3cli.topology_events_metrics() |
| 356 | json_obj_2 = json.loads(json_str_2) |
| 357 | json_obj_3 = json.loads(json_str_3) |
| 358 | graph_timestamp_2 = \ |
| 359 | json_obj_2[graphTimestamp]['value'] |
| 360 | graph_timestamp_3 = \ |
| 361 | json_obj_3[graphTimestamp]['value'] |
| 362 | device_timestamp_2 = \ |
| 363 | json_obj_2[deviceTimestamp]['value'] |
| 364 | device_timestamp_3 = \ |
| 365 | json_obj_3[deviceTimestamp]['value'] |
| 366 | delta_device_2 = int(device_timestamp_2) - int(t0_tcp) |
| 367 | delta_device_3 = int(device_timestamp_3) - int(t0_tcp) |
| 368 | delta_graph_2 = int(graph_timestamp_2) - int(t0_tcp) |
| 369 | delta_graph_3 = int(graph_timestamp_3) - int(t0_tcp) |
| 370 | delta_ofp_graph_2 = int(graph_timestamp_2) - int(t0_ofp) |
| 371 | delta_ofp_graph_3 = int(graph_timestamp_3) - int(t0_ofp) |
| 372 | delta_ofp_device_2 = float(device_timestamp_2) -\ |
| 373 | float(t0_ofp) |
| 374 | delta_ofp_device_3 = float(device_timestamp_3) -\ |
| 375 | float(t0_ofp) |
| 376 | else: |
| 377 | delta_device_2 = 0 |
| 378 | delta_device_3 = 0 |
| 379 | delta_graph_2 = 0 |
| 380 | delta_graph_3 = 0 |
| 381 | delta_ofp_graph_2 = 0 |
| 382 | delta_ofp_graph_3 = 0 |
| 383 | delta_ofp_device_2 = 0 |
| 384 | delta_ofp_device_3 = 0 |
| 385 | |
| 386 | if cluster_count >= 5: |
| 387 | json_str_4 = main.ONOS4cli.topology_events_metrics() |
| 388 | json_str_5 = main.ONOS5cli.topology_events_metrics() |
| 389 | json_obj_4 = json.loads(json_str_4) |
| 390 | json_obj_5 = json.loads(json_str_5) |
| 391 | graph_timestamp_4 = \ |
| 392 | json_obj_4[graphTimestamp]['value'] |
| 393 | graph_timestamp_5 = \ |
| 394 | json_obj_5[graphTimestamp]['value'] |
| 395 | device_timestamp_4 = \ |
| 396 | json_obj_4[deviceTimestamp]['value'] |
| 397 | device_timestamp_5 = \ |
| 398 | json_obj_5[deviceTimestamp]['value'] |
| 399 | delta_device_4 = int(device_timestamp_4) - int(t0_tcp) |
| 400 | delta_device_5 = int(device_timestamp_5) - int(t0_tcp) |
| 401 | delta_graph_4 = int(graph_timestamp_4) - int(t0_tcp) |
| 402 | delta_graph_5 = int(graph_timestamp_5) - int(t0_tcp) |
| 403 | delta_ofp_graph_4 = int(graph_timestamp_4) - int(t0_ofp) |
| 404 | delta_ofp_graph_5 = int(graph_timestamp_5) - int(t0_ofp) |
| 405 | delta_ofp_device_4 = float(device_timestamp_4) -\ |
| 406 | float(t0_ofp) |
| 407 | delta_ofp_device_5 = float(device_timestamp_5) -\ |
| 408 | float(t0_ofp) |
| 409 | else: |
| 410 | delta_device_4 = 0 |
| 411 | delta_device_5 = 0 |
| 412 | delta_graph_4 = 0 |
| 413 | delta_graph_5 = 0 |
| 414 | delta_ofp_graph_4 = 0 |
| 415 | delta_ofp_graph_5 = 0 |
| 416 | delta_ofp_device_4 = 0 |
| 417 | delta_ofp_device_5 = 0 |
| 418 | |
| 419 | if cluster_count >= 7: |
| 420 | json_str_6 = main.ONOS6cli.topology_events_metrics() |
| 421 | json_str_7 = main.ONOS7cli.topology_events_metrics() |
| 422 | json_obj_6 = json.loads(json_str_6) |
| 423 | json_obj_7 = json.loads(json_str_7) |
| 424 | graph_timestamp_6 = \ |
| 425 | json_obj_6[graphTimestamp]['value'] |
| 426 | graph_timestamp_7 = \ |
| 427 | json_obj_7[graphTimestamp]['value'] |
| 428 | device_timestamp_6 = \ |
| 429 | json_obj_6[deviceTimestamp]['value'] |
| 430 | device_timestamp_7 = \ |
| 431 | json_obj_7[deviceTimestamp]['value'] |
| 432 | delta_device_6 = int(device_timestamp_6) - int(t0_tcp) |
| 433 | delta_device_7 = int(device_timestamp_7) - int(t0_tcp) |
| 434 | delta_graph_6 = int(graph_timestamp_6) - int(t0_tcp) |
| 435 | delta_graph_7 = int(graph_timestamp_7) - int(t0_tcp) |
| 436 | delta_ofp_graph_6 = int(graph_timestamp_6) - int(t0_ofp) |
| 437 | delta_ofp_graph_7 = int(graph_timestamp_7) - int(t0_ofp) |
| 438 | delta_ofp_device_6 = float(device_timestamp_6) -\ |
| 439 | float(t0_ofp) |
| 440 | delta_ofp_device_7 = float(device_timestamp_7) -\ |
| 441 | float(t0_ofp) |
| 442 | else: |
| 443 | delta_device_6 = 0 |
| 444 | delta_device_7 = 0 |
| 445 | delta_graph_6 = 0 |
| 446 | delta_graph_7 = 0 |
| 447 | delta_ofp_graph_6 = 0 |
| 448 | delta_ofp_graph_7 = 0 |
| 449 | delta_ofp_device_6 = 0 |
| 450 | delta_ofp_device_7 = 0 |
| 451 | |
| 452 | #Get average of delta from all instances |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 453 | avg_delta_device = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 454 | (int(delta_device_1)+\ |
| 455 | int(delta_device_2)+\ |
| 456 | int(delta_device_3)+\ |
| 457 | int(delta_device_4)+\ |
| 458 | int(delta_device_5)+\ |
| 459 | int(delta_device_6)+\ |
| 460 | int(delta_device_7)) / cluster_count |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 461 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 462 | #Ensure avg delta meets the threshold before appending |
andrewonlab | 4b5c8b9 | 2014-11-10 16:04:33 -0500 | [diff] [blame] | 463 | if avg_delta_device > 0.0 and avg_delta_device < 10000\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 464 | and int(i) > iter_ignore: |
| 465 | latency_t0_to_device_list.append(avg_delta_device) |
andrewonlab | ee4efeb | 2014-10-24 16:44:51 -0400 | [diff] [blame] | 466 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 467 | main.log.info("Results for t0-to-device ignored"+\ |
| 468 | "due to excess in threshold / warmup iteration.") |
andrewonlab | ee4efeb | 2014-10-24 16:44:51 -0400 | [diff] [blame] | 469 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 470 | #Get average of delta from all instances |
| 471 | #TODO: use max delta graph |
| 472 | #max_delta_graph = max(three) |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 473 | avg_delta_graph = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 474 | (int(delta_graph_1)+\ |
| 475 | int(delta_graph_2)+\ |
| 476 | int(delta_graph_3)+\ |
| 477 | int(delta_graph_4)+\ |
| 478 | int(delta_graph_5)+\ |
| 479 | int(delta_graph_6)+\ |
| 480 | int(delta_graph_7)) / cluster_count |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 481 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 482 | #Ensure avg delta meets the threshold before appending |
andrewonlab | 4b5c8b9 | 2014-11-10 16:04:33 -0500 | [diff] [blame] | 483 | if avg_delta_graph > 0.0 and avg_delta_graph < 10000\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 484 | and int(i) > iter_ignore: |
| 485 | latency_end_to_end_list.append(avg_delta_graph) |
andrewonlab | ee4efeb | 2014-10-24 16:44:51 -0400 | [diff] [blame] | 486 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 487 | main.log.info("Results for end-to-end ignored"+\ |
| 488 | "due to excess in threshold") |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 489 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 490 | |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 491 | avg_delta_ofp_graph = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 492 | (int(delta_ofp_graph_1)+\ |
| 493 | int(delta_ofp_graph_2)+\ |
| 494 | int(delta_ofp_graph_3)+\ |
| 495 | int(delta_ofp_graph_4)+\ |
| 496 | int(delta_ofp_graph_5)+\ |
| 497 | int(delta_ofp_graph_6)+\ |
| 498 | int(delta_ofp_graph_7)) / cluster_count |
| 499 | |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 500 | if avg_delta_ofp_graph > threshold_min \ |
andrewonlab | 4b5c8b9 | 2014-11-10 16:04:33 -0500 | [diff] [blame] | 501 | and avg_delta_ofp_graph < threshold_max\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 502 | and int(i) > iter_ignore: |
| 503 | latency_ofp_to_graph_list.append(avg_delta_ofp_graph) |
| 504 | elif avg_delta_ofp_graph > (-10) and \ |
andrewonlab | 9284434 | 2014-11-18 16:39:11 -0500 | [diff] [blame] | 505 | avg_delta_ofp_graph < 0.0 and\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 506 | int(i) > iter_ignore: |
| 507 | main.log.info("Sub-millisecond result likely; "+ |
| 508 | "negative result was rounded to 0") |
| 509 | #NOTE: Current metrics framework does not |
| 510 | #support sub-millisecond accuracy. Therefore, |
| 511 | #if the result is negative, we can reasonably |
| 512 | #conclude sub-millisecond results and just |
| 513 | #append the best rounded effort - 0 ms. |
| 514 | latency_ofp_to_graph_list.append(0) |
andrewonlab | ee4efeb | 2014-10-24 16:44:51 -0400 | [diff] [blame] | 515 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 516 | main.log.info("Results for ofp-to-graph "+\ |
| 517 | "ignored due to excess in threshold") |
andrewonlab | ee4efeb | 2014-10-24 16:44:51 -0400 | [diff] [blame] | 518 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 519 | |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 520 | avg_delta_ofp_device = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 521 | (float(delta_ofp_device_1)+\ |
| 522 | float(delta_ofp_device_2)+\ |
| 523 | float(delta_ofp_device_3)+\ |
| 524 | float(delta_ofp_device_4)+\ |
| 525 | float(delta_ofp_device_5)+\ |
| 526 | float(delta_ofp_device_6)+\ |
| 527 | float(delta_ofp_device_7)) / cluster_count |
| 528 | |
| 529 | #NOTE: ofp - delta measurements are occasionally negative |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 530 | # due to system time misalignment. |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 531 | latency_ofp_to_device_list.append(avg_delta_ofp_device) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 532 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 533 | delta_ofp_tcp = int(t0_ofp) - int(t0_tcp) |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 534 | if delta_ofp_tcp > threshold_min \ |
| 535 | and delta_ofp_tcp < threshold_max and\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 536 | int(i) > iter_ignore: |
| 537 | latency_tcp_to_ofp_list.append(delta_ofp_tcp) |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 538 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 539 | main.log.info("Results fo tcp-to-ofp "+\ |
| 540 | "ignored due to excess in threshold") |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 541 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 542 | #TODO: |
| 543 | #Fetch logs upon threshold excess |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 544 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 545 | main.log.info("ONOS1 delta end-to-end: "+ |
| 546 | str(delta_graph_1) + " ms") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 547 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 548 | main.log.info("ONOS1 delta OFP - graph: "+ |
| 549 | str(delta_ofp_graph_1) + " ms") |
| 550 | |
| 551 | main.log.info("ONOS1 delta device - t0: "+ |
| 552 | str(delta_device_1) + " ms") |
| 553 | |
| 554 | main.log.info("TCP to OFP delta: "+ |
| 555 | str(delta_ofp_tcp) + " ms") |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 556 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 557 | main.step("Remove switch from controller") |
| 558 | main.Mininet1.delete_sw_controller("s1") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 559 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 560 | time.sleep(5) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 561 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 562 | #END of for loop iteration |
andrewonlab | f47993a | 2014-10-24 17:56:01 -0400 | [diff] [blame] | 563 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 564 | #If there is at least 1 element in each list, |
| 565 | #pass the test case |
| 566 | if len(latency_end_to_end_list) > 0 and\ |
| 567 | len(latency_ofp_to_graph_list) > 0 and\ |
| 568 | len(latency_ofp_to_device_list) > 0 and\ |
| 569 | len(latency_t0_to_device_list) > 0 and\ |
| 570 | len(latency_tcp_to_ofp_list) > 0: |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 571 | assertion = main.TRUE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 572 | elif len(latency_end_to_end_list) == 0: |
| 573 | #The appending of 0 here is to prevent |
| 574 | #the min,max,sum functions from failing |
| 575 | #below |
| 576 | latency_end_to_end_list.append(0) |
andrewonlab | f47993a | 2014-10-24 17:56:01 -0400 | [diff] [blame] | 577 | assertion = main.FALSE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 578 | elif len(latency_ofp_to_graph_list) == 0: |
| 579 | latency_ofp_to_graph_list.append(0) |
andrewonlab | f47993a | 2014-10-24 17:56:01 -0400 | [diff] [blame] | 580 | assertion = main.FALSE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 581 | elif len(latency_ofp_to_device_list) == 0: |
| 582 | latency_ofp_to_device_list.append(0) |
andrewonlab | f47993a | 2014-10-24 17:56:01 -0400 | [diff] [blame] | 583 | assertion = main.FALSE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 584 | elif len(latency_t0_to_device_list) == 0: |
| 585 | latency_t0_to_device_list.append(0) |
andrewonlab | f47993a | 2014-10-24 17:56:01 -0400 | [diff] [blame] | 586 | assertion = main.FALSE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 587 | elif len(latency_tcp_to_ofp_list) == 0: |
| 588 | latency_tcp_to_ofp_list.append(0) |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 589 | assertion = main.FALSE |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 590 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 591 | #Calculate min, max, avg of latency lists |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 592 | latency_end_to_end_max = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 593 | int(max(latency_end_to_end_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 594 | latency_end_to_end_min = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 595 | int(min(latency_end_to_end_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 596 | latency_end_to_end_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 597 | (int(sum(latency_end_to_end_list)) / \ |
| 598 | len(latency_end_to_end_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 599 | latency_end_to_end_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 600 | str(round(numpy.std(latency_end_to_end_list),1)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 601 | |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 602 | latency_ofp_to_graph_max = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 603 | int(max(latency_ofp_to_graph_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 604 | latency_ofp_to_graph_min = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 605 | int(min(latency_ofp_to_graph_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 606 | latency_ofp_to_graph_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 607 | (int(sum(latency_ofp_to_graph_list)) / \ |
| 608 | len(latency_ofp_to_graph_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 609 | latency_ofp_to_graph_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 610 | str(round(numpy.std(latency_ofp_to_graph_list),1)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 611 | |
| 612 | latency_ofp_to_device_max = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 613 | int(max(latency_ofp_to_device_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 614 | latency_ofp_to_device_min = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 615 | int(min(latency_ofp_to_device_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 616 | latency_ofp_to_device_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 617 | (int(sum(latency_ofp_to_device_list)) / \ |
| 618 | len(latency_ofp_to_device_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 619 | latency_ofp_to_device_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 620 | str(round(numpy.std(latency_ofp_to_device_list),1)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 621 | |
| 622 | latency_t0_to_device_max = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 623 | int(max(latency_t0_to_device_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 624 | latency_t0_to_device_min = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 625 | int(min(latency_t0_to_device_list)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 626 | latency_t0_to_device_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 627 | (int(sum(latency_t0_to_device_list)) / \ |
| 628 | len(latency_t0_to_device_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 629 | latency_ofp_to_device_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 630 | str(round(numpy.std(latency_t0_to_device_list),1)) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 631 | |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 632 | latency_tcp_to_ofp_max = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 633 | int(max(latency_tcp_to_ofp_list)) |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 634 | latency_tcp_to_ofp_min = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 635 | int(min(latency_tcp_to_ofp_list)) |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 636 | latency_tcp_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 637 | (int(sum(latency_tcp_to_ofp_list)) / \ |
| 638 | len(latency_tcp_to_ofp_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 639 | latency_tcp_to_ofp_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 640 | str(round(numpy.std(latency_tcp_to_ofp_list),1)) |
andrewonlab | 65d7389 | 2014-11-10 17:36:00 -0500 | [diff] [blame] | 641 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 642 | main.log.report("Cluster size: "+str(cluster_count)+\ |
| 643 | " node(s)") |
| 644 | main.log.report("Switch add - End-to-end latency: "+\ |
| 645 | "Avg: "+str(latency_end_to_end_avg)+" ms "+ |
| 646 | "Std Deviation: "+latency_end_to_end_std_dev+" ms") |
| 647 | main.log.report("Switch add - OFP-to-Graph latency: "+\ |
| 648 | "Note: results are not accurate to sub-millisecond. "+ |
| 649 | "Any sub-millisecond results are rounded to 0 ms. ") |
| 650 | main.log.report("Avg: "+str(latency_ofp_to_graph_avg)+" ms "+ |
| 651 | "Std Deviation: "+latency_ofp_to_graph_std_dev+" ms") |
| 652 | main.log.report("Switch add - TCP-to-OFP latency: "+\ |
| 653 | "Avg: "+str(latency_tcp_to_ofp_avg)+" ms "+ |
| 654 | "Std Deviation: "+latency_tcp_to_ofp_std_dev+" ms") |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 655 | |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 656 | if debug_mode == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 657 | main.ONOS1.cp_logs_to_dir("/opt/onos/log/karaf.log", |
| 658 | "/tmp/", copy_file_name="sw_lat_karaf") |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 659 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 660 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 661 | onpass="Switch latency test successful", |
| 662 | onfail="Switch latency test failed") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 663 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 664 | def CASE3(self, main): |
| 665 | ''' |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 666 | Bring port up / down and measure latency. |
| 667 | Port enable / disable is simulated by ifconfig up / down |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 668 | |
| 669 | In ONOS-next, we must ensure that the port we are |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 670 | manipulating is connected to another switch with a valid |
| 671 | connection. Otherwise, graph view will not be updated. |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 672 | ''' |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 673 | import time |
| 674 | import subprocess |
| 675 | import os |
| 676 | import requests |
| 677 | import json |
andrewonlab | 4f50ec9 | 2014-11-11 14:24:45 -0500 | [diff] [blame] | 678 | import numpy |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 679 | global cluster_count |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 680 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 681 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 682 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 683 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 684 | ONOS_user = main.params['CTRL']['user'] |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 685 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 686 | default_sw_port = main.params['CTRL']['port1'] |
| 687 | |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 688 | assertion = main.TRUE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 689 | #Number of iterations of case |
| 690 | num_iter = main.params['TEST']['numIter'] |
| 691 | |
| 692 | #Timestamp 'keys' for json metrics output. |
| 693 | #These are subject to change, hence moved into params |
| 694 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 695 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
| 696 | |
| 697 | debug_mode = main.params['TEST']['debugMode'] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 698 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 699 | local_time = time.strftime('%x %X') |
| 700 | local_time = local_time.replace("/","") |
| 701 | local_time = local_time.replace(" ","_") |
| 702 | local_time = local_time.replace(":","") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 703 | if debug_mode == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 704 | main.ONOS1.tshark_pcap("eth0", |
| 705 | "/tmp/port_lat_pcap_"+local_time) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 706 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 707 | #Threshold for this test case |
| 708 | up_threshold_str = main.params['TEST']['portUpThreshold'] |
| 709 | down_threshold_str = main.params['TEST']['portDownThreshold'] |
| 710 | |
| 711 | up_threshold_obj = up_threshold_str.split(",") |
| 712 | down_threshold_obj = down_threshold_str.split(",") |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 713 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 714 | up_threshold_min = int(up_threshold_obj[0]) |
| 715 | up_threshold_max = int(up_threshold_obj[1]) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 716 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 717 | down_threshold_min = int(down_threshold_obj[0]) |
| 718 | down_threshold_max = int(down_threshold_obj[1]) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 719 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 720 | #NOTE: Some hardcoded variables you may need to configure |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 721 | # besides the params |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 722 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 723 | tshark_port_status = "OFP 130 Port Status" |
| 724 | |
| 725 | tshark_port_up = "/tmp/tshark_port_up.txt" |
| 726 | tshark_port_down = "/tmp/tshark_port_down.txt" |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 727 | interface_config = "s1-eth1" |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 728 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 729 | main.log.report("Port enable / disable latency") |
| 730 | main.log.report("Simulated by ifconfig up / down") |
| 731 | main.log.report("Total iterations of test: "+str(num_iter)) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 732 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 733 | main.step("Assign switches s1 and s2 to controller 1") |
| 734 | main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip, |
| 735 | port1=default_sw_port) |
| 736 | main.Mininet1.assign_sw_controller(sw="2",ip1=ONOS1_ip, |
| 737 | port1=default_sw_port) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 738 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 739 | #Give enough time for metrics to propagate the |
| 740 | #assign controller event. Otherwise, these events may |
| 741 | #carry over to our measurements |
| 742 | time.sleep(15) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 743 | |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 744 | port_up_device_to_ofp_list = [] |
| 745 | port_up_graph_to_ofp_list = [] |
| 746 | port_down_device_to_ofp_list = [] |
| 747 | port_down_graph_to_ofp_list = [] |
| 748 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 749 | for i in range(0, int(num_iter)): |
| 750 | main.step("Starting wireshark capture for port status down") |
| 751 | main.ONOS1.tshark_grep(tshark_port_status, |
| 752 | tshark_port_down) |
| 753 | |
| 754 | time.sleep(5) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 755 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 756 | #Disable interface that is connected to switch 2 |
| 757 | main.step("Disable port: "+interface_config) |
| 758 | main.Mininet1.handle.sendline("sh ifconfig "+ |
| 759 | interface_config+" down") |
| 760 | main.Mininet1.handle.expect("mininet>") |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 761 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 762 | time.sleep(3) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 763 | main.ONOS1.tshark_stop() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 764 | |
| 765 | #Copy tshark output file from ONOS to TestON instance |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 766 | #/tmp directory |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 767 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 768 | tshark_port_down+" /tmp/") |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 769 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 770 | f_port_down = open(tshark_port_down, 'r') |
| 771 | #Get first line of port down event from tshark |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 772 | f_line = f_port_down.readline() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 773 | obj_down = f_line.split(" ") |
| 774 | if len(f_line) > 0: |
| 775 | #NOTE: obj_down[1] is a very unreliable |
| 776 | # way to determine the timestamp. If |
| 777 | # results seem way off, check the object |
| 778 | # itself by printing it out |
| 779 | timestamp_begin_pt_down = int(float(obj_down[1])*1000) |
| 780 | # For some reason, wireshark decides to record the |
| 781 | # timestamp at the 3rd object position instead of |
| 782 | # 2nd at unpredictable times. This statement is |
| 783 | # used to capture that odd behavior and use the |
| 784 | # correct epoch time |
| 785 | if timestamp_begin_pt_down < 1400000000000: |
| 786 | timestamp_begin_pt_down = \ |
| 787 | int(float(obj_down[2])*1000) |
| 788 | |
| 789 | main.log.info("Port down begin timestamp: "+ |
| 790 | str(timestamp_begin_pt_down)) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 791 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 792 | main.log.info("Tshark output file returned unexpected"+ |
| 793 | " results: "+str(obj_down)) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 794 | timestamp_begin_pt_down = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 795 | f_port_down.close() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 796 | |
| 797 | main.step("Obtain t1 by metrics call") |
| 798 | json_str_up_1 = main.ONOS1cli.topology_events_metrics() |
| 799 | json_obj_1 = json.loads(json_str_up_1) |
| 800 | #Obtain graph timestamp. This timestsamp captures |
| 801 | #the epoch time at which the topology graph was updated. |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 802 | graph_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 803 | json_obj_1[graphTimestamp]['value'] |
| 804 | #Obtain device timestamp. This timestamp captures |
| 805 | #the epoch time at which the device event happened |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 806 | device_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 807 | json_obj_1[deviceTimestamp]['value'] |
| 808 | #Get delta between graph event and OFP |
| 809 | pt_down_graph_to_ofp_1 = int(graph_timestamp_1) -\ |
| 810 | int(timestamp_begin_pt_down) |
| 811 | #Get delta between device event and OFP |
| 812 | pt_down_device_to_ofp_1 = int(device_timestamp_1) -\ |
| 813 | int(timestamp_begin_pt_down) |
| 814 | |
| 815 | if cluster_count >= 3: |
| 816 | json_str_up_2 = main.ONOS2cli.topology_events_metrics() |
| 817 | json_str_up_3 = main.ONOS3cli.topology_events_metrics() |
| 818 | json_obj_2 = json.loads(json_str_up_2) |
| 819 | json_obj_3 = json.loads(json_str_up_3) |
| 820 | graph_timestamp_2 = \ |
| 821 | json_obj_2[graphTimestamp]['value'] |
| 822 | graph_timestamp_3 = \ |
| 823 | json_obj_3[graphTimestamp]['value'] |
| 824 | device_timestamp_2 = \ |
| 825 | json_obj_2[deviceTimestamp]['value'] |
| 826 | device_timestamp_3 = \ |
| 827 | json_obj_3[deviceTimestamp]['value'] |
| 828 | pt_down_graph_to_ofp_2 = int(graph_timestamp_2) -\ |
| 829 | int(timestamp_begin_pt_down) |
| 830 | pt_down_graph_to_ofp_3 = int(graph_timestamp_3) -\ |
| 831 | int(timestamp_begin_pt_down) |
| 832 | pt_down_device_to_ofp_2 = int(device_timestamp_2) -\ |
| 833 | int(timestamp_begin_pt_down) |
| 834 | pt_down_device_to_ofp_3 = int(device_timestamp_3) -\ |
| 835 | int(timestamp_begin_pt_down) |
| 836 | else: |
| 837 | pt_down_graph_to_ofp_2 = 0 |
| 838 | pt_down_graph_to_ofp_3 = 0 |
| 839 | pt_down_device_to_ofp_2 = 0 |
| 840 | pt_down_device_to_ofp_3 = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 841 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 842 | if cluster_count >= 5: |
| 843 | json_str_up_4 = main.ONOS4cli.topology_events_metrics() |
| 844 | json_str_up_5 = main.ONOS5cli.topology_events_metrics() |
| 845 | json_obj_4 = json.loads(json_str_up_4) |
| 846 | json_obj_5 = json.loads(json_str_up_5) |
| 847 | graph_timestamp_4 = \ |
| 848 | json_obj_4[graphTimestamp]['value'] |
| 849 | graph_timestamp_5 = \ |
| 850 | json_obj_5[graphTimestamp]['value'] |
| 851 | device_timestamp_4 = \ |
| 852 | json_obj_4[deviceTimestamp]['value'] |
| 853 | device_timestamp_5 = \ |
| 854 | json_obj_5[deviceTimestamp]['value'] |
| 855 | pt_down_graph_to_ofp_4 = int(graph_timestamp_4) -\ |
| 856 | int(timestamp_begin_pt_down) |
| 857 | pt_down_graph_to_ofp_5 = int(graph_timestamp_5) -\ |
| 858 | int(timestamp_begin_pt_down) |
| 859 | pt_down_device_to_ofp_4 = int(device_timestamp_4) -\ |
| 860 | int(timestamp_begin_pt_down) |
| 861 | pt_down_device_to_ofp_5 = int(device_timestamp_5) -\ |
| 862 | int(timestamp_begin_pt_down) |
| 863 | else: |
| 864 | pt_down_graph_to_ofp_4 = 0 |
| 865 | pt_down_graph_to_ofp_5 = 0 |
| 866 | pt_down_device_to_ofp_4 = 0 |
| 867 | pt_down_device_to_ofp_5 = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 868 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 869 | if cluster_count >= 7: |
| 870 | json_str_up_6 = main.ONOS6cli.topology_events_metrics() |
| 871 | json_str_up_7 = main.ONOS7cli.topology_events_metrics() |
| 872 | json_obj_6 = json.loads(json_str_up_6) |
| 873 | json_obj_7 = json.loads(json_str_up_7) |
| 874 | graph_timestamp_6 = \ |
| 875 | json_obj_6[graphTimestamp]['value'] |
| 876 | graph_timestamp_7 = \ |
| 877 | json_obj_7[graphTimestamp]['value'] |
| 878 | device_timestamp_6 = \ |
| 879 | json_obj_6[deviceTimestamp]['value'] |
| 880 | device_timestamp_7 = \ |
| 881 | json_obj_7[deviceTimestamp]['value'] |
| 882 | pt_down_graph_to_ofp_6 = int(graph_timestamp_6) -\ |
| 883 | int(timestamp_begin_pt_down) |
| 884 | pt_down_graph_to_ofp_7 = int(graph_timestamp_7) -\ |
| 885 | int(timestamp_begin_pt_down) |
| 886 | pt_down_device_to_ofp_6 = int(device_timestamp_6) -\ |
| 887 | int(timestamp_begin_pt_down) |
| 888 | pt_down_device_to_ofp_7 = int(device_timestamp_7) -\ |
| 889 | int(timestamp_begin_pt_down) |
| 890 | else: |
| 891 | pt_down_graph_to_ofp_6 = 0 |
| 892 | pt_down_graph_to_ofp_7 = 0 |
| 893 | pt_down_device_to_ofp_6 = 0 |
| 894 | pt_down_device_to_ofp_7 = 0 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 895 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 896 | time.sleep(3) |
| 897 | |
| 898 | #Caluclate average across clusters |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 899 | pt_down_graph_to_ofp_avg =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 900 | (int(pt_down_graph_to_ofp_1) + |
| 901 | int(pt_down_graph_to_ofp_2) + |
| 902 | int(pt_down_graph_to_ofp_3) + |
| 903 | int(pt_down_graph_to_ofp_4) + |
| 904 | int(pt_down_graph_to_ofp_5) + |
| 905 | int(pt_down_graph_to_ofp_6) + |
| 906 | int(pt_down_graph_to_ofp_7)) / cluster_count |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 907 | pt_down_device_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 908 | (int(pt_down_device_to_ofp_1) + |
| 909 | int(pt_down_device_to_ofp_2) + |
| 910 | int(pt_down_device_to_ofp_3) + |
| 911 | int(pt_down_device_to_ofp_4) + |
| 912 | int(pt_down_device_to_ofp_5) + |
| 913 | int(pt_down_device_to_ofp_6) + |
| 914 | int(pt_down_device_to_ofp_7)) / cluster_count |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 915 | |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 916 | if pt_down_graph_to_ofp_avg > down_threshold_min and \ |
| 917 | pt_down_graph_to_ofp_avg < down_threshold_max: |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 918 | port_down_graph_to_ofp_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 919 | pt_down_graph_to_ofp_avg) |
| 920 | main.log.info("Port down: graph to ofp avg: "+ |
| 921 | str(pt_down_graph_to_ofp_avg) + " ms") |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 922 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 923 | main.log.info("Average port down graph-to-ofp result" + |
| 924 | " exceeded the threshold: "+ |
| 925 | str(pt_down_graph_to_ofp_avg)) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 926 | |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 927 | if pt_down_device_to_ofp_avg > 0 and \ |
| 928 | pt_down_device_to_ofp_avg < 1000: |
| 929 | port_down_device_to_ofp_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 930 | pt_down_device_to_ofp_avg) |
| 931 | main.log.info("Port down: device to ofp avg: "+ |
| 932 | str(pt_down_device_to_ofp_avg) + " ms") |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 933 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 934 | main.log.info("Average port down device-to-ofp result" + |
| 935 | " exceeded the threshold: "+ |
| 936 | str(pt_down_device_to_ofp_avg)) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 937 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 938 | #Port up events |
| 939 | main.step("Enable port and obtain timestamp") |
| 940 | main.step("Starting wireshark capture for port status up") |
| 941 | main.ONOS1.tshark_grep(tshark_port_status, tshark_port_up) |
| 942 | time.sleep(5) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 943 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 944 | main.Mininet1.handle.sendline("sh ifconfig "+ |
| 945 | interface_config+" up") |
| 946 | main.Mininet1.handle.expect("mininet>") |
| 947 | |
| 948 | #Allow time for tshark to capture event |
| 949 | time.sleep(5) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 950 | main.ONOS1.tshark_stop() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 951 | |
| 952 | time.sleep(3) |
| 953 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 954 | tshark_port_up+" /tmp/") |
| 955 | f_port_up = open(tshark_port_up, 'r') |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 956 | f_line = f_port_up.readline() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 957 | obj_up = f_line.split(" ") |
| 958 | if len(f_line) > 0: |
| 959 | timestamp_begin_pt_up = int(float(obj_up[1])*1000) |
| 960 | if timestamp_begin_pt_up < 1400000000000: |
| 961 | timestamp_begin_pt_up = \ |
| 962 | int(float(obj_up[2])*1000) |
| 963 | main.log.info("Port up begin timestamp: "+ |
| 964 | str(timestamp_begin_pt_up)) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 965 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 966 | main.log.info("Tshark output file returned unexpected"+ |
| 967 | " results.") |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 968 | timestamp_begin_pt_up = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 969 | f_port_up.close() |
| 970 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 971 | #Obtain metrics shortly afterwards |
| 972 | #This timestsamp captures |
| 973 | #the epoch time at which the topology graph was updated. |
| 974 | main.step("Obtain t1 by REST call") |
| 975 | json_str_up_1 = main.ONOS1cli.topology_events_metrics() |
| 976 | json_obj_1 = json.loads(json_str_up_1) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 977 | graph_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 978 | json_obj_1[graphTimestamp]['value'] |
| 979 | #Obtain device timestamp. This timestamp captures |
| 980 | #the epoch time at which the device event happened |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 981 | device_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 982 | json_obj_1[deviceTimestamp]['value'] |
| 983 | #Get delta between graph event and OFP |
| 984 | pt_up_graph_to_ofp_1 = int(graph_timestamp_1) -\ |
| 985 | int(timestamp_begin_pt_up) |
| 986 | #Get delta between device event and OFP |
| 987 | pt_up_device_to_ofp_1 = int(device_timestamp_1) -\ |
| 988 | int(timestamp_begin_pt_up) |
| 989 | |
| 990 | if cluster_count >= 3: |
| 991 | json_str_up_2 = main.ONOS2cli.topology_events_metrics() |
| 992 | json_str_up_3 = main.ONOS3cli.topology_events_metrics() |
| 993 | json_obj_2 = json.loads(json_str_up_2) |
| 994 | json_obj_3 = json.loads(json_str_up_3) |
| 995 | graph_timestamp_2 = \ |
| 996 | json_obj_2[graphTimestamp]['value'] |
| 997 | graph_timestamp_3 = \ |
| 998 | json_obj_3[graphTimestamp]['value'] |
| 999 | device_timestamp_2 = \ |
| 1000 | json_obj_2[deviceTimestamp]['value'] |
| 1001 | device_timestamp_3 = \ |
| 1002 | json_obj_3[deviceTimestamp]['value'] |
| 1003 | pt_up_graph_to_ofp_2 = int(graph_timestamp_2) -\ |
| 1004 | int(timestamp_begin_pt_up) |
| 1005 | pt_up_graph_to_ofp_3 = int(graph_timestamp_3) -\ |
| 1006 | int(timestamp_begin_pt_up) |
| 1007 | pt_up_device_to_ofp_2 = int(device_timestamp_2) -\ |
| 1008 | int(timestamp_begin_pt_up) |
| 1009 | pt_up_device_to_ofp_3 = int(device_timestamp_3) -\ |
| 1010 | int(timestamp_begin_pt_up) |
| 1011 | else: |
| 1012 | pt_up_graph_to_ofp_2 = 0 |
| 1013 | pt_up_graph_to_ofp_3 = 0 |
| 1014 | pt_up_device_to_ofp_2 = 0 |
| 1015 | pt_up_device_to_ofp_3 = 0 |
| 1016 | |
| 1017 | if cluster_count >= 5: |
| 1018 | json_str_up_4 = main.ONOS4cli.topology_events_metrics() |
| 1019 | json_str_up_5 = main.ONOS5cli.topology_events_metrics() |
| 1020 | json_obj_4 = json.loads(json_str_up_4) |
| 1021 | json_obj_5 = json.loads(json_str_up_5) |
| 1022 | graph_timestamp_4 = \ |
| 1023 | json_obj_4[graphTimestamp]['value'] |
| 1024 | graph_timestamp_5 = \ |
| 1025 | json_obj_5[graphTimestamp]['value'] |
| 1026 | device_timestamp_4 = \ |
| 1027 | json_obj_4[deviceTimestamp]['value'] |
| 1028 | device_timestamp_5 = \ |
| 1029 | json_obj_5[deviceTimestamp]['value'] |
| 1030 | pt_up_graph_to_ofp_4 = int(graph_timestamp_4) -\ |
| 1031 | int(timestamp_begin_pt_up) |
| 1032 | pt_up_graph_to_ofp_5 = int(graph_timestamp_5) -\ |
| 1033 | int(timestamp_begin_pt_up) |
| 1034 | pt_up_device_to_ofp_4 = int(device_timestamp_4) -\ |
| 1035 | int(timestamp_begin_pt_up) |
| 1036 | pt_up_device_to_ofp_5 = int(device_timestamp_5) -\ |
| 1037 | int(timestamp_begin_pt_up) |
| 1038 | else: |
| 1039 | pt_up_graph_to_ofp_4 = 0 |
| 1040 | pt_up_graph_to_ofp_5 = 0 |
| 1041 | pt_up_device_to_ofp_4 = 0 |
| 1042 | pt_up_device_to_ofp_5 = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 1043 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1044 | if cluster_count >= 7: |
| 1045 | json_str_up_6 = main.ONOS6cli.topology_events_metrics() |
| 1046 | json_str_up_7 = main.ONOS7cli.topology_events_metrics() |
| 1047 | json_obj_6 = json.loads(json_str_up_6) |
| 1048 | json_obj_7 = json.loads(json_str_up_7) |
| 1049 | graph_timestamp_6 = \ |
| 1050 | json_obj_6[graphTimestamp]['value'] |
| 1051 | graph_timestamp_7 = \ |
| 1052 | json_obj_7[graphTimestamp]['value'] |
| 1053 | device_timestamp_6 = \ |
| 1054 | json_obj_6[deviceTimestamp]['value'] |
| 1055 | device_timestamp_7 = \ |
| 1056 | json_obj_7[deviceTimestamp]['value'] |
| 1057 | pt_up_graph_to_ofp_6 = int(graph_timestamp_6) -\ |
| 1058 | int(timestamp_begin_pt_up) |
| 1059 | pt_up_graph_to_ofp_7 = int(graph_timestamp_7) -\ |
| 1060 | int(timestamp_begin_pt_up) |
| 1061 | pt_up_device_to_ofp_6 = int(device_timestamp_6) -\ |
| 1062 | int(timestamp_begin_pt_up) |
| 1063 | pt_up_device_to_ofp_7 = int(device_timestamp_7) -\ |
| 1064 | int(timestamp_begin_pt_up) |
| 1065 | else: |
| 1066 | pt_up_graph_to_ofp_6 = 0 |
| 1067 | pt_up_graph_to_ofp_7 = 0 |
| 1068 | pt_up_device_to_ofp_6 = 0 |
| 1069 | pt_up_device_to_ofp_7 = 0 |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 1070 | |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1071 | pt_up_graph_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1072 | (int(pt_up_graph_to_ofp_1) + |
| 1073 | int(pt_up_graph_to_ofp_2) + |
| 1074 | int(pt_up_graph_to_ofp_3) + |
| 1075 | int(pt_up_graph_to_ofp_4) + |
| 1076 | int(pt_up_graph_to_ofp_5) + |
| 1077 | int(pt_up_graph_to_ofp_6) + |
| 1078 | int(pt_up_graph_to_ofp_7)) / cluster_count |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1079 | |
| 1080 | pt_up_device_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1081 | (int(pt_up_device_to_ofp_1) + |
| 1082 | int(pt_up_device_to_ofp_2) + |
| 1083 | int(pt_up_device_to_ofp_3) + |
| 1084 | int(pt_up_device_to_ofp_4) + |
| 1085 | int(pt_up_device_to_ofp_5) + |
| 1086 | int(pt_up_device_to_ofp_6) + |
| 1087 | int(pt_up_device_to_ofp_7)) / cluster_count |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1088 | |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1089 | if pt_up_graph_to_ofp_avg > up_threshold_min and \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1090 | pt_up_graph_to_ofp_avg < up_threshold_max: |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1091 | port_up_graph_to_ofp_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1092 | pt_up_graph_to_ofp_avg) |
| 1093 | main.log.info("Port down: graph to ofp avg: "+ |
| 1094 | str(pt_up_graph_to_ofp_avg) + " ms") |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1095 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1096 | main.log.info("Average port up graph-to-ofp result"+ |
| 1097 | " exceeded the threshold: "+ |
| 1098 | str(pt_up_graph_to_ofp_avg)) |
| 1099 | |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1100 | if pt_up_device_to_ofp_avg > up_threshold_min and \ |
| 1101 | pt_up_device_to_ofp_avg < up_threshold_max: |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1102 | port_up_device_to_ofp_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1103 | pt_up_device_to_ofp_avg) |
| 1104 | main.log.info("Port up: device to ofp avg: "+ |
| 1105 | str(pt_up_device_to_ofp_avg) + " ms") |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1106 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1107 | main.log.info("Average port up device-to-ofp result"+ |
| 1108 | " exceeded the threshold: "+ |
| 1109 | str(pt_up_device_to_ofp_avg)) |
| 1110 | |
| 1111 | #END ITERATION FOR LOOP |
| 1112 | |
| 1113 | #Check all list for latency existence and set assertion |
| 1114 | if (port_down_graph_to_ofp_list and port_down_device_to_ofp_list\ |
| 1115 | and port_up_graph_to_ofp_list and port_up_device_to_ofp_list): |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1116 | assertion = main.TRUE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1117 | |
| 1118 | main.log.report("Cluster size: "+str(cluster_count)+\ |
| 1119 | " node(s)") |
| 1120 | #Calculate and report latency measurements |
| 1121 | port_down_graph_to_ofp_min = min(port_down_graph_to_ofp_list) |
| 1122 | port_down_graph_to_ofp_max = max(port_down_graph_to_ofp_list) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1123 | port_down_graph_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1124 | (sum(port_down_graph_to_ofp_list) / |
| 1125 | len(port_down_graph_to_ofp_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 1126 | port_down_graph_to_ofp_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1127 | str(round(numpy.std(port_down_graph_to_ofp_list),1)) |
| 1128 | |
| 1129 | main.log.report("Port down graph-to-ofp "+ |
| 1130 | "Avg: "+str(port_down_graph_to_ofp_avg)+" ms "+ |
| 1131 | "Std Deviation: "+port_down_graph_to_ofp_std_dev+" ms") |
| 1132 | |
| 1133 | port_down_device_to_ofp_min = min(port_down_device_to_ofp_list) |
| 1134 | port_down_device_to_ofp_max = max(port_down_device_to_ofp_list) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1135 | port_down_device_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1136 | (sum(port_down_device_to_ofp_list) /\ |
| 1137 | len(port_down_device_to_ofp_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 1138 | port_down_device_to_ofp_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1139 | str(round(numpy.std(port_down_device_to_ofp_list),1)) |
| 1140 | |
| 1141 | main.log.report("Port down device-to-ofp "+ |
| 1142 | "Avg: "+str(port_down_device_to_ofp_avg)+" ms "+ |
| 1143 | "Std Deviation: "+port_down_device_to_ofp_std_dev+" ms") |
| 1144 | |
| 1145 | port_up_graph_to_ofp_min = min(port_up_graph_to_ofp_list) |
| 1146 | port_up_graph_to_ofp_max = max(port_up_graph_to_ofp_list) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1147 | port_up_graph_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1148 | (sum(port_up_graph_to_ofp_list) /\ |
| 1149 | len(port_up_graph_to_ofp_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 1150 | port_up_graph_to_ofp_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1151 | str(round(numpy.std(port_up_graph_to_ofp_list),1)) |
| 1152 | |
| 1153 | main.log.report("Port up graph-to-ofp "+ |
| 1154 | "Avg: "+str(port_up_graph_to_ofp_avg)+" ms "+ |
| 1155 | "Std Deviation: "+port_up_graph_to_ofp_std_dev+" ms") |
| 1156 | |
| 1157 | port_up_device_to_ofp_min = min(port_up_device_to_ofp_list) |
| 1158 | port_up_device_to_ofp_max = max(port_up_device_to_ofp_list) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1159 | port_up_device_to_ofp_avg = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1160 | (sum(port_up_device_to_ofp_list) /\ |
| 1161 | len(port_up_device_to_ofp_list)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 1162 | port_up_device_to_ofp_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1163 | str(round(numpy.std(port_up_device_to_ofp_list),1)) |
| 1164 | |
| 1165 | main.log.report("Port up device-to-ofp "+ |
| 1166 | "Avg: "+str(port_up_device_to_ofp_avg)+" ms "+ |
| 1167 | "Std Deviation: "+port_up_device_to_ofp_std_dev+" ms") |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1168 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1169 | #Remove switches from controller for next test |
| 1170 | main.Mininet1.delete_sw_controller("s1") |
| 1171 | main.Mininet1.delete_sw_controller("s2") |
| 1172 | |
| 1173 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 1174 | onpass="Port discovery latency calculation successful", |
| 1175 | onfail="Port discovery test failed") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1176 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1177 | def CASE4(self, main): |
| 1178 | ''' |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1179 | Link down event using loss rate 100% |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1180 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1181 | Important: |
| 1182 | Use a simple 2 switch topology with 1 link between |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1183 | the two switches. Ensure that mac addresses of the |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1184 | switches are 1 / 2 respectively |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1185 | ''' |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1186 | import time |
| 1187 | import subprocess |
| 1188 | import os |
| 1189 | import requests |
| 1190 | import json |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1191 | import numpy |
| 1192 | |
| 1193 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 1194 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 1195 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 1196 | ONOS_user = main.params['CTRL']['user'] |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1197 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1198 | default_sw_port = main.params['CTRL']['port1'] |
| 1199 | |
| 1200 | #Number of iterations of case |
| 1201 | num_iter = main.params['TEST']['numIter'] |
| 1202 | |
| 1203 | #Timestamp 'keys' for json metrics output. |
| 1204 | #These are subject to change, hence moved into params |
| 1205 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 1206 | linkTimestamp = main.params['JSON']['linkTimestamp'] |
| 1207 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
| 1208 | |
| 1209 | debug_mode = main.params['TEST']['debugMode'] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1210 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1211 | local_time = time.strftime('%x %X') |
| 1212 | local_time = local_time.replace("/","") |
| 1213 | local_time = local_time.replace(" ","_") |
| 1214 | local_time = local_time.replace(":","") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1215 | if debug_mode == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1216 | main.ONOS1.tshark_pcap("eth0", |
| 1217 | "/tmp/link_lat_pcap_"+local_time) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1218 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1219 | #Threshold for this test case |
| 1220 | up_threshold_str = main.params['TEST']['linkUpThreshold'] |
| 1221 | down_threshold_str = main.params['TEST']['linkDownThreshold'] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1222 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1223 | up_threshold_obj = up_threshold_str.split(",") |
| 1224 | down_threshold_obj = down_threshold_str.split(",") |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1225 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1226 | up_threshold_min = int(up_threshold_obj[0]) |
| 1227 | up_threshold_max = int(up_threshold_obj[1]) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1228 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1229 | down_threshold_min = int(down_threshold_obj[0]) |
| 1230 | down_threshold_max = int(down_threshold_obj[1]) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1231 | |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1232 | assertion = main.TRUE |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1233 | #Link event timestamp to system time list |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1234 | link_down_link_to_system_list = [] |
| 1235 | link_up_link_to_system_list = [] |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1236 | #Graph event timestamp to system time list |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1237 | link_down_graph_to_system_list = [] |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1238 | link_up_graph_to_system_list = [] |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1239 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1240 | main.log.report("Link up / down discovery latency between "+ |
| 1241 | "two switches") |
| 1242 | main.log.report("Simulated by setting loss-rate 100%") |
| 1243 | main.log.report("'tc qdisc add dev <intfs> root netem loss 100%'") |
| 1244 | main.log.report("Total iterations of test: "+str(num_iter)) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1245 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1246 | main.step("Assign all switches") |
| 1247 | main.Mininet1.assign_sw_controller(sw="1", |
| 1248 | ip1=ONOS1_ip, port1=default_sw_port) |
| 1249 | main.Mininet1.assign_sw_controller(sw="2", |
| 1250 | ip1=ONOS1_ip, port1=default_sw_port) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1251 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1252 | main.step("Verifying switch assignment") |
| 1253 | result_s1 = main.Mininet1.get_sw_controller(sw="s1") |
| 1254 | result_s2 = main.Mininet1.get_sw_controller(sw="s2") |
| 1255 | |
| 1256 | #Allow time for events to finish before taking measurements |
| 1257 | time.sleep(10) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1258 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1259 | link_down1 = False |
| 1260 | link_down2 = False |
| 1261 | link_down3 = False |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1262 | #Start iteration of link event test |
| 1263 | for i in range(0, int(num_iter)): |
| 1264 | main.step("Getting initial system time as t0") |
| 1265 | |
| 1266 | #System time in epoch ms |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1267 | timestamp_link_down_t0 = time.time() * 1000 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1268 | #Link down is simulated by 100% loss rate using traffic |
| 1269 | #control command |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1270 | main.Mininet1.handle.sendline( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1271 | "sh tc qdisc add dev s1-eth1 root netem loss 100%") |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1272 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1273 | #TODO: Iterate through 'links' command to verify that |
| 1274 | # link s1 -> s2 went down (loop timeout 30 seconds) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1275 | # on all 3 ONOS instances |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1276 | main.log.info("Checking ONOS for link update") |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1277 | loop_count = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1278 | while( not (link_down1 and link_down2 and link_down3)\ |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1279 | and loop_count < 30 ): |
| 1280 | json_str1 = main.ONOS1cli.links() |
| 1281 | json_str2 = main.ONOS2cli.links() |
| 1282 | json_str3 = main.ONOS3cli.links() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1283 | |
| 1284 | if not (json_str1 and json_str2 and json_str3): |
| 1285 | main.log.error("CLI command returned error ") |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1286 | break |
| 1287 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1288 | json_obj1 = json.loads(json_str1) |
| 1289 | json_obj2 = json.loads(json_str2) |
| 1290 | json_obj3 = json.loads(json_str3) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1291 | for obj1 in json_obj1: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1292 | if '01' not in obj1['src']['device']: |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1293 | link_down1 = True |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1294 | main.log.info("Link down from "+ |
| 1295 | "s1 -> s2 on ONOS1 detected") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1296 | for obj2 in json_obj2: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1297 | if '01' not in obj2['src']['device']: |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1298 | link_down2 = True |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1299 | main.log.info("Link down from "+ |
| 1300 | "s1 -> s2 on ONOS2 detected") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1301 | for obj3 in json_obj3: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1302 | if '01' not in obj3['src']['device']: |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1303 | link_down3 = True |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1304 | main.log.info("Link down from "+ |
| 1305 | "s1 -> s2 on ONOS3 detected") |
| 1306 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1307 | loop_count += 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1308 | #If CLI doesn't like the continuous requests |
| 1309 | #and exits in this loop, increase the sleep here. |
| 1310 | #Consequently, while loop timeout will increase |
| 1311 | time.sleep(1) |
| 1312 | |
| 1313 | #Give time for metrics measurement to catch up |
| 1314 | #NOTE: May need to be configured more accurately |
| 1315 | time.sleep(10) |
| 1316 | #If we exited the while loop and link down 1,2,3 are still |
| 1317 | #false, then ONOS has failed to discover link down event |
| 1318 | if not (link_down1 and link_down2 and link_down3): |
| 1319 | main.log.info("Link down discovery failed") |
| 1320 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1321 | link_down_lat_graph1 = 0 |
| 1322 | link_down_lat_graph2 = 0 |
| 1323 | link_down_lat_graph3 = 0 |
| 1324 | link_down_lat_device1 = 0 |
| 1325 | link_down_lat_device2 = 0 |
| 1326 | link_down_lat_device3 = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1327 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1328 | assertion = main.FALSE |
| 1329 | else: |
| 1330 | json_topo_metrics_1 =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1331 | main.ONOS1cli.topology_events_metrics() |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1332 | json_topo_metrics_2 =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1333 | main.ONOS2cli.topology_events_metrics() |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1334 | json_topo_metrics_3 =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1335 | main.ONOS3cli.topology_events_metrics() |
| 1336 | json_topo_metrics_1 = json.loads(json_topo_metrics_1) |
| 1337 | json_topo_metrics_2 = json.loads(json_topo_metrics_2) |
| 1338 | json_topo_metrics_3 = json.loads(json_topo_metrics_3) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1339 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1340 | main.log.info("Obtaining graph and device timestamp") |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1341 | graph_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1342 | json_topo_metrics_1[graphTimestamp]['value'] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1343 | graph_timestamp_2 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1344 | json_topo_metrics_2[graphTimestamp]['value'] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1345 | graph_timestamp_3 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1346 | json_topo_metrics_3[graphTimestamp]['value'] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1347 | |
| 1348 | link_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1349 | json_topo_metrics_1[linkTimestamp]['value'] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1350 | link_timestamp_2 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1351 | json_topo_metrics_2[linkTimestamp]['value'] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1352 | link_timestamp_3 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1353 | json_topo_metrics_3[linkTimestamp]['value'] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1354 | |
| 1355 | if graph_timestamp_1 and graph_timestamp_2 and\ |
| 1356 | graph_timestamp_3 and link_timestamp_1 and\ |
| 1357 | link_timestamp_2 and link_timestamp_3: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1358 | link_down_lat_graph1 = int(graph_timestamp_1) -\ |
| 1359 | int(timestamp_link_down_t0) |
| 1360 | link_down_lat_graph2 = int(graph_timestamp_2) -\ |
| 1361 | int(timestamp_link_down_t0) |
| 1362 | link_down_lat_graph3 = int(graph_timestamp_3) -\ |
| 1363 | int(timestamp_link_down_t0) |
| 1364 | |
| 1365 | link_down_lat_link1 = int(link_timestamp_1) -\ |
| 1366 | int(timestamp_link_down_t0) |
| 1367 | link_down_lat_link2 = int(link_timestamp_2) -\ |
| 1368 | int(timestamp_link_down_t0) |
| 1369 | link_down_lat_link3 = int(link_timestamp_3) -\ |
| 1370 | int(timestamp_link_down_t0) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1371 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1372 | main.log.error("There was an error calculating"+ |
| 1373 | " the delta for link down event") |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1374 | link_down_lat_graph1 = 0 |
| 1375 | link_down_lat_graph2 = 0 |
| 1376 | link_down_lat_graph3 = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1377 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1378 | link_down_lat_device1 = 0 |
| 1379 | link_down_lat_device2 = 0 |
| 1380 | link_down_lat_device3 = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1381 | |
| 1382 | main.log.info("Link down latency ONOS1 iteration "+ |
| 1383 | str(i)+" (end-to-end): "+ |
| 1384 | str(link_down_lat_graph1)+" ms") |
| 1385 | main.log.info("Link down latency ONOS2 iteration "+ |
| 1386 | str(i)+" (end-to-end): "+ |
| 1387 | str(link_down_lat_graph2)+" ms") |
| 1388 | main.log.info("Link down latency ONOS3 iteration "+ |
| 1389 | str(i)+" (end-to-end): "+ |
| 1390 | str(link_down_lat_graph3)+" ms") |
| 1391 | |
| 1392 | main.log.info("Link down latency ONOS1 iteration "+ |
| 1393 | str(i)+" (link-event-to-system-timestamp): "+ |
| 1394 | str(link_down_lat_link1)+" ms") |
| 1395 | main.log.info("Link down latency ONOS2 iteration "+ |
| 1396 | str(i)+" (link-event-to-system-timestamp): "+ |
| 1397 | str(link_down_lat_link2)+" ms") |
| 1398 | main.log.info("Link down latency ONOS3 iteration "+ |
| 1399 | str(i)+" (link-event-to-system-timestamp): "+ |
| 1400 | str(link_down_lat_link3)) |
| 1401 | |
| 1402 | #Calculate avg of node calculations |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1403 | link_down_lat_graph_avg =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1404 | (link_down_lat_graph1 + |
| 1405 | link_down_lat_graph2 + |
| 1406 | link_down_lat_graph3) / 3 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1407 | link_down_lat_link_avg =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1408 | (link_down_lat_link1 + |
| 1409 | link_down_lat_link2 + |
| 1410 | link_down_lat_link3) / 3 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1411 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1412 | #Set threshold and append latency to list |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1413 | if link_down_lat_graph_avg > down_threshold_min and\ |
| 1414 | link_down_lat_graph_avg < down_threshold_max: |
andrewonlab | 4e12448 | 2014-11-04 13:37:25 -0500 | [diff] [blame] | 1415 | link_down_graph_to_system_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1416 | link_down_lat_graph_avg) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1417 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1418 | main.log.info("Link down latency exceeded threshold") |
| 1419 | main.log.info("Results for iteration "+str(i)+ |
| 1420 | "have been omitted") |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1421 | if link_down_lat_link_avg > down_threshold_min and\ |
| 1422 | link_down_lat_link_avg < down_threshold_max: |
andrewonlab | 4e12448 | 2014-11-04 13:37:25 -0500 | [diff] [blame] | 1423 | link_down_link_to_system_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1424 | link_down_lat_link_avg) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1425 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1426 | main.log.info("Link down latency exceeded threshold") |
| 1427 | main.log.info("Results for iteration "+str(i)+ |
| 1428 | "have been omitted") |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1429 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1430 | #NOTE: To remove loss rate and measure latency: |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1431 | # 'sh tc qdisc del dev s1-eth1 root' |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1432 | timestamp_link_up_t0 = time.time() * 1000 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1433 | main.Mininet1.handle.sendline("sh tc qdisc del dev "+ |
| 1434 | "s1-eth1 root") |
| 1435 | main.Mininet1.handle.expect("mininet>") |
| 1436 | |
| 1437 | main.log.info("Checking ONOS for link update") |
| 1438 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1439 | link_down1 = True |
| 1440 | link_down2 = True |
| 1441 | link_down3 = True |
| 1442 | loop_count = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1443 | while( (link_down1 and link_down2 and link_down3)\ |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1444 | and loop_count < 30 ): |
| 1445 | json_str1 = main.ONOS1cli.links() |
| 1446 | json_str2 = main.ONOS2cli.links() |
| 1447 | json_str3 = main.ONOS3cli.links() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1448 | if not (json_str1 and json_str2 and json_str3): |
| 1449 | main.log.error("CLI command returned error ") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1450 | break |
| 1451 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1452 | json_obj1 = json.loads(json_str1) |
| 1453 | json_obj2 = json.loads(json_str2) |
| 1454 | json_obj3 = json.loads(json_str3) |
| 1455 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1456 | for obj1 in json_obj1: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1457 | if '01' in obj1['src']['device']: |
| 1458 | link_down1 = False |
| 1459 | main.log.info("Link up from "+ |
| 1460 | "s1 -> s2 on ONOS1 detected") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1461 | for obj2 in json_obj2: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1462 | if '01' in obj2['src']['device']: |
| 1463 | link_down2 = False |
| 1464 | main.log.info("Link up from "+ |
| 1465 | "s1 -> s2 on ONOS2 detected") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1466 | for obj3 in json_obj3: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1467 | if '01' in obj3['src']['device']: |
| 1468 | link_down3 = False |
| 1469 | main.log.info("Link up from "+ |
| 1470 | "s1 -> s2 on ONOS3 detected") |
| 1471 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1472 | loop_count += 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1473 | time.sleep(1) |
| 1474 | |
| 1475 | if (link_down1 and link_down2 and link_down3): |
| 1476 | main.log.info("Link up discovery failed") |
| 1477 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1478 | link_up_lat_graph1 = 0 |
| 1479 | link_up_lat_graph2 = 0 |
| 1480 | link_up_lat_graph3 = 0 |
| 1481 | link_up_lat_device1 = 0 |
| 1482 | link_up_lat_device2 = 0 |
| 1483 | link_up_lat_device3 = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1484 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1485 | assertion = main.FALSE |
| 1486 | else: |
| 1487 | json_topo_metrics_1 =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1488 | main.ONOS1cli.topology_events_metrics() |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1489 | json_topo_metrics_2 =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1490 | main.ONOS2cli.topology_events_metrics() |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1491 | json_topo_metrics_3 =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1492 | main.ONOS3cli.topology_events_metrics() |
| 1493 | json_topo_metrics_1 = json.loads(json_topo_metrics_1) |
| 1494 | json_topo_metrics_2 = json.loads(json_topo_metrics_2) |
| 1495 | json_topo_metrics_3 = json.loads(json_topo_metrics_3) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1496 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1497 | main.log.info("Obtaining graph and device timestamp") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1498 | graph_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1499 | json_topo_metrics_1[graphTimestamp]['value'] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1500 | graph_timestamp_2 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1501 | json_topo_metrics_2[graphTimestamp]['value'] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1502 | graph_timestamp_3 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1503 | json_topo_metrics_3[graphTimestamp]['value'] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1504 | |
| 1505 | link_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1506 | json_topo_metrics_1[linkTimestamp]['value'] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1507 | link_timestamp_2 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1508 | json_topo_metrics_2[linkTimestamp]['value'] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1509 | link_timestamp_3 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1510 | json_topo_metrics_3[linkTimestamp]['value'] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1511 | |
| 1512 | if graph_timestamp_1 and graph_timestamp_2 and\ |
| 1513 | graph_timestamp_3 and link_timestamp_1 and\ |
| 1514 | link_timestamp_2 and link_timestamp_3: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1515 | link_up_lat_graph1 = int(graph_timestamp_1) -\ |
| 1516 | int(timestamp_link_up_t0) |
| 1517 | link_up_lat_graph2 = int(graph_timestamp_2) -\ |
| 1518 | int(timestamp_link_up_t0) |
| 1519 | link_up_lat_graph3 = int(graph_timestamp_3) -\ |
| 1520 | int(timestamp_link_up_t0) |
| 1521 | |
| 1522 | link_up_lat_link1 = int(link_timestamp_1) -\ |
| 1523 | int(timestamp_link_up_t0) |
| 1524 | link_up_lat_link2 = int(link_timestamp_2) -\ |
| 1525 | int(timestamp_link_up_t0) |
| 1526 | link_up_lat_link3 = int(link_timestamp_3) -\ |
| 1527 | int(timestamp_link_up_t0) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1528 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1529 | main.log.error("There was an error calculating"+ |
| 1530 | " the delta for link down event") |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1531 | link_up_lat_graph1 = 0 |
| 1532 | link_up_lat_graph2 = 0 |
| 1533 | link_up_lat_graph3 = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1534 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1535 | link_up_lat_device1 = 0 |
| 1536 | link_up_lat_device2 = 0 |
| 1537 | link_up_lat_device3 = 0 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1538 | |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1539 | if debug_mode == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1540 | main.log.info("Link up latency ONOS1 iteration "+ |
| 1541 | str(i)+" (end-to-end): "+ |
| 1542 | str(link_up_lat_graph1)+" ms") |
| 1543 | main.log.info("Link up latency ONOS2 iteration "+ |
| 1544 | str(i)+" (end-to-end): "+ |
| 1545 | str(link_up_lat_graph2)+" ms") |
| 1546 | main.log.info("Link up latency ONOS3 iteration "+ |
| 1547 | str(i)+" (end-to-end): "+ |
| 1548 | str(link_up_lat_graph3)+" ms") |
| 1549 | |
| 1550 | main.log.info("Link up latency ONOS1 iteration "+ |
| 1551 | str(i)+" (link-event-to-system-timestamp): "+ |
| 1552 | str(link_up_lat_link1)+" ms") |
| 1553 | main.log.info("Link up latency ONOS2 iteration "+ |
| 1554 | str(i)+" (link-event-to-system-timestamp): "+ |
| 1555 | str(link_up_lat_link2)+" ms") |
| 1556 | main.log.info("Link up latency ONOS3 iteration "+ |
| 1557 | str(i)+" (link-event-to-system-timestamp): "+ |
| 1558 | str(link_up_lat_link3)) |
| 1559 | |
| 1560 | #Calculate avg of node calculations |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1561 | link_up_lat_graph_avg =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1562 | (link_up_lat_graph1 + |
| 1563 | link_up_lat_graph2 + |
| 1564 | link_up_lat_graph3) / 3 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1565 | link_up_lat_link_avg =\ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1566 | (link_up_lat_link1 + |
| 1567 | link_up_lat_link2 + |
| 1568 | link_up_lat_link3) / 3 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1569 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1570 | #Set threshold and append latency to list |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1571 | if link_up_lat_graph_avg > up_threshold_min and\ |
| 1572 | link_up_lat_graph_avg < up_threshold_max: |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1573 | link_up_graph_to_system_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1574 | link_up_lat_graph_avg) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1575 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1576 | main.log.info("Link up latency exceeded threshold") |
| 1577 | main.log.info("Results for iteration "+str(i)+ |
| 1578 | "have been omitted") |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1579 | if link_up_lat_link_avg > up_threshold_min and\ |
| 1580 | link_up_lat_link_avg < up_threshold_max: |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1581 | link_up_link_to_system_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1582 | link_up_lat_link_avg) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1583 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1584 | main.log.info("Link up latency exceeded threshold") |
| 1585 | main.log.info("Results for iteration "+str(i)+ |
| 1586 | "have been omitted") |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1587 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1588 | #Calculate min, max, avg of list and report |
| 1589 | link_down_min = min(link_down_graph_to_system_list) |
| 1590 | link_down_max = max(link_down_graph_to_system_list) |
| 1591 | link_down_avg = sum(link_down_graph_to_system_list) / \ |
| 1592 | len(link_down_graph_to_system_list) |
| 1593 | link_up_min = min(link_up_graph_to_system_list) |
| 1594 | link_up_max = max(link_up_graph_to_system_list) |
| 1595 | link_up_avg = sum(link_up_graph_to_system_list) / \ |
| 1596 | len(link_up_graph_to_system_list) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 1597 | link_down_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1598 | str(round(numpy.std(link_down_graph_to_system_list),1)) |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 1599 | link_up_std_dev = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1600 | str(round(numpy.std(link_up_graph_to_system_list),1)) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1601 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1602 | main.log.report("Link down latency " + |
| 1603 | "Avg: "+str(link_down_avg)+" ms "+ |
| 1604 | "Std Deviation: "+link_down_std_dev+" ms") |
| 1605 | main.log.report("Link up latency "+ |
| 1606 | "Avg: "+str(link_up_avg)+" ms "+ |
| 1607 | "Std Deviation: "+link_up_std_dev+" ms") |
andrewonlab | 4e12448 | 2014-11-04 13:37:25 -0500 | [diff] [blame] | 1608 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1609 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 1610 | onpass="Link discovery latency calculation successful", |
| 1611 | onfail="Link discovery latency case failed") |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1612 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1613 | def CASE5(self, main): |
| 1614 | ''' |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1615 | 100 Switch discovery latency |
| 1616 | |
| 1617 | Important: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1618 | This test case can be potentially dangerous if |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1619 | your machine has previously set iptables rules. |
| 1620 | One of the steps of the test case will flush |
| 1621 | all existing iptables rules. |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1622 | Note: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1623 | You can specify the number of switches in the |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1624 | params file to adjust the switch discovery size |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1625 | (and specify the corresponding topology in Mininet1 |
| 1626 | .topo file) |
| 1627 | ''' |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1628 | import time |
| 1629 | import subprocess |
| 1630 | import os |
| 1631 | import requests |
| 1632 | import json |
| 1633 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1634 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 1635 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 1636 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 1637 | MN1_ip = main.params['MN']['ip1'] |
| 1638 | ONOS_user = main.params['CTRL']['user'] |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1639 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1640 | default_sw_port = main.params['CTRL']['port1'] |
| 1641 | |
| 1642 | #Number of iterations of case |
| 1643 | num_iter = main.params['TEST']['numIter'] |
| 1644 | num_sw = main.params['TEST']['numSwitch'] |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1645 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1646 | #Timestamp 'keys' for json metrics output. |
| 1647 | #These are subject to change, hence moved into params |
| 1648 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 1649 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
| 1650 | |
| 1651 | debug_mode = main.params['TEST']['debugMode'] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1652 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1653 | local_time = time.strftime('%X') |
| 1654 | local_time = local_time.replace("/","") |
| 1655 | local_time = local_time.replace(" ","_") |
| 1656 | local_time = local_time.replace(":","") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1657 | if debug_mode == 'on': |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1658 | main.ONOS1.tshark_pcap("eth0", |
| 1659 | "/tmp/100_sw_lat_pcap_"+local_time) |
| 1660 | |
| 1661 | #Threshold for this test case |
| 1662 | sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold'] |
| 1663 | sw_disc_threshold_obj = sw_disc_threshold_str.split(",") |
| 1664 | sw_disc_threshold_min = int(sw_disc_threshold_obj[0]) |
| 1665 | sw_disc_threshold_max = int(sw_disc_threshold_obj[1]) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1666 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1667 | tshark_ofp_output = "/tmp/tshark_ofp_"+num_sw+"sw.txt" |
| 1668 | tshark_tcp_output = "/tmp/tshark_tcp_"+num_sw+"sw.txt" |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1669 | |
| 1670 | tshark_ofp_result_list = [] |
| 1671 | tshark_tcp_result_list = [] |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1672 | |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1673 | sw_discovery_lat_list = [] |
| 1674 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1675 | main.case(num_sw+" Switch discovery latency") |
| 1676 | main.step("Assigning all switches to ONOS1") |
| 1677 | for i in range(1, int(num_sw)+1): |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1678 | main.Mininet1.assign_sw_controller( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1679 | sw=str(i), |
| 1680 | ip1=ONOS1_ip, |
| 1681 | port1=default_sw_port) |
| 1682 | |
| 1683 | #Ensure that nodes are configured with ptpd |
| 1684 | #Just a warning message |
| 1685 | main.log.info("Please check ptpd configuration to ensure"+\ |
| 1686 | " All nodes' system times are in sync") |
| 1687 | time.sleep(5) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1688 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1689 | for i in range(0, int(num_iter)): |
| 1690 | |
| 1691 | main.step("Set iptables rule to block incoming sw connections") |
| 1692 | #Set iptables rule to block incoming switch connections |
| 1693 | #The rule description is as follows: |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1694 | # Append to INPUT rule, |
| 1695 | # behavior DROP that matches following: |
| 1696 | # * packet type: tcp |
| 1697 | # * source IP: MN1_ip |
| 1698 | # * destination PORT: 6633 |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1699 | main.ONOS1.handle.sendline( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1700 | "sudo iptables -A INPUT -p tcp -s "+MN1_ip+ |
| 1701 | " --dport "+default_sw_port+" -j DROP") |
| 1702 | main.ONOS1.handle.expect("\$") |
| 1703 | # Append to OUTPUT rule, |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1704 | # behavior DROP that matches following: |
| 1705 | # * packet type: tcp |
| 1706 | # * source IP: MN1_ip |
| 1707 | # * destination PORT: 6633 |
| 1708 | main.ONOS1.handle.sendline( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1709 | "sudo iptables -A OUTPUT -p tcp -s "+MN1_ip+ |
| 1710 | " --dport "+default_sw_port+" -j DROP") |
| 1711 | main.ONOS1.handle.expect("\$") |
| 1712 | #Give time to allow rule to take effect |
| 1713 | #NOTE: Sleep period may need to be configured |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1714 | # based on the number of switches in the topology |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1715 | main.log.info("Please wait for switch connection to "+ |
| 1716 | "time out") |
| 1717 | time.sleep(60) |
| 1718 | |
| 1719 | #Gather vendor OFP with tshark |
| 1720 | main.ONOS1.tshark_grep("OFP 86 Vendor", |
| 1721 | tshark_ofp_output) |
| 1722 | main.ONOS1.tshark_grep("TCP 74 ", |
| 1723 | tshark_tcp_output) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1724 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1725 | #NOTE: Remove all iptables rule quickly (flush) |
| 1726 | # Before removal, obtain TestON timestamp at which |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1727 | # removal took place |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1728 | # (ensuring nodes are configured via ptp) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1729 | # sudo iptables -F |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1730 | |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1731 | t0_system = time.time() * 1000 |
| 1732 | main.ONOS1.handle.sendline( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1733 | "sudo iptables -F") |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1734 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1735 | #Counter to track loop count |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1736 | counter_loop = 0 |
| 1737 | counter_avail1 = 0 |
| 1738 | counter_avail2 = 0 |
| 1739 | counter_avail3 = 0 |
| 1740 | onos1_dev = False |
| 1741 | onos2_dev = False |
| 1742 | onos3_dev = False |
| 1743 | while counter_loop < 60: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1744 | #Continue to check devices for all device |
| 1745 | #availability. When all devices in all 3 |
| 1746 | #ONOS instances indicate that devices are available |
| 1747 | #obtain graph event timestamp for t1. |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1748 | device_str_obj1 = main.ONOS1cli.devices() |
| 1749 | device_str_obj2 = main.ONOS2cli.devices() |
| 1750 | device_str_obj3 = main.ONOS3cli.devices() |
| 1751 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1752 | device_json1 = json.loads(device_str_obj1) |
| 1753 | device_json2 = json.loads(device_str_obj2) |
| 1754 | device_json3 = json.loads(device_str_obj3) |
| 1755 | |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1756 | for device1 in device_json1: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1757 | if device1['available'] == True: |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1758 | counter_avail1 += 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1759 | if counter_avail1 == int(num_sw): |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1760 | onos1_dev = True |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1761 | main.log.info("All devices have been "+ |
| 1762 | "discovered on ONOS1") |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1763 | else: |
| 1764 | counter_avail1 = 0 |
| 1765 | for device2 in device_json2: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1766 | if device2['available'] == True: |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1767 | counter_avail2 += 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1768 | if counter_avail2 == int(num_sw): |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1769 | onos2_dev = True |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1770 | main.log.info("All devices have been "+ |
| 1771 | "discovered on ONOS2") |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1772 | else: |
| 1773 | counter_avail2 = 0 |
| 1774 | for device3 in device_json3: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1775 | if device3['available'] == True: |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1776 | counter_avail3 += 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1777 | if counter_avail3 == int(num_sw): |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1778 | onos3_dev = True |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1779 | main.log.info("All devices have been "+ |
| 1780 | "discovered on ONOS3") |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1781 | else: |
| 1782 | counter_avail3 = 0 |
| 1783 | |
| 1784 | if onos1_dev and onos2_dev and onos3_dev: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1785 | main.log.info("All devices have been discovered "+ |
| 1786 | "on all ONOS instances") |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1787 | json_str_topology_metrics_1 =\ |
| 1788 | main.ONOS1cli.topology_events_metrics() |
| 1789 | json_str_topology_metrics_2 =\ |
| 1790 | main.ONOS2cli.topology_events_metrics() |
| 1791 | json_str_topology_metrics_3 =\ |
| 1792 | main.ONOS3cli.topology_events_metrics() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1793 | |
| 1794 | #Exit while loop if all devices discovered |
| 1795 | break |
| 1796 | |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1797 | counter_loop += 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1798 | #Give some time in between CLI calls |
| 1799 | #(will not affect measurement) |
| 1800 | time.sleep(3) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1801 | |
| 1802 | main.ONOS1.tshark_stop() |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1803 | |
| 1804 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 1805 | tshark_ofp_output+" /tmp/") |
| 1806 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 1807 | tshark_tcp_output+" /tmp/") |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1808 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1809 | #TODO: Automate OFP output analysis |
| 1810 | #Debug mode - print out packets captured at runtime |
| 1811 | if debug_mode == 'on': |
| 1812 | ofp_file = open(tshark_ofp_output, 'r') |
| 1813 | main.log.info("Tshark OFP Vendor output: ") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1814 | for line in ofp_file: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1815 | tshark_ofp_result_list.append(line) |
| 1816 | main.log.info(line) |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1817 | ofp_file.close() |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1818 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1819 | tcp_file = open(tshark_tcp_output, 'r') |
| 1820 | main.log.info("Tshark TCP 74 output: ") |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1821 | for line in tcp_file: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1822 | tshark_tcp_result_list.append(line) |
| 1823 | main.log.info(line) |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1824 | tcp_file.close() |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1825 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1826 | json_obj_1 = json.loads(json_str_topology_metrics_1) |
| 1827 | json_obj_2 = json.loads(json_str_topology_metrics_2) |
| 1828 | json_obj_3 = json.loads(json_str_topology_metrics_3) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1829 | |
| 1830 | graph_timestamp_1 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1831 | json_obj_1[graphTimestamp]['value'] |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1832 | graph_timestamp_2 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1833 | json_obj_2[graphTimestamp]['value'] |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1834 | graph_timestamp_3 = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1835 | json_obj_3[graphTimestamp]['value'] |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1836 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1837 | graph_lat_1 = int(graph_timestamp_1) - int(t0_system) |
| 1838 | graph_lat_2 = int(graph_timestamp_2) - int(t0_system) |
| 1839 | graph_lat_3 = int(graph_timestamp_3) - int(t0_system) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1840 | |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1841 | avg_graph_lat = \ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1842 | (int(graph_lat_1) +\ |
| 1843 | int(graph_lat_2) +\ |
| 1844 | int(graph_lat_3)) / 3 |
| 1845 | |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1846 | if avg_graph_lat > sw_disc_threshold_min \ |
| 1847 | and avg_graph_lat < sw_disc_threshold_max: |
| 1848 | sw_discovery_lat_list.append( |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1849 | avg_graph_lat) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1850 | else: |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1851 | main.log.info("100 Switch discovery latency "+ |
| 1852 | "exceeded the threshold.") |
| 1853 | |
| 1854 | #END ITERATION FOR LOOP |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1855 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1856 | sw_lat_min = min(sw_discovery_lat_list) |
| 1857 | sw_lat_max = max(sw_discovery_lat_list) |
| 1858 | sw_lat_avg = sum(sw_discovery_lat_list) /\ |
| 1859 | len(sw_discovery_lat_list) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1860 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1861 | main.log.report("100 Switch discovery lat "+\ |
| 1862 | "Min: "+str(sw_lat_min)+" ms"+\ |
| 1863 | "Max: "+str(sw_lat_max)+" ms"+\ |
| 1864 | "Avg: "+str(sw_lat_avg)+" ms") |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1865 | |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame^] | 1866 | def CASE6(self, main): |
| 1867 | ''' |
| 1868 | Increase number of nodes and initiate CLI |
| 1869 | ''' |
| 1870 | import time |
| 1871 | |
| 1872 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 1873 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 1874 | ONOS3_ip = main.params['CTRL']['ip3'] |
| 1875 | ONOS4_ip = main.params['CTRL']['ip4'] |
| 1876 | ONOS5_ip = main.params['CTRL']['ip5'] |
| 1877 | ONOS6_ip = main.params['CTRL']['ip6'] |
| 1878 | ONOS7_ip = main.params['CTRL']['ip7'] |
| 1879 | |
| 1880 | cell_name = main.params['ENV']['cellName'] |
| 1881 | |
| 1882 | global cluster_count |
| 1883 | |
| 1884 | #Cluster size increased everytime the case is defined |
| 1885 | cluster_count += 2 |
| 1886 | |
| 1887 | main.log.report("Increasing cluster size to "+ |
| 1888 | str(cluster_count)) |
| 1889 | |
| 1890 | install_result = main.FALSE |
| 1891 | if cluster_count == 3: |
| 1892 | main.log.info("Installing nodes 2 and 3") |
| 1893 | node2_result = \ |
| 1894 | main.ONOSbench.onos_install(node=ONOS2_ip) |
| 1895 | node3_result = \ |
| 1896 | main.ONOSbench.onos_install(node=ONOS3_ip) |
| 1897 | install_result = node2_result and node3_result |
| 1898 | |
| 1899 | time.sleep(5) |
| 1900 | |
| 1901 | main.ONOS2cli.start_onos_cli(ONOS2_ip) |
| 1902 | main.ONOS3cli.start_onos_cli(ONOS3_ip) |
| 1903 | |
| 1904 | elif cluster_count == 5: |
| 1905 | main.log.info("Installing nodes 4 and 5") |
| 1906 | node4_result = \ |
| 1907 | main.ONOSbench.onos_install(node=ONOS4_ip) |
| 1908 | node5_result = \ |
| 1909 | main.ONOSbench.onos_install(node=ONOS5_ip) |
| 1910 | install_result = node4_result and node5_result |
| 1911 | |
| 1912 | time.sleep(5) |
| 1913 | |
| 1914 | main.ONOS4cli.start_onos_cli(ONOS4_ip) |
| 1915 | main.ONOS5cli.start_onos_cli(ONOS5_ip) |
| 1916 | |
| 1917 | elif cluster_count == 7: |
| 1918 | main.log.info("Installing nodes 4 and 5") |
| 1919 | node6_result = \ |
| 1920 | main.ONOSbench.onos_install(node=ONOS6_ip) |
| 1921 | node7_result = \ |
| 1922 | main.ONOSbench.onos_install(node=ONOS7_ip) |
| 1923 | install_result = node6_result and node7_result |
| 1924 | |
| 1925 | time.sleep(5) |
| 1926 | |
| 1927 | main.ONOS6cli.start_onos_cli(ONOS6_ip) |
| 1928 | main.ONOS7cli.start_onos_cli(ONOS7_ip) |
| 1929 | |
| 1930 | |
| 1931 | |