aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services')
-rw-r--r--yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py9
-rw-r--r--yardstick/network_services/traffic_profile/ixia_rfc2544.py12
-rw-r--r--yardstick/network_services/vnf_generic/vnf/sample_vnf.py18
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_landslide.py26
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py3
5 files changed, 53 insertions, 15 deletions
diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
index cf625d483..4fbbf706d 100644
--- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
+++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py
@@ -41,9 +41,6 @@ C_VLAN = 1
ETHER_TYPE_802_1ad = '0x88a8'
-IP_VERSION_4_MASK = 24
-IP_VERSION_6_MASK = 64
-
TRAFFIC_STATUS_STARTED = 'started'
TRAFFIC_STATUS_STOPPED = 'stopped'
@@ -519,8 +516,10 @@ class IxNextgen(object): # pragma: no cover
dstip = str(traffic_param['outer_l3']['dstip'])
srcseed = traffic_param['outer_l3']['srcseed']
dstseed = traffic_param['outer_l3']['dstseed']
- srcmask = traffic_param['outer_l3']['srcmask'] or IP_VERSION_4_MASK
- dstmask = traffic_param['outer_l3']['dstmask'] or IP_VERSION_4_MASK
+ srcmask = traffic_param['outer_l3']['srcmask'] \
+ or ipaddress.IPV4LENGTH
+ dstmask = traffic_param['outer_l3']['dstmask'] \
+ or ipaddress.IPV4LENGTH
self._update_ipv4_address(
self._get_stack_item(fg_id, PROTO_IPV4)[0],
diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
index 44bf2eafc..1bd67555c 100644
--- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py
+++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py
@@ -28,6 +28,8 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
DOWNLINK = 'downlink'
DROP_PERCENT_ROUND = 6
RATE_ROUND = 5
+ STATUS_SUCCESS = "Success"
+ STATUS_FAIL = "Failure"
def __init__(self, yaml_data):
super(IXIARFC2544Profile, self).__init__(yaml_data)
@@ -159,7 +161,7 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
self._ixia_traffic_generate(traffic, ixia_obj)
return first_run
- def get_drop_percentage(self, samples, tol_min, tolerance,
+ def get_drop_percentage(self, samples, tol_min, tolerance, precision,
first_run=False):
completed = False
drop_percent = 100
@@ -193,6 +195,10 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
else:
completed = True
+ LOG.debug("tolerance=%s, tolerance_precision=%s drop_percent=%s "
+ "completed=%s", tolerance, precision, drop_percent,
+ completed)
+
latency_ns_avg = float(
sum([samples[iface]['Store-Forward_Avg_latency_ns']
for iface in samples])) / num_ifaces
@@ -203,6 +209,10 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile):
sum([samples[iface]['Store-Forward_Max_latency_ns']
for iface in samples])) / num_ifaces
+ samples['Status'] = self.STATUS_FAIL
+ if round(drop_percent, precision) <= tolerance:
+ samples['Status'] = self.STATUS_SUCCESS
+
samples['TxThroughput'] = tx_throughput
samples['RxThroughput'] = rx_throughput
samples['DropPercentage'] = drop_percent
diff --git a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
index a09f2a7a9..21719cbf0 100644
--- a/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
+++ b/yardstick/network_services/vnf_generic/vnf/sample_vnf.py
@@ -13,6 +13,7 @@
# limitations under the License.
import logging
+import decimal
from multiprocessing import Queue, Value, Process
import os
import posixpath
@@ -499,6 +500,7 @@ class Rfc2544ResourceHelper(object):
self._rfc2544 = None
self._tolerance_low = None
self._tolerance_high = None
+ self._tolerance_precision = None
@property
def rfc2544(self):
@@ -519,6 +521,12 @@ class Rfc2544ResourceHelper(object):
return self._tolerance_high
@property
+ def tolerance_precision(self):
+ if self._tolerance_precision is None:
+ self.get_rfc_tolerance()
+ return self._tolerance_precision
+
+ @property
def correlated_traffic(self):
if self._correlated_traffic is None:
self._correlated_traffic = \
@@ -537,9 +545,13 @@ class Rfc2544ResourceHelper(object):
def get_rfc_tolerance(self):
tolerance_str = self.get_rfc2544('allowed_drop_rate', self.DEFAULT_TOLERANCE)
- tolerance_iter = iter(sorted(float(t.strip()) for t in tolerance_str.split('-')))
- self._tolerance_low = next(tolerance_iter)
- self._tolerance_high = next(tolerance_iter, self.tolerance_low)
+ tolerance_iter = iter(sorted(
+ decimal.Decimal(t.strip()) for t in tolerance_str.split('-')))
+ tolerance_low = next(tolerance_iter)
+ tolerance_high = next(tolerance_iter, tolerance_low)
+ self._tolerance_precision = abs(tolerance_high.as_tuple().exponent)
+ self._tolerance_high = float(tolerance_high)
+ self._tolerance_low = float(tolerance_low)
class SampleVNFDeployHelper(object):
diff --git a/yardstick/network_services/vnf_generic/vnf/tg_landslide.py b/yardstick/network_services/vnf_generic/vnf/tg_landslide.py
index 157568618..2fba89b22 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_landslide.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_landslide.py
@@ -129,6 +129,17 @@ class LandslideTrafficGen(sample_vnf.SampleVNFTrafficGen):
self.session_profile['reservePorts'] = 'true'
self.session_profile['reservations'] = [reservation]
+ def _update_session_library_name(self, test_session):
+ """Update DMF library name in session profile"""
+ for _ts_group in test_session['tsGroups']:
+ for _tc in _ts_group['testCases']:
+ try:
+ for _mainflow in _tc['parameters']['Dmf']['mainflows']:
+ _mainflow['library'] = \
+ self.vnfd_helper.mgmt_interface['user']
+ except KeyError:
+ pass
+
@staticmethod
def _update_session_tc_params(tc_options, testcase):
for _param_key in tc_options:
@@ -206,6 +217,8 @@ class LandslideTrafficGen(sample_vnf.SampleVNFTrafficGen):
_testcase_idx].update(
self._update_session_tc_params(tc_options, _testcase))
+ self._update_session_library_name(self.session_profile)
+
class LandslideResourceHelper(sample_vnf.ClientResourceHelper):
"""Landslide TG helper class"""
@@ -459,11 +472,14 @@ class LandslideResourceHelper(sample_vnf.ClientResourceHelper):
self._terminated.value = 1
def create_dmf(self, dmf):
- if isinstance(dmf, list):
- for _dmf in dmf:
- self._tcl.create_dmf(_dmf)
- else:
- self._tcl.create_dmf(dmf)
+ if isinstance(dmf, dict):
+ dmf = [dmf]
+ for _dmf in dmf:
+ # Update DMF library name in traffic profile
+ _dmf['dmf'].update(
+ {'library': self.vnfd_helper.mgmt_interface['user']})
+ # Create DMF on Landslide server
+ self._tcl.create_dmf(_dmf)
def delete_dmf(self, dmf):
if isinstance(dmf, list):
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 558a62935..89f8194c0 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -107,6 +107,7 @@ class IxiaResourceHelper(ClientResourceHelper):
min_tol = self.rfc_helper.tolerance_low
max_tol = self.rfc_helper.tolerance_high
+ precision = self.rfc_helper.tolerance_precision
default = "00:00:00:00:00:00"
self._build_ports()
@@ -134,7 +135,7 @@ class IxiaResourceHelper(ClientResourceHelper):
traffic_profile.config.duration)
completed, samples = traffic_profile.get_drop_percentage(
- samples, min_tol, max_tol, first_run=first_run)
+ samples, min_tol, max_tol, precision, first_run=first_run)
self._queue.put(samples)
if completed: