aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorVolodymyr Mytnyk <volodymyrx.mytnyk@intel.com>2019-02-07 08:54:33 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-02-07 08:54:33 +0000
commit155d5fd7d8c3d0b69d79efca67946fa26f7ef37f (patch)
treee2163a602ca07c6eea2fd833f0e800d05ea08dac /yardstick
parent964e1564636bf75dacf3b44cd48f9fd516024fd3 (diff)
parente36115b1d2a6718eddab570709b694996103853d (diff)
Merge "Extend IXIA RFC2544 test case collected stats"
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py19
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py1
-rw-r--r--yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py56
-rw-r--r--yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py6
4 files changed, 79 insertions, 3 deletions
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
index 89bb3ef7a..e3ac4f833 100644
--- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py
+++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
@@ -175,6 +175,19 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
rate = round(float(self.max_rate + self.min_rate)/2.0, self.RATE_ROUND)
return rate
+ def _get_framesize(self):
+ framesizes = []
+ traffic = self._get_ixia_traffic_profile(self.full_profile)
+ for v in traffic.values():
+ framesize = v['outer_l2']['framesize']
+ for size in (s for s, w in framesize.items() if int(w) != 0):
+ framesizes.append(size)
+ if len(set(framesizes)) == 0:
+ return ''
+ elif len(set(framesizes)) == 1:
+ return framesizes[0]
+ return 'IMIX'
+
def execute_traffic(self, traffic_generator, ixia_obj=None, mac=None):
mac = {} if mac is None else mac
first_run = self.first_run
@@ -225,6 +238,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
else:
completed = True
+ last_rate = self.rate
next_rate = self._get_next_rate()
if abs(next_rate - self.rate) < resolution:
LOG.debug("rate=%s, next_rate=%s, resolution=%s", self.rate,
@@ -257,6 +271,8 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
samples['latency_ns_avg'] = latency_ns_avg
samples['latency_ns_min'] = latency_ns_min
samples['latency_ns_max'] = latency_ns_max
+ samples['Rate'] = last_rate
+ samples['PktSize'] = self._get_framesize()
return completed, samples
@@ -332,6 +348,7 @@ class IXIARFC2544PppoeScenarioProfile(IXIARFC2544Profile):
sum_drop_percent = 100
num_ifaces = len(samples)
duration = self.config.duration
+ last_rate = self.rate
priority_stats = samples.pop('priority_stats')
priority_stats = self._get_prio_flows_drop_percentage(priority_stats)
summary_subs_stats = self._get_summary_pppoe_subs_counters(samples)
@@ -367,6 +384,8 @@ class IXIARFC2544PppoeScenarioProfile(IXIARFC2544Profile):
samples['latency_ns_min'] = latency_ns_min
samples['latency_ns_max'] = latency_ns_max
samples['priority'] = priority_stats
+ samples['Rate'] = last_rate
+ samples['PktSize'] = self._get_framesize()
samples.update(summary_subs_stats)
if tc_rfc2544_opts:
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
index f8eec4f4c..d3a2d9443 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -813,6 +813,7 @@ class IxiaResourceHelper(ClientResourceHelper):
completed, samples = traffic_profile.get_drop_percentage(
samples, min_tol, max_tol, precision, resolution,
first_run=first_run)
+ samples['Iteration'] = self.rfc_helper.iteration.value
self._queue.put(samples)
if completed:
diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
index a71a240a2..38d13c385 100644
--- a/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
+++ b/yardstick/tests/unit/network_services/traffic_profile/test_ixia_rfc2544.py
@@ -515,6 +515,52 @@ class TestIXIARFC2544Profile(unittest.TestCase):
rfc2544_profile._update_traffic_tracking_options(mock_traffic_gen)
mock_traffic_gen.update_tracking_options.assert_called_once()
+ def test__get_framesize(self):
+ traffic_profile = {
+ 'uplink_0': {'outer_l2': {'framesize': {'64B': 100}}},
+ 'downlink_0': {'outer_l2': {'framesize': {'64B': 100}}},
+ 'uplink_1': {'outer_l2': {'framesize': {'64B': 100}}},
+ 'downlink_1': {'outer_l2': {'framesize': {'64B': 100}}}
+ }
+ rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \
+ as mock_get_tp:
+ mock_get_tp.return_value = traffic_profile
+ result = rfc2544_profile._get_framesize()
+ self.assertEqual(result, '64B')
+
+ def test__get_framesize_IMIX_traffic(self):
+ traffic_profile = {
+ 'uplink_0': {'outer_l2': {'framesize': {'64B': 50,
+ '128B': 50}}},
+ 'downlink_0': {'outer_l2': {'framesize': {'64B': 50,
+ '128B': 50}}},
+ 'uplink_1': {'outer_l2': {'framesize': {'64B': 50,
+ '128B': 50}}},
+ 'downlink_1': {'outer_l2': {'framesize': {'64B': 50,
+ '128B': 50}}}
+ }
+ rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \
+ as mock_get_tp:
+ mock_get_tp.return_value = traffic_profile
+ result = rfc2544_profile._get_framesize()
+ self.assertEqual(result, 'IMIX')
+
+ def test__get_framesize_zero_pkt_size_weight(self):
+ traffic_profile = {
+ 'uplink_0': {'outer_l2': {'framesize': {'64B': 0}}},
+ 'downlink_0': {'outer_l2': {'framesize': {'64B': 0}}},
+ 'uplink_1': {'outer_l2': {'framesize': {'64B': 0}}},
+ 'downlink_1': {'outer_l2': {'framesize': {'64B': 0}}}
+ }
+ rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ with mock.patch.object(rfc2544_profile, '_get_ixia_traffic_profile') \
+ as mock_get_tp:
+ mock_get_tp.return_value = traffic_profile
+ result = rfc2544_profile._get_framesize()
+ self.assertEqual(result, '')
+
def test_execute_traffic_first_run(self):
rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
rfc2544_profile.first_run = True
@@ -594,7 +640,9 @@ class TestIXIARFC2544Profile(unittest.TestCase):
'Store-Forward_Max_latency_ns': 28}
}
rfc2544_profile = ixia_rfc2544.IXIARFC2544Profile(self.TRAFFIC_PROFILE)
+ rfc2544_profile.rate = 100.0
rfc2544_profile._get_next_rate = mock.Mock(return_value=100.0)
+ rfc2544_profile._get_framesize = mock.Mock(return_value='64B')
completed, samples = rfc2544_profile.get_drop_percentage(
samples, 0, 1, 4, 0.1)
self.assertTrue(completed)
@@ -604,6 +652,8 @@ class TestIXIARFC2544Profile(unittest.TestCase):
self.assertEqual(21.5, samples['latency_ns_avg'])
self.assertEqual(14.0, samples['latency_ns_min'])
self.assertEqual(26.5, samples['latency_ns_max'])
+ self.assertEqual(100.0, samples['Rate'])
+ self.assertEqual('64B', samples['PktSize'])
def test_get_drop_percentage_over_drop_percentage(self):
samples = {'iface_name_1':
@@ -751,7 +801,8 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase):
def setUp(self):
self.ixia_tp = ixia_rfc2544.IXIARFC2544PppoeScenarioProfile(
self.TRAFFIC_PROFILE)
- self.ixia_tp._get_next_rate = mock.Mock(return_value=0.1)
+ self.ixia_tp.rate = 100.0
+ self.ixia_tp._get_next_rate = mock.Mock(return_value=50.0)
def test___init__(self):
self.assertIsInstance(self.ixia_tp.full_profile,
@@ -861,6 +912,7 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase):
mock_get_pppoe_subs.return_value = {'sessions_up': 1}
mock_sum_prio_drop_rate.return_value = {'0': {'DropPercentage': 0.0}}
+ self.ixia_tp._get_framesize = mock.Mock(return_value='64B')
status, res = self.ixia_tp.get_drop_percentage(
samples, tol_min=0.0, tolerance=0.0001, precision=0,
resolution=0.1, first_run=True)
@@ -868,6 +920,8 @@ class TestIXIARFC2544PppoeScenarioProfile(unittest.TestCase):
self.assertIsNotNone(res.get('priority'))
self.assertIsNotNone(res.get('sessions_up'))
self.assertEqual(res['DropPercentage'], 0.0)
+ self.assertEqual(res['Rate'], 100.0)
+ self.assertEqual(res['PktSize'], '64B')
self.assertTrue(status)
mock_sum_prio_drop_rate.assert_called_once()
mock_get_pppoe_subs.assert_called_once()
diff --git a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
index 9db8b7b00..ccf077220 100644
--- a/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
+++ b/yardstick/tests/unit/network_services/vnf_generic/vnf/test_tg_rfc2544_ixia.py
@@ -110,9 +110,11 @@ class TestIxiaResourceHelper(unittest.TestCase):
mock_tprofile.update_traffic_profile.assert_called_once()
def test_run_test(self):
+ expected_result = {'test': 'fake_samples', 'Iteration': 1}
mock_tprofile = mock.Mock()
mock_tprofile.config.duration = 10
- mock_tprofile.get_drop_percentage.return_value = True, 'fake_samples'
+ mock_tprofile.get_drop_percentage.return_value = \
+ True, {'test': 'fake_samples'}
ixia_rhelper = tg_rfc2544_ixia.IxiaResourceHelper(mock.Mock())
tasks_queue = mock.Mock()
tasks_queue.get.return_value = 'RUN_TRAFFIC'
@@ -127,7 +129,7 @@ class TestIxiaResourceHelper(unittest.TestCase):
mock.patch.object(utils, 'wait_until_true'):
ixia_rhelper.run_test(mock_tprofile, tasks_queue, results_queue)
- self.assertEqual('fake_samples', ixia_rhelper._queue.get())
+ self.assertEqual(expected_result, ixia_rhelper._queue.get())
mock_tprofile.update_traffic_profile.assert_called_once()
tasks_queue.task_done.assert_called_once()
results_queue.put.assert_called_once_with('COMPLETE')