diff options
author | Serhiy Pshyk <serhiyx.pshyk@intel.com> | 2018-11-19 13:52:11 +0000 |
---|---|---|
committer | Oleksandr Naumets <oleksandrx.naumets@intel.com> | 2018-12-13 16:47:17 +0000 |
commit | e64ab8cb45beb8828e05d66af85033cf02bc4df6 (patch) | |
tree | f01d2f0a75be4686d6d689e9fc2e83f5d534d162 | |
parent | 24700ec3606ca422708646d60fb346d2e0d103cc (diff) |
Add support for configuring frame rate per traffic flow for IXIA
Frame rate can be configured per traffic profile and per traffic flow.
By default traffic profile is applied to all traffic flows. If per
flow rate is specified it overrides default value from profile.
JIRA: YARDSTICK-1568
Change-Id: I388ed78869358de17d6485be0cd0d058983390e2
Signed-off-by: Serhiy Pshyk <serhiyx.pshyk@intel.com>
Signed-off-by: Oleksandr Naumets <oleksandrx.naumets@intel.com>
3 files changed, 16 insertions, 10 deletions
diff --git a/yardstick/network_services/traffic_profile/base.py b/yardstick/network_services/traffic_profile/base.py index ea3f17874..2fdf6ce4a 100644 --- a/yardstick/network_services/traffic_profile/base.py +++ b/yardstick/network_services/traffic_profile/base.py @@ -36,7 +36,7 @@ class TrafficProfileConfig(object): self.description = tp_config.get('description') tprofile = tp_config['traffic_profile'] self.traffic_type = tprofile.get('traffic_type') - self.frame_rate, self.rate_unit = self._parse_rate( + self.frame_rate, self.rate_unit = self.parse_rate( tprofile.get('frame_rate', self.DEFAULT_FRAME_RATE)) self.test_precision = tprofile.get('test_precision') self.packet_sizes = tprofile.get('packet_sizes') @@ -46,7 +46,7 @@ class TrafficProfileConfig(object): self.step_interval = tprofile.get('step_interval') self.enable_latency = tprofile.get('enable_latency', False) - def _parse_rate(self, rate): + def parse_rate(self, rate): """Parse traffic profile rate The line rate can be defined in fps or percentage over the maximum line diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 83d24a412..14edf2d5b 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -78,6 +78,12 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): 'outer_l4': {}, } + frame_rate = value.get('frame_rate') + if frame_rate: + flow_rate, flow_rate_unit = self.config.parse_rate(frame_rate) + result[traffickey]['rate'] = flow_rate + result[traffickey]['rate_unit'] = flow_rate_unit + outer_l2 = value.get('outer_l2') if outer_l2: result[traffickey]['outer_l2'].update({ diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_base.py b/yardstick/tests/unit/network_services/traffic_profile/test_base.py index 0dc3e0579..d9244e31b 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_base.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_base.py @@ -95,18 +95,18 @@ class TrafficProfileConfigTestCase(unittest.TestCase): def test__parse_rate(self): tp_config = {'traffic_profile': {'packet_sizes': {'64B': 100}}} tp_config_obj = base.TrafficProfileConfig(tp_config) - self.assertEqual((100.0, 'fps'), tp_config_obj._parse_rate('100 ')) - self.assertEqual((200.5, 'fps'), tp_config_obj._parse_rate('200.5')) - self.assertEqual((300.8, 'fps'), tp_config_obj._parse_rate('300.8fps')) + self.assertEqual((100.0, 'fps'), tp_config_obj.parse_rate('100 ')) + self.assertEqual((200.5, 'fps'), tp_config_obj.parse_rate('200.5')) + self.assertEqual((300.8, 'fps'), tp_config_obj.parse_rate('300.8fps')) self.assertEqual((400.2, 'fps'), - tp_config_obj._parse_rate('400.2 fps')) - self.assertEqual((500.3, '%'), tp_config_obj._parse_rate('500.3%')) - self.assertEqual((600.1, '%'), tp_config_obj._parse_rate('600.1 %')) + tp_config_obj.parse_rate('400.2 fps')) + self.assertEqual((500.3, '%'), tp_config_obj.parse_rate('500.3%')) + self.assertEqual((600.1, '%'), tp_config_obj.parse_rate('600.1 %')) def test__parse_rate_exception(self): tp_config = {'traffic_profile': {'packet_sizes': {'64B': 100}}} tp_config_obj = base.TrafficProfileConfig(tp_config) with self.assertRaises(exceptions.TrafficProfileRate): - tp_config_obj._parse_rate('100Fps') + tp_config_obj.parse_rate('100Fps') with self.assertRaises(exceptions.TrafficProfileRate): - tp_config_obj._parse_rate('100 kbps') + tp_config_obj.parse_rate('100 kbps') |