andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 1 | #TopoPerfNext |
| 2 | # |
| 3 | #Topology Performance test for ONOS-next |
| 4 | # |
| 5 | #andrew@onlab.us |
| 6 | |
| 7 | import time |
| 8 | import sys |
| 9 | import os |
| 10 | import re |
| 11 | |
| 12 | class TopoPerfNext: |
| 13 | def __init__(self): |
| 14 | self.default = '' |
| 15 | |
| 16 | def CASE1(self, main): |
| 17 | ''' |
| 18 | ONOS startup sequence |
| 19 | ''' |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 20 | import time |
| 21 | |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 22 | cell_name = main.params['ENV']['cellName'] |
| 23 | |
| 24 | git_pull = main.params['GIT']['autoPull'] |
| 25 | checkout_branch = main.params['GIT']['checkout'] |
| 26 | |
| 27 | ONOS1_ip = main.params['CTRL']['ip1'] |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 28 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 29 | ONOS3_ip = main.params['CTRL']['ip3'] |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 30 | MN1_ip = main.params['MN']['ip1'] |
| 31 | BENCH_ip = main.params['BENCH']['ip'] |
| 32 | |
| 33 | main.case("Setting up test environment") |
| 34 | |
| 35 | main.step("Creating cell file") |
| 36 | cell_file_result = main.ONOSbench.create_cell_file( |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 37 | BENCH_ip, cell_name, MN1_ip, "onos-core", |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 38 | ONOS1_ip, ONOS2_ip, ONOS3_ip) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 39 | |
| 40 | main.step("Applying cell file to environment") |
| 41 | cell_apply_result = main.ONOSbench.set_cell(cell_name) |
| 42 | verify_cell_result = main.ONOSbench.verify_cell() |
| 43 | |
| 44 | main.step("Git checkout and pull "+checkout_branch) |
| 45 | if git_pull == 'on': |
| 46 | checkout_result = \ |
| 47 | main.ONOSbench.git_checkout(checkout_branch) |
| 48 | pull_result = main.ONOSbench.git_pull() |
| 49 | else: |
| 50 | checkout_result = main.TRUE |
| 51 | pull_result = main.TRUE |
| 52 | main.log.info("Skipped git checkout and pull") |
| 53 | |
| 54 | main.step("Using mvn clean & install") |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 55 | #mvn_result = main.ONOSbench.clean_install() |
| 56 | mvn_result = main.TRUE |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 57 | |
| 58 | main.step("Creating ONOS package") |
| 59 | package_result = main.ONOSbench.onos_package() |
| 60 | |
| 61 | main.step("Installing ONOS package") |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 62 | install1_result = main.ONOSbench.onos_install(node=ONOS1_ip) |
| 63 | install2_result = main.ONOSbench.onos_install(node=ONOS2_ip) |
| 64 | install3_result = main.ONOSbench.onos_install(node=ONOS3_ip) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 65 | |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 66 | #NOTE: This step may be unnecessary |
| 67 | #main.step("Starting ONOS service") |
| 68 | #start_result = main.ONOSbench.onos_start(ONOS1_ip) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 69 | |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 70 | main.step("Set cell for ONOS cli env") |
| 71 | main.ONOS1cli.set_cell(cell_name) |
| 72 | main.ONOS2cli.set_cell(cell_name) |
| 73 | main.ONOS3cli.set_cell(cell_name) |
| 74 | |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 75 | time.sleep(10) |
| 76 | |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 77 | main.step("Start onos cli") |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 78 | cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip) |
| 79 | cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip) |
| 80 | cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip) |
| 81 | |
| 82 | if not (cli1 and cli2 and cli3): |
| 83 | main.log.info("Attempting to start cli again") |
| 84 | cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip) |
| 85 | cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip) |
| 86 | cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip) |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 87 | |
| 88 | main.step("Enable metrics feature") |
| 89 | main.ONOS1cli.feature_install("onos-app-metrics-topology") |
| 90 | main.ONOS2cli.feature_install("onos-app-metrics-topology") |
| 91 | main.ONOS3cli.feature_install("onos-app-metrics-topology") |
| 92 | |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 93 | utilities.assert_equals(expect=main.TRUE, |
| 94 | actual= cell_file_result and cell_apply_result and\ |
| 95 | verify_cell_result and checkout_result and\ |
| 96 | pull_result and mvn_result and\ |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 97 | install1_result and install2_result and\ |
| 98 | install3_result, |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 99 | onpass="ONOS started successfully", |
| 100 | onfail="Failed to start ONOS") |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 101 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 102 | def CASE2(self, main): |
| 103 | ''' |
| 104 | Assign s1 to ONOS1 and measure latency |
| 105 | ''' |
| 106 | import time |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 107 | import subprocess |
| 108 | import json |
| 109 | import requests |
| 110 | import os |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 111 | |
| 112 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 113 | ONOS2_ip = main.params['CTRL']['ip2'] |
| 114 | ONOS3_ip = main.params['CTRL']['ip3'] |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 115 | ONOS_user = main.params['CTRL']['user'] |
| 116 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 117 | default_sw_port = main.params['CTRL']['port1'] |
| 118 | |
| 119 | #Number of iterations of case |
| 120 | num_iter = main.params['TEST']['numIter'] |
| 121 | |
| 122 | #Directory/file to store tshark results |
| 123 | tshark_of_output = "/tmp/tshark_of_topo.txt" |
| 124 | tshark_tcp_output = "/tmp/tshark_tcp_topo.txt" |
| 125 | |
| 126 | #String to grep in tshark output |
| 127 | tshark_tcp_string = "TCP 74 "+default_sw_port |
| 128 | tshark_of_string = "OFP 86 Vendor" |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 129 | |
| 130 | #Initialize assertion to TRUE |
| 131 | assertion = main.TRUE |
| 132 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 133 | main.log.report("Latency of adding one switch") |
| 134 | |
| 135 | for i in range(0, int(num_iter)): |
| 136 | main.log.info("Starting tshark capture") |
| 137 | |
| 138 | #* TCP [ACK, SYN] is used as t0_a, the |
| 139 | # very first "exchange" between ONOS and |
| 140 | # the switch for end-to-end measurement |
| 141 | #* OFP [Stats Reply] is used for t0_b |
| 142 | # the very last OFP message between ONOS |
| 143 | # and the switch for ONOS measurement |
| 144 | main.ONOS1.tshark_grep(tshark_tcp_string, |
| 145 | tshark_tcp_output) |
| 146 | main.ONOS1.tshark_grep(tshark_of_string, |
| 147 | tshark_of_output) |
| 148 | |
| 149 | #Wait and ensure tshark is started and |
| 150 | #capturing |
| 151 | time.sleep(10) |
| 152 | |
| 153 | main.log.info("Assigning s1 to controller") |
| 154 | |
| 155 | main.Mininet1.assign_sw_controller(sw="1", |
| 156 | ip1=ONOS1_ip, port1=default_sw_port) |
| 157 | |
| 158 | #Wait and ensure switch is assigned |
| 159 | #before stopping tshark |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 160 | time.sleep(30) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 161 | |
| 162 | main.ONOS1.stop_tshark() |
| 163 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 164 | #tshark output is saved in ONOS. Use subprocess |
| 165 | #to copy over files to TestON for parsing |
| 166 | main.log.info("Copying over tshark files") |
| 167 | |
| 168 | #TCP CAPTURE **** |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 169 | #Copy the tshark output from ONOS machine to |
| 170 | #TestON machine in tshark_tcp_output directory>file |
| 171 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 172 | tshark_tcp_output+" /tmp/") |
| 173 | tcp_file = open(tshark_tcp_output, 'r') |
| 174 | temp_text = tcp_file.readline() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 175 | temp_text = temp_text.split(" ") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 176 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 177 | main.log.info("Object read in from TCP capture: "+ |
| 178 | str(temp_text)) |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 179 | if len(temp_text) > 1: |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 180 | t0_tcp = int(float(temp_text[1])*1000) |
| 181 | else: |
| 182 | main.log.error("Tshark output file for TCP"+ |
| 183 | " returned unexpected results") |
| 184 | t0_tcp = 0 |
| 185 | assertion = main.FALSE |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 186 | |
| 187 | tcp_file.close() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 188 | #**************** |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 189 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 190 | #OF CAPTURE **** |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 191 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 192 | tshark_of_output+" /tmp/") |
| 193 | of_file = open(tshark_of_output, 'r') |
| 194 | |
| 195 | line_ofp = "" |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 196 | while True: |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 197 | temp_text = of_file.readline() |
| 198 | if temp_text !='': |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 199 | line_ofp = temp_text |
| 200 | else: |
| 201 | break |
| 202 | obj = line_ofp.split(" ") |
| 203 | |
| 204 | main.log.info("Object read in from OFP capture: "+ |
| 205 | str(line_ofp)) |
| 206 | |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 207 | if len(line_ofp) > 1: |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 208 | t0_ofp = int(float(obj[1])*1000) |
| 209 | else: |
| 210 | main.log.error("Tshark output file for OFP"+ |
| 211 | " returned unexpected results") |
| 212 | t0_ofp = 0 |
| 213 | assertion = main.FALSE |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 214 | |
| 215 | of_file.close() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 216 | #**************** |
| 217 | |
| 218 | #TODO: |
| 219 | #Get json object from all 3 ONOS instances |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 220 | json_str_1 = main.ONOS1cli.topology_events_metrics() |
| 221 | json_str_2 = main.ONOS2cli.topology_events_metrics() |
| 222 | json_str_3 = main.ONOS3cli.topology_events_metrics() |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 223 | |
| 224 | json_obj_1 = json.loads(json_str_1) |
| 225 | json_obj_2 = json.loads(json_str_2) |
| 226 | json_obj_3 = json.loads(json_str_3) |
| 227 | |
| 228 | main.log.info(json_obj_1) |
| 229 | main.log.info(json_obj_2) |
| 230 | main.log.info(json_obj_3) |
| 231 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 232 | #TODO: |
| 233 | #Parse json object for timestamp |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame^] | 234 | topo_timestamp_1 = \ |
| 235 | json_obj_1['lastTopologyEventTimestamp']['value'] |
| 236 | topo_timestamp_2 = \ |
| 237 | json_obj_2['lastTopologyEventTimestamp']['value'] |
| 238 | topo_timestamp_3 = \ |
| 239 | json_obj_3['lastTopologyEventTimestamp']['value'] |
| 240 | |
| 241 | main.log.info(topo_timestamp_1) |
| 242 | main.log.info(topo_timestamp_2) |
| 243 | main.log.info(topo_timestamp_3) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 244 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 245 | #ONOS processing latency |
| 246 | delta_of_1 = int(topo_timestamp_1) - int(t0_ofp) |
| 247 | delta_of_2 = int(topo_timestamp_2) - int(t0_ofp) |
| 248 | delta_of_3 = int(topo_timestamp_3) - int(t0_ofp) |
| 249 | |
| 250 | #End-to-end processing latency |
| 251 | delta_tcp_1 = int(topo_timestamp_1) - int(t0_tcp) |
| 252 | delta_tcp_2 = int(topo_timestamp_2) - int(t0_tcp) |
| 253 | delta_tcp_3 = int(topo_timestamp_3) - int(t0_tcp) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 254 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 255 | #TODO: |
| 256 | #Fetch logs upon threshold excess |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 257 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 258 | main.log.info("ONOS1 delta OFP: "+str(delta_of_1)) |
| 259 | main.log.info("ONOS2 delta OFP: "+str(delta_of_2)) |
| 260 | main.log.info("ONOS3 delta OFP: "+str(delta_of_3)) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 261 | |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 262 | main.log.info("ONOS1 delta TCP: "+str(delta_tcp_1)) |
| 263 | main.log.info("ONOS2 delta TCP: "+str(delta_tcp_2)) |
| 264 | main.log.info("ONOS3 delta TCP: "+str(delta_tcp_3)) |
| 265 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 266 | main.step("Remove switch from controller") |
| 267 | main.Mininet1.delete_sw_controller("s1") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 268 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 269 | time.sleep(5) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 270 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 271 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 272 | onpass="Switch latency test successful", |
| 273 | onfail="Switch latency test failed") |
| 274 | |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 275 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 276 | def CASE3(self, main): |
| 277 | ''' |
| 278 | Bring port up / down and measure latency. |
| 279 | Port enable / disable is simulated by ifconfig up / down |
| 280 | ''' |
| 281 | import time |
| 282 | import subprocess |
| 283 | import os |
| 284 | import requests |
| 285 | import json |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 286 | |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 287 | ONOS1_ip = main.params['CTRL']['ip1'] |
| 288 | default_sw_port = main.params['CTRL']['port1'] |
| 289 | ONOS_user = main.params['CTRL']['user'] |
| 290 | num_iter = main.params['TEST']['numIter'] |
| 291 | |
| 292 | tshark_port_status = "OFP 130 Port Status" |
| 293 | |
| 294 | tshark_port_up = "/tmp/tshark_port_up.txt" |
| 295 | tshark_port_down = "/tmp/tshark_port_down.txt" |
| 296 | |
| 297 | main.log.report("Port enable / disable latency") |
| 298 | |
| 299 | main.step("Assign switch to controller") |
| 300 | main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip, |
| 301 | port1=default_sw_port) |
| 302 | |
| 303 | main.step("Verify switch is assigned correctly") |
| 304 | result_s1 = main.Mininet1.get_sw_controller(sw="s1") |
| 305 | if result_s1 == main.FALSE: |
| 306 | main.log.info("Switch s1 was not assigned correctly") |
| 307 | assertion = main.FALSE |
| 308 | else: |
| 309 | main.log.info("Switch s1 was assigned correctly") |
| 310 | |
| 311 | for i in range(0, int(num_iter)): |
| 312 | main.step("Starting wireshark capture for port status down") |
| 313 | main.ONOS1.tshark_grep(tshark_port_status, |
| 314 | tshark_port_down) |
| 315 | |
| 316 | time.sleep(10) |
| 317 | |
| 318 | main.step("Disable port (interface s1-eth2)") |
| 319 | main.Mininet2.handle.sendline("sudo ifconfig s1-eth2 down") |
| 320 | main.Mininet2.handle.expect("\$") |
| 321 | time.sleep(20) |
| 322 | |
| 323 | main.ONOS1.tshark_stop() |
| 324 | time.sleep(5) |
| 325 | |
| 326 | #Copy tshark output file from ONOS to TestON instance |
| 327 | #/tmp directory |
| 328 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 329 | tshark_port_down+" /tmp/") |
| 330 | |
| 331 | f_port_down = open(tshark_port_down, 'r') |
| 332 | f_line = f_port_down.readline() |
| 333 | obj_down = f_line.split(" ") |
| 334 | if len(f_line) > 0: |
| 335 | timestamp_begin_pt_down = int(float(obj_down[1])*1000) |
| 336 | else: |
| 337 | main.log.info("Tshark output file returned unexpected"+ |
| 338 | " results") |
| 339 | timestamp_begin_pt_down = 0 |
| 340 | |
| 341 | main.step("Obtain t1 by REST call") |
| 342 | #TODO: Implement json object parsing here |
| 343 | |
| 344 | timestamp_end_pt_down_1 = 0 |
| 345 | timestamp_end_pt_down_2 = 0 |
| 346 | timestamp_end_pt_down_3 = 0 |
| 347 | |
| 348 | delta_pt_down_1 = int(timestamp_end_pt_down_1) - \ |
| 349 | int(timestamp_begin_pt_down) |
| 350 | delta_pt_down_2 = int(timestamp_end_pt_down_2) - \ |
| 351 | int(timestamp_begin_pt_down) |
| 352 | delta_pt_down_3 = int(timestamp_end_pt_down_3) - \ |
| 353 | int(timestamp_begin_pt_down) |
| 354 | |
| 355 | #TODO: Remove these logs. For test purposes only |
| 356 | main.log.info("Delta1: "+str(delta_pt_down_1)) |
| 357 | main.log.info("Delta2: "+str(delta_pt_down_2)) |
| 358 | main.log.info("Delta3: "+str(delta_pt_down_3)) |
| 359 | |
| 360 | #Port up events |
| 361 | main.step("Enable port and obtain timestamp") |
| 362 | main.step("Starting wireshark capture for port status up") |
| 363 | main.ONOS1.tshark_grep("OFP 130 Port Status", tshark_port_up) |
| 364 | time.sleep(10) |
| 365 | |
| 366 | main.Mininet2.handle.sendline("sudo ifconfig s1-eth2 up") |
| 367 | main.Mininet2.handle.expect("\$") |
| 368 | time.sleep(20) |
| 369 | |
| 370 | os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+ |
| 371 | tshark_port_up+" /tmp/") |
| 372 | |
| 373 | f_port_up = open(tshark_port_up, 'r') |
| 374 | f_line = f_port_down.readline() |
| 375 | obj_up = f_line.split(" ") |
| 376 | if len(f_line) > 0: |
| 377 | timestamp_begin_pt_up = int(float(obj_up[1])*1000) |
| 378 | else: |
| 379 | main.log.info("Tshark output file returned unexpected"+ |
| 380 | " results.") |
| 381 | timestamp_begin_pt_up = 0 |
| 382 | |
| 383 | main.step("Obtain t1 by REST call") |
| 384 | #TODO: Implement json object parsing here |
| 385 | |
| 386 | timestamp_end_pt_up_1 = 0 |
| 387 | timestamp_end_pt_up_2 = 0 |
| 388 | timestamp_end_pt_up_3 = 0 |
| 389 | |
| 390 | delta_pt_up_1 = int(timestamp_end_pt_up_1) - \ |
| 391 | int(timestamp_begin_pt_up) |
| 392 | delta_pt_up_2 = int(timestamp_end_pt_up_2) - \ |
| 393 | int(timestamp_begin_pt_up) |
| 394 | delta_pt_up_3 = int(timestamp_end_pt_up_3) - \ |
| 395 | int(timestamp_begin_pt_up) |
| 396 | |
| 397 | #TODO: Remove these logs. For test purposes only |
| 398 | main.log.info("Delta1: "+str(delta_pt_up_1)) |
| 399 | main.log.info("Delta2: "+str(delta_pt_up_2)) |
| 400 | main.log.info("Delta3: "+str(delta_pt_up_3)) |
| 401 | |
| 402 | |
| 403 | |
| 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 413 | |
| 414 | |
| 415 | |