diff options
author | Myron Sosyak <myronx.sosyak@intel.com> | 2018-08-02 14:34:03 +0100 |
---|---|---|
committer | Myron Sosyak <myronx.sosyak@intel.com> | 2018-08-02 14:34:53 +0100 |
commit | da33d374ef656da0648059439f2e28a0bfe2f13a (patch) | |
tree | c96e3af6721822c5a3a232d1abeec92d31bdc53f /yardstick/network_services/traffic_profile | |
parent | 0b7647a5a6c85a8a1762ec4482004107989c8550 (diff) |
Add UDP ports configuration to IXIA traffic profile
- Implemented handling of UDP source and destination ports from
IXIA traffic profile.
- UDP ports can be defined as a single value or as a random range.
Ports range is configured with two parameters 'fixed_bits' and
'mask_bits'.
- For example '8-48' range definition will create a repeatable
pattern of four values that fall within the range of 8 and 56.
JIRA: YARDSTICK-1363
Change-Id: I0ace722f6be843ea79c3d3f4de22cb8fa5669d4f
Signed-off-by: Myron Sosyak <myronx.sosyak@intel.com>
Signed-off-by: Pshyk Serhiy <serhiyx.pshyk@intel.com>
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Diffstat (limited to 'yardstick/network_services/traffic_profile')
-rw-r--r-- | yardstick/network_services/traffic_profile/ixia_rfc2544.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 43455330f..056f32a57 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -42,6 +42,13 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): mask = utils.get_mask_from_ip_range(_ip_range[0], _ip_range[1]) return _ip_range[0], mask + def _get_fixed_and_mask(self, port_range): + _port_range = str(port_range).split('-') + if len(_port_range) == 1: + return int(_port_range[0]), 0 + + return int(_port_range[0]), int(_port_range[1]) + def _get_ixia_traffic_profile(self, profile_data, mac=None): mac = {} if mac is None else mac result = {} @@ -70,6 +77,9 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): srcip, srcmask = self._get_ip_and_mask(ip[src_key]) dstip, dstmask = self._get_ip_and_mask(ip[dst_key]) + outer_l4 = value.get('outer_l4') + src_port, src_port_mask = self._get_fixed_and_mask(outer_l4['srcport']) + dst_port, dst_port_mask = self._get_fixed_and_mask(outer_l4['dstport']) result[traffickey] = { 'bidir': False, 'id': port_id, @@ -92,7 +102,15 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): 'type': key, 'proto': ip['proto'], }, - 'outer_l4': value['outer_l4'], + 'outer_l4': { + 'srcport': src_port, + 'dstport': dst_port, + 'srcportmask': src_port_mask, + 'dstportmask': dst_port_mask, + 'count': outer_l4['count'], + 'seed': outer_l4['seed'], + } + } except KeyError: continue @@ -102,6 +120,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): def _ixia_traffic_generate(self, traffic, ixia_obj): ixia_obj.update_frame(traffic, self.config.duration) ixia_obj.update_ip_packet(traffic) + ixia_obj.update_l4(traffic) ixia_obj.start_traffic() def update_traffic_profile(self, traffic_generator): |