X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=tools%2Fpkt_gen%2Fixnet%2Fixnet.py;h=5e4ae569451426e68d208a8b09613aa42c4bf44b;hb=a9e754b1050b17464d9e77a942068956d872894e;hp=28ee8aaf7be03aa10ee1cf58c5e858d2d6527059;hpb=47206e37b1cd5210b043474158d6dd7edba577d3;p=vswitchperf.git diff --git a/tools/pkt_gen/ixnet/ixnet.py b/tools/pkt_gen/ixnet/ixnet.py index 28ee8aaf..5e4ae569 100755 --- a/tools/pkt_gen/ixnet/ixnet.py +++ b/tools/pkt_gen/ixnet/ixnet.py @@ -1,4 +1,4 @@ -# Copyright 2015 Intel Corporation. +# Copyright 2015-2016 Intel Corporation. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,6 @@ This requires the following settings in your config file: * TRAFFICGEN_IXNET_LIB_PATH IxNetwork libraries path -* TRAFFICGEN_IXNET_HOST - IxNetwork host IP address * TRAFFICGEN_IXNET_PORT IxNetwork host port number * TRAFFICGEN_IXNET_USER @@ -32,7 +30,7 @@ This requires the following settings in your config file: as the previous one The following settings are also required. These can likely be shared -an 'Ixia' traffic generator instance: +with an 'Ixia' traffic generator instance: * TRAFFICGEN_IXIA_HOST IXIA chassis IP address @@ -153,7 +151,11 @@ class IxNet(trafficgen.ITrafficGenerator): Currently only the RFC2544 tests are implemented. """ - _script = os.path.join(os.path.dirname(__file__), 'ixnetrfc2544.tcl') + if settings.getValue('TRAFFICGEN_IXNET_TCL_SCRIPT') == '': + _script = os.path.join(os.path.dirname(__file__), 'ixnetrfc2544.tcl') + else: + _script = os.path.join(os.path.dirname(__file__), + settings.getValue('TRAFFICGEN_IXNET_TCL_SCRIPT')) _tclsh = tkinter.Tcl() _cfg = None _logger = logging.getLogger(__name__) @@ -200,14 +202,14 @@ class IxNet(trafficgen.ITrafficGenerator): """ pass - def send_cont_traffic(self, traffic=None, time=30, framerate=100): + def send_cont_traffic(self, traffic=None, duration=30): """See ITrafficGenerator for description """ - self.start_cont_traffic(traffic, time, framerate) + self.start_cont_traffic(traffic, duration) return self.stop_cont_traffic() - def start_cont_traffic(self, traffic=None, time=30, framerate=100): + def start_cont_traffic(self, traffic=None, duration=30): """Start transmission. """ self._bidir = traffic['bidir'] @@ -215,9 +217,10 @@ class IxNet(trafficgen.ITrafficGenerator): self._params['config'] = { 'binary': False, # don't do binary search and send one stream - 'time': time, - 'framerate': framerate, + 'duration': duration, + 'framerate': traffic['frame_rate'], 'multipleStreams': traffic['multistream'], + 'streamType': traffic['stream_type'], 'rfc2544TestType': 'throughput', } self._params['traffic'] = self.traffic_defaults.copy() @@ -250,15 +253,15 @@ class IxNet(trafficgen.ITrafficGenerator): """ return self._wait_result() - def send_rfc2544_throughput(self, traffic=None, trials=3, duration=20, + def send_rfc2544_throughput(self, traffic=None, tests=1, duration=20, lossrate=0.0): """See ITrafficGenerator for description """ - self.start_rfc2544_throughput(traffic, trials, duration, lossrate) + self.start_rfc2544_throughput(traffic, tests, duration, lossrate) return self.wait_rfc2544_throughput() - def start_rfc2544_throughput(self, traffic=None, trials=3, duration=20, + def start_rfc2544_throughput(self, traffic=None, tests=1, duration=20, lossrate=0.0): """Start transmission. """ @@ -267,10 +270,11 @@ class IxNet(trafficgen.ITrafficGenerator): self._params['config'] = { 'binary': True, - 'trials': trials, + 'tests': tests, 'duration': duration, 'lossrate': lossrate, 'multipleStreams': traffic['multistream'], + 'streamType': traffic['stream_type'], 'rfc2544TestType': 'throughput', } self._params['traffic'] = self.traffic_defaults.copy() @@ -350,24 +354,26 @@ class IxNet(trafficgen.ITrafficGenerator): for row in reader: #Replace null entries added by Ixia with 0s. row = [entry if len(entry) > 0 else '0' for entry in row] - # calculate tx fps by (rx fps * (tx % / rx %)) - tx_fps = float(row[5]) * (float(row[4]) / float(row[3])) - # calculate tx mbps by (rx mbps * (tx % / rx %)) - tx_mbps = float(row[6]) * (float(row[4]) / float(row[3])) + + # tx_fps and tx_mps cannot be reliably calculated + # as the DUT may be modifying the frame size + tx_fps = 'Unknown' + tx_mbps = 'Unknown' if bool(results.get(ResultsConstants.THROUGHPUT_RX_FPS)) \ - == False: + is False: prev_percent_rx = 0.0 else: prev_percent_rx = \ float(results.get(ResultsConstants.THROUGHPUT_RX_FPS)) if float(row[5]) >= prev_percent_rx: - results[ResultsConstants.THROUGHPUT_TX_FPS] = tx_fps + results[ResultsConstants.TX_RATE_FPS] = tx_fps results[ResultsConstants.THROUGHPUT_RX_FPS] = row[5] - results[ResultsConstants.THROUGHPUT_TX_MBPS] = tx_mbps + results[ResultsConstants.TX_RATE_MBPS] = tx_mbps results[ResultsConstants.THROUGHPUT_RX_MBPS] = row[6] - results[ResultsConstants.THROUGHPUT_TX_PERCENT] = row[3] + results[ResultsConstants.TX_RATE_PERCENT] = row[3] results[ResultsConstants.THROUGHPUT_RX_PERCENT] = row[4] + results[ResultsConstants.FRAME_LOSS_PERCENT] = row[10] results[ResultsConstants.MIN_LATENCY_NS] = row[11] results[ResultsConstants.MAX_LATENCY_NS] = row[12] results[ResultsConstants.AVG_LATENCY_NS] = row[13] @@ -381,15 +387,18 @@ class IxNet(trafficgen.ITrafficGenerator): # the results file return parse_ixnet_rfc_results(parse_result_string(output[0])) - def send_rfc2544_back2back(self, traffic=None, trials=1, duration=20, + def send_rfc2544_back2back(self, traffic=None, tests=1, duration=2, lossrate=0.0): """See ITrafficGenerator for description """ - self.start_rfc2544_back2back(traffic, trials, duration, lossrate) + # NOTE 2 seconds is the recommended duration for a back 2 back + # test in RFC2544. 50 trials is the recommended number from the + # RFC also. + self.start_rfc2544_back2back(traffic, tests, duration, lossrate) return self.wait_rfc2544_back2back() - def start_rfc2544_back2back(self, traffic=None, trials=1, duration=20, + def start_rfc2544_back2back(self, traffic=None, tests=1, duration=2, lossrate=0.0): """Start transmission. """ @@ -398,10 +407,11 @@ class IxNet(trafficgen.ITrafficGenerator): self._params['config'] = { 'binary': True, - 'trials': trials, + 'tests': tests, 'duration': duration, 'lossrate': lossrate, 'multipleStreams': traffic['multistream'], + 'streamType': traffic['stream_type'], 'rfc2544TestType': 'back2back', } self._params['traffic'] = self.traffic_defaults.copy() @@ -473,6 +483,7 @@ class IxNet(trafficgen.ITrafficGenerator): """ results = OrderedDict() results[ResultsConstants.B2B_FRAMES] = 0 + results[ResultsConstants.B2B_FRAME_LOSS_PERCENT] = 100 with open(path, 'r') as in_file: reader = csv.reader(in_file, delimiter=',') @@ -484,6 +495,7 @@ class IxNet(trafficgen.ITrafficGenerator): if int(row[12]) > \ int(results[ResultsConstants.B2B_FRAMES]): results[ResultsConstants.B2B_FRAMES] = int(row[12]) + results[ResultsConstants.B2B_FRAME_LOSS_PERCENT] = float(row[14]) return results