aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-08-21 14:45:20 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-08-21 14:45:20 +0000
commit5c6666157a113cae7b5ab52297b8bc482d8484e0 (patch)
tree1f616f7c7edf95bec7ea05d579c21ab8dcc25e4a /yardstick/tests
parent95c0824278c2e273a3017b7c9b8cf6a026950f74 (diff)
parentb103e6a8544d727ea155ec2c2bc71dbf91a36219 (diff)
Merge "Improvie TRex RFC2544 throughput calculation"
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 20f67d71a..cfeebaa3a 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
@@ -220,34 +221,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)