aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-16 12:20:10 +0100
committerRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-20 11:02:56 +0100
commitb103e6a8544d727ea155ec2c2bc71dbf91a36219 (patch)
tree908282719f2540549d7a2f62a116578596609676 /yardstick/tests
parentf32d9e5e452429905c8099db9b5d4a0fa14dff13 (diff)
Improvie TRex RFC2544 throughput calculation
Improve TRex RFC2544 throughput calculation by using the in/out packets instead of using the throughput samples. JIRA: YARDSTICK-1387 Change-Id: I877e901c3226d31c6435a877a2924bb95deb1cf0 Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/tests')
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py43
1 files changed, 24 insertions, 19 deletions
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
index 2e0331e8e..d0ad77110 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py
@@ -12,8 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import mock
+import datetime
+import mock
from trex_stl_lib import api as Pkt
from trex_stl_lib import trex_stl_client
from trex_stl_lib import trex_stl_packet_builder_scapy
@@ -219,34 +220,38 @@ class TestRFC2544Profile(base.BaseUnitTestCase):
def test_get_drop_percentage(self):
rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE)
samples = [
- {'xe1': {'tx_throughput_fps': 100,
+ {'xe1': {'tx_throughput_fps': 110,
'rx_throughput_fps': 101,
- 'out_packets': 2000,
- 'in_packets': 2010},
- 'xe2': {'tx_throughput_fps': 200,
+ 'out_packets': 2100,
+ 'in_packets': 2010,
+ 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 1)},
+ 'xe2': {'tx_throughput_fps': 210,
'rx_throughput_fps': 201,
- 'out_packets': 4000,
- 'in_packets': 4010}},
- {'xe1': {'tx_throughput_fps': 106,
+ 'out_packets': 4100,
+ 'in_packets': 4010,
+ 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 1)}},
+ {'xe1': {'tx_throughput_fps': 156,
'rx_throughput_fps': 108,
- 'out_packets': 2031,
+ 'out_packets': 2110,
'in_packets': 2040,
- 'latency': 'Latency1'},
- 'xe2': {'tx_throughput_fps': 203,
+ 'latency': 'Latency1',
+ 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 31)},
+ 'xe2': {'tx_throughput_fps': 253,
'rx_throughput_fps': 215,
- 'out_packets': 4025,
- 'in_packets': 4040,
- 'latency': 'Latency2'}}
+ 'out_packets': 4150,
+ 'in_packets': 4010,
+ 'latency': 'Latency2',
+ 'timestamp': datetime.datetime(2000, 1, 1, 1, 1, 1, 31)}}
]
completed, output = rfc2544_profile.get_drop_percentage(
samples, 0, 0, False)
- expected = {'DropPercentage': 0.3963,
+ expected = {'DropPercentage': 50.0,
'Latency': {'xe1': 'Latency1', 'xe2': 'Latency2'},
- 'RxThroughput': 312.5,
- 'TxThroughput': 304.5,
- 'CurrentDropPercentage': 0.3963,
+ 'RxThroughput': 1000000.0,
+ 'TxThroughput': 2000000.0,
+ 'CurrentDropPercentage': 50.0,
'Rate': 100.0,
- 'Throughput': 312.5}
+ 'Throughput': 1000000.0}
self.assertEqual(expected, output)
self.assertFalse(completed)