diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-23 17:00:52 +0100 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-07-24 08:59:37 +0100 |
commit | abd5b952f42f429f6f1b59f3f7822cc92da0f6f6 (patch) | |
tree | 8a6519548f08650976ef4c31e16e30177905c39b /yardstick/network_services/traffic_profile | |
parent | 70eef8dd6ef160d3782984742fbc7958a35c03c7 (diff) |
Add IP mask to IxNetwork configuration
Assign the IP mask to IxNetwork configuration, depending on the IP range
provided by the user in the traffic profile. In case of single IP, a
default mask will be provided:
- IP_VERSION_4_MASK = 24
- IP_VERSION_6_MASK = 64
JIRA: YARDSTICK-1351
Change-Id: I029473ab8b9966a76cf559ffef53b34ca11462ad
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/network_services/traffic_profile')
-rw-r--r-- | yardstick/network_services/traffic_profile/ixia_rfc2544.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 49bac27e4..c32e9d8c9 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -14,6 +14,7 @@ import logging +from yardstick.common import utils from yardstick.network_services.traffic_profile import base as tp_base from yardstick.network_services.traffic_profile import trex_traffic_profile @@ -33,6 +34,14 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): self.rate = self.config.frame_rate self.rate_unit = self.config.rate_unit + def _get_ip_and_mask(self, ip_range): + _ip_range = ip_range.split('-') + if len(_ip_range) == 1: + return _ip_range[0], None + + mask = utils.get_mask_from_ip_range(_ip_range[0], _ip_range[1]) + return _ip_range[0], mask + def _get_ixia_traffic_profile(self, profile_data, mac=None): mac = {} if mac is None else mac result = {} @@ -50,14 +59,17 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): port_id = value.get('id', 1) port_index = port_id - 1 - try: - ip = value['outer_l3v6'] - except KeyError: + + if value.get('outer_l3v4'): ip = value['outer_l3v4'] src_key, dst_key = 'srcip4', 'dstip4' else: + ip = value['outer_l3v6'] src_key, dst_key = 'srcip6', 'dstip6' + srcip, srcmask = self._get_ip_and_mask(ip[src_key]) + dstip, dstmask = self._get_ip_and_mask(ip[dst_key]) + result[traffickey] = { 'bidir': False, 'id': port_id, @@ -73,8 +85,10 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): 'count': ip['count'], 'dscp': ip['dscp'], 'ttl': ip['ttl'], - src_key: ip[src_key].split("-")[0], - dst_key: ip[dst_key].split("-")[0], + 'srcip': srcip, + 'dstip': dstip, + 'srcmask': srcmask, + 'dstmask': dstmask, 'type': key, 'proto': ip['proto'], }, |