aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py')
-rw-r--r--yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py124
1 files changed, 43 insertions, 81 deletions
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..80812876d 100644
--- a/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
+++ b/yardstick/network_services/vnf_generic/vnf/tg_rfc2544_ixia.py
@@ -16,13 +16,8 @@ import ipaddress
import logging
import six
import collections
-import os
-import time
from six import moves
-
-from multiprocessing import Queue, Process, JoinableQueue
-
from yardstick.common import utils
from yardstick.common import exceptions
from yardstick.network_services.libs.ixia_libs.ixnet import ixnet_api
@@ -59,13 +54,13 @@ class IxiaBasicScenario(object):
def stop_protocols(self):
pass
- def create_traffic_model(self, traffic_profile=None):
- # pylint: disable=unused-argument
+ def create_traffic_model(self, traffic_profile):
vports = self.client.get_vports()
self._uplink_vports = vports[::2]
self._downlink_vports = vports[1::2]
self.client.create_traffic_model(self._uplink_vports,
- self._downlink_vports)
+ self._downlink_vports,
+ traffic_profile)
def _get_stats(self):
return self.client.get_statistics()
@@ -85,17 +80,17 @@ class IxiaBasicScenario(object):
min_latency = stats['Store-Forward_Min_latency_ns'][port_num]
max_latency = stats['Store-Forward_Max_latency_ns'][port_num]
samples[port_name] = {
- 'rx_throughput_kps': float(stats['Rx_Rate_Kbps'][port_num]),
- 'tx_throughput_kps': float(stats['Tx_Rate_Kbps'][port_num]),
- 'rx_throughput_mbps': float(stats['Rx_Rate_Mbps'][port_num]),
- 'tx_throughput_mbps': float(stats['Tx_Rate_Mbps'][port_num]),
- 'in_packets': int(stats['Valid_Frames_Rx'][port_num]),
- 'out_packets': int(stats['Frames_Tx'][port_num]),
+ 'RxThroughputBps': float(stats['Bytes_Rx'][port_num]) / duration,
+ 'TxThroughputBps': float(stats['Bytes_Tx'][port_num]) / duration,
+ 'InPackets': int(stats['Valid_Frames_Rx'][port_num]),
+ 'OutPackets': int(stats['Frames_Tx'][port_num]),
+ 'InBytes': int(stats['Bytes_Rx'][port_num]),
+ 'OutBytes': int(stats['Bytes_Tx'][port_num]),
'RxThroughput': float(stats['Valid_Frames_Rx'][port_num]) / duration,
'TxThroughput': float(stats['Frames_Tx'][port_num]) / duration,
- 'Store-Forward_Avg_latency_ns': utils.safe_cast(avg_latency, int, 0),
- 'Store-Forward_Min_latency_ns': utils.safe_cast(min_latency, int, 0),
- 'Store-Forward_Max_latency_ns': utils.safe_cast(max_latency, int, 0)
+ 'LatencyAvg': utils.safe_cast(avg_latency, int, 0),
+ 'LatencyMin': utils.safe_cast(min_latency, int, 0),
+ 'LatencyMax': utils.safe_cast(max_latency, int, 0)
}
except IndexError:
pass
@@ -170,8 +165,7 @@ class IxiaL3Scenario(IxiaBasicScenario):
self._add_interfaces()
self._add_static_ips()
- def create_traffic_model(self, traffic_profile=None):
- # pylint: disable=unused-argument
+ def create_traffic_model(self, traffic_profile):
vports = self.client.get_vports()
self._uplink_vports = vports[::2]
self._downlink_vports = vports[1::2]
@@ -182,7 +176,8 @@ class IxiaL3Scenario(IxiaBasicScenario):
for port in self._downlink_vports]
self.client.create_ipv4_traffic_model(uplink_endpoints,
- downlink_endpoints)
+ downlink_endpoints,
+ traffic_profile)
class IxiaPppoeClientScenario(object):
@@ -221,7 +216,8 @@ class IxiaPppoeClientScenario(object):
uplink_endpoints = self._access_topologies
downlink_endpoints = self._core_topologies
self.client.create_ipv4_traffic_model(uplink_endpoints,
- downlink_endpoints)
+ downlink_endpoints,
+ traffic_profile)
def run_protocols(self):
LOG.info('PPPoE Scenario - Start Protocols')
@@ -524,22 +520,22 @@ class IxiaPppoeClientScenario(object):
avg_latency_ns = sum(
[int(flow['Store-Forward_Avg_latency_ns']) for flow in samples
if flow['IP_Priority'] == priority]) / prio_flows_num
- min_latency_ns = sum(
+ min_latency_ns = min(
[int(flow['Store-Forward_Min_latency_ns']) for flow in samples
- if flow['IP_Priority'] == priority]) / prio_flows_num
- max_latency_ns = sum(
+ if flow['IP_Priority'] == priority])
+ max_latency_ns = max(
[int(flow['Store-Forward_Max_latency_ns']) for flow in samples
- if flow['IP_Priority'] == priority]) / prio_flows_num
+ if flow['IP_Priority'] == priority])
tx_throughput = float(tx_frames) / duration
rx_throughput = float(rx_frames) / duration
results[priority] = {
- 'in_packets': rx_frames,
- 'out_packets': tx_frames,
+ 'InPackets': rx_frames,
+ 'OutPackets': tx_frames,
'RxThroughput': round(rx_throughput, 3),
'TxThroughput': round(tx_throughput, 3),
- 'avg_latency_ns': utils.safe_cast(avg_latency_ns, int, 0),
- 'min_latency_ns': utils.safe_cast(min_latency_ns, int, 0),
- 'max_latency_ns': utils.safe_cast(max_latency_ns, int, 0)
+ 'LatencyAvg': utils.safe_cast(avg_latency_ns, int, 0),
+ 'LatencyMin': utils.safe_cast(min_latency_ns, int, 0),
+ 'LatencyMax': utils.safe_cast(max_latency_ns, int, 0)
}
return results
@@ -600,34 +596,34 @@ class IxiaPppoeClientScenario(object):
flows_stats, flow, 'Store-Forward_Avg_latency_ns'))
for flow in port_flow_map[port_num]]) / len(port_flow_map[port_num])
min_latency = \
- sum([float(self.get_flow_id_data(
+ min([float(self.get_flow_id_data(
flows_stats, flow, 'Store-Forward_Min_latency_ns'))
- for flow in port_flow_map[port_num]]) / len(port_flow_map[port_num])
+ for flow in port_flow_map[port_num]])
max_latency = \
- sum([float(self.get_flow_id_data(
+ max([float(self.get_flow_id_data(
flows_stats, flow, 'Store-Forward_Max_latency_ns'))
- for flow in port_flow_map[port_num]]) / len(port_flow_map[port_num])
+ for flow in port_flow_map[port_num]])
samples[port_name] = {
- 'rx_throughput_kps': float(ports_stats[port_num]['Rx_Rate_Kbps']),
- 'tx_throughput_kps': float(ports_stats[port_num]['Tx_Rate_Kbps']),
- 'rx_throughput_mbps': float(ports_stats[port_num]['Rx_Rate_Mbps']),
- 'tx_throughput_mbps': float(ports_stats[port_num]['Tx_Rate_Mbps']),
- 'in_packets': int(ports_stats[port_num]['Valid_Frames_Rx']),
- 'out_packets': int(ports_stats[port_num]['Frames_Tx']),
+ 'RxThroughputBps': float(ports_stats[port_num]['Bytes_Rx']) / duration,
+ 'TxThroughputBps': float(ports_stats[port_num]['Bytes_Tx']) / duration,
+ 'InPackets': int(ports_stats[port_num]['Valid_Frames_Rx']),
+ 'OutPackets': int(ports_stats[port_num]['Frames_Tx']),
+ 'InBytes': int(ports_stats[port_num]['Bytes_Rx']),
+ 'OutBytes': int(ports_stats[port_num]['Bytes_Tx']),
'RxThroughput': float(ports_stats[port_num]['Valid_Frames_Rx']) / duration,
'TxThroughput': float(ports_stats[port_num]['Frames_Tx']) / duration,
- 'Store-Forward_Avg_latency_ns': utils.safe_cast(avg_latency, int, 0),
- 'Store-Forward_Min_latency_ns': utils.safe_cast(min_latency, int, 0),
- 'Store-Forward_Max_latency_ns': utils.safe_cast(max_latency, int, 0)
+ 'LatencyAvg': utils.safe_cast(avg_latency, int, 0),
+ 'LatencyMin': utils.safe_cast(min_latency, int, 0),
+ 'LatencyMax': utils.safe_cast(max_latency, int, 0)
}
if port_subs_stats:
samples[port_name].update(
- {'sessions_up': int(port_subs_stats[0]['Sessions_Up']),
- 'sessions_down': int(port_subs_stats[0]['Sessions_Down']),
- 'sessions_not_started': int(port_subs_stats[0]['Sessions_Not_Started']),
- 'sessions_total': int(port_subs_stats[0]['Sessions_Total'])}
+ {'SessionsUp': int(port_subs_stats[0]['Sessions_Up']),
+ 'SessionsDown': int(port_subs_stats[0]['Sessions_Down']),
+ 'SessionsNotStarted': int(port_subs_stats[0]['Sessions_Not_Started']),
+ 'SessionsTotal': int(port_subs_stats[0]['Sessions_Total'])}
)
except IndexError:
@@ -843,9 +839,6 @@ class IxiaTrafficGen(SampleVNFTrafficGen):
self._ixia_traffic_gen = None
self.ixia_file_name = ''
self.vnf_port_pairs = []
- self._traffic_process = None
- self._tasks_queue = JoinableQueue()
- self._result_queue = Queue()
def _check_status(self):
pass
@@ -853,34 +846,3 @@ class IxiaTrafficGen(SampleVNFTrafficGen):
def terminate(self):
self.resource_helper.stop_collect()
super(IxiaTrafficGen, self).terminate()
-
- def _test_runner(self, traffic_profile, tasks, results):
- self.resource_helper.run_test(traffic_profile, tasks, results)
-
- def _init_traffic_process(self, traffic_profile):
- name = '{}-{}-{}-{}'.format(self.name, self.APP_NAME,
- traffic_profile.__class__.__name__,
- os.getpid())
- self._traffic_process = Process(name=name, target=self._test_runner,
- args=(
- traffic_profile, self._tasks_queue,
- self._result_queue))
-
- self._traffic_process.start()
- while self.resource_helper.client_started.value == 0:
- time.sleep(1)
- if not self._traffic_process.is_alive():
- break
-
- def run_traffic_once(self, traffic_profile):
- if self.resource_helper.client_started.value == 0:
- self._init_traffic_process(traffic_profile)
-
- # continue test - run next iteration
- LOG.info("Run next iteration ...")
- self._tasks_queue.put('RUN_TRAFFIC')
-
- def wait_on_traffic(self):
- self._tasks_queue.join()
- result = self._result_queue.get()
- return result