summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/pkt_gen/dummy/dummy.py35
-rw-r--r--tools/pkt_gen/moongen/moongen.py4
-rw-r--r--tools/pkt_gen/xena/XenaDriver.py28
-rwxr-xr-xtools/pkt_gen/xena/xena.py22
-rw-r--r--tools/report/report.jinja1
5 files changed, 82 insertions, 8 deletions
diff --git a/tools/pkt_gen/dummy/dummy.py b/tools/pkt_gen/dummy/dummy.py
index 3324824c..528b5902 100755
--- a/tools/pkt_gen/dummy/dummy.py
+++ b/tools/pkt_gen/dummy/dummy.py
@@ -25,6 +25,7 @@ own.
import json
+from conf import settings
from tools.pkt_gen import trafficgen
from core.results.results_constants import ResultsConstants
@@ -76,7 +77,10 @@ def get_user_traffic(traffic_type, traffic_conf, flow_conf, traffic_stats):
% (traffic_type, traffic_conf, json.dumps(flow_conf, indent=4)))
for stat in traffic_stats:
- results.append(_get_user_traffic_stat(stat))
+ if stat in settings.getValue('TRAFFICGEN_DUMMY_RESULTS'):
+ results.append(settings.getValue('TRAFFICGEN_DUMMY_RESULTS')[stat])
+ else:
+ results.append(_get_user_traffic_stat(stat))
return results
@@ -206,6 +210,33 @@ class Dummy(trafficgen.ITrafficGenerator):
result[ResultsConstants.FRAME_LOSS_PERCENT] = float(results[7])
return result
+ def send_rfc2544_back2back(self, traffic=None, tests=1, duration=2,
+ lossrate=0.0):
+ """
+ Send traffic per RFC2544 back2back test specifications.
+ """
+ traffic_ = self.traffic_defaults.copy()
+ result = {}
+
+ if traffic:
+ traffic_ = trafficgen.merge_spec(traffic_, traffic)
+
+ results = get_user_traffic(
+ 'back2back',
+ '%d tests, %d seconds iterations, %f packet loss, multistream '
+ '%s' % (tests, duration, lossrate, traffic['multistream']),
+ traffic_,
+ ('b2b frames', 'b2b frame loss %'))
+
+ framesize = traffic_['l2']['framesize']
+
+ # builds results by using user-supplied values
+ # and guessing remainder using available info
+ result[ResultsConstants.B2B_FRAMES] = float(results[0])
+ result[ResultsConstants.B2B_FRAME_LOSS_PERCENT] = float(results[1])
+ return result
+
+
if __name__ == '__main__':
TRAFFIC = {
@@ -219,4 +250,6 @@ if __name__ == '__main__':
with Dummy() as dev:
print(dev.send_burst_traffic(traffic=TRAFFIC))
print(dev.send_cont_traffic(traffic=TRAFFIC))
+ print(dev.send_rfc2544_throughput(traffic=TRAFFIC))
+ print(dev.send_rfc2544_back2back(traffic=TRAFFIC))
print(dev.send_rfc(traffic=TRAFFIC))
diff --git a/tools/pkt_gen/moongen/moongen.py b/tools/pkt_gen/moongen/moongen.py
index fe3aca52..7fd67661 100644
--- a/tools/pkt_gen/moongen/moongen.py
+++ b/tools/pkt_gen/moongen/moongen.py
@@ -222,7 +222,7 @@ class Moongen(ITrafficGenerator):
"@" + self._moongen_host_ip_addr
cmd_find_moongen = connect_moongen + " ls " + \
- self._moongen_base_dir + "/examples/opnfv-vsperf.lua"
+ self._moongen_base_dir + "/trafficgen.lua"
find_moongen = subprocess.Popen(cmd_find_moongen,
shell=True,
@@ -367,7 +367,7 @@ class Moongen(ITrafficGenerator):
self._moongen_host_ip_addr
cmd_moongen = " 'cd " + self._moongen_base_dir + \
- "; ./build/MoonGen examples/opnfv-vsperf.lua | tee moongen_log.txt'"
+ "; ./MoonGen/build/MoonGen trafficgen.lua | tee moongen_log.txt'"
cmd_start_moongen = connect_moongen + cmd_moongen
diff --git a/tools/pkt_gen/xena/XenaDriver.py b/tools/pkt_gen/xena/XenaDriver.py
index d3862312..04a99e9d 100644
--- a/tools/pkt_gen/xena/XenaDriver.py
+++ b/tools/pkt_gen/xena/XenaDriver.py
@@ -61,6 +61,10 @@ CMD_RESERVE = 'p_reservation reserve'
CMD_RELEASE = 'p_reservation release'
CMD_RELINQUISH = 'p_reservation relinquish'
CMD_RESET = 'p_reset'
+CMD_SET_PORT_ARP_REPLY = 'p_arpreply'
+CMD_SET_PORT_ARP_V6_REPLY = 'p_arpv6reply'
+CMD_SET_PORT_PING_REPLY = 'p_pingreply'
+CMD_SET_PORT_PING_V6_REPLY = 'p_pingv6reply'
CMD_SET_PORT_TIME_LIMIT = 'p_txtimelimit'
CMD_SET_STREAM_HEADER_PROTOCOL = 'ps_headerprotocol'
CMD_SET_STREAM_ON_OFF = 'ps_enable'
@@ -532,6 +536,30 @@ class XenaPort(object):
command = make_port_command(CMD_RESET, self)
return self._manager.driver.ask_verify(command)
+ def set_port_arp_reply(self, on=True, v6=False):
+ """
+ Set the port arpreply value
+ :param on: Enable or disable the arp reply on the port
+ :param v6: set the value on the ip v6, disabled will set at ip v4
+ :return: Boolean True if response OK, False if error
+ """
+ command = make_port_command('{} {}'.format(
+ CMD_SET_PORT_ARP_V6_REPLY if v6 else CMD_SET_PORT_ARP_REPLY,
+ "on" if on else "off"), self)
+ return self._manager.driver.ask_verify(command)
+
+ def set_port_ping_reply(self, on=True, v6=False):
+ """
+ Set the port ping reply value
+ :param on: Enable or disable the ping reply on the port
+ :param v6: set the value on the ip v6, disabled will set at ip v4
+ :return: Boolean True if response OK, False if error
+ """
+ command = make_port_command('{} {}'.format(
+ CMD_SET_PORT_PING_V6_REPLY if v6 else CMD_SET_PORT_PING_REPLY,
+ "on" if on else "off"), self)
+ return self._manager.driver.ask_verify(command)
+
def set_port_ip(self, ip_addr, cidr, gateway, wild='255'):
"""
Set the port ip address of the specific port
diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py
index 8d45053e..798bb832 100755
--- a/tools/pkt_gen/xena/xena.py
+++ b/tools/pkt_gen/xena/xena.py
@@ -421,7 +421,20 @@ class Xena(ITrafficGenerator):
:return: None
"""
stream.set_on()
- stream.set_packet_limit(packet_limit)
+ if packet_limit != -1:
+ stream.set_packet_limit(packet_limit)
+ else:
+ speed = port.get_port_speed() / 8 # convert to bytes
+ gap = port.get_inter_frame_gap()
+ pkt_size = self._params['traffic']['l2']['framesize']
+ packets = int(((speed / (pkt_size + gap)) * self._duration) *
+ (self._params['traffic']['frame_rate'] / 100))
+ stream.set_packet_limit(packets)
+
+ port.set_port_arp_reply(on=True)
+ port.set_port_arp_reply(on=True, v6=True)
+ port.set_port_ping_reply(on=True)
+ port.set_port_ping_reply(on=True, v6=True)
stream.set_rate_fraction(
10000 * self._params['traffic']['frame_rate'])
@@ -431,10 +444,11 @@ class Xena(ITrafficGenerator):
'ETHERNET VLAN IP UDP' if self._params['traffic']['vlan'][
'enabled'] else 'ETHERNET IP UDP')
stream.set_packet_length(
- 'fixed', self._params['traffic']['l2']['framesize'], 16383)
+ 'fixed', self._params['traffic']['l2']['framesize'],
+ self._params['traffic']['l2']['framesize'])
stream.set_packet_payload('incrementing', '0x00')
stream.set_payload_id(payload_id)
- port.set_port_time_limit(self._duration * 1000000)
+ port.set_port_time_limit(0)
if self._params['traffic']['l2']['framesize'] == 64:
# set micro tpld
@@ -459,7 +473,7 @@ class Xena(ITrafficGenerator):
if not self.xmanager.ports[1].traffic_on():
self._logger.error(
"Failure to start port 1. Check settings and retry.")
- sleep(self._duration)
+ sleep(self._duration + 1)
# getting results
if self._params['traffic']['bidir'] == 'True':
# need to aggregate out both ports stats and assign that data
diff --git a/tools/report/report.jinja b/tools/report/report.jinja
index 8354835c..c9588565 100644
--- a/tools/report/report.jinja
+++ b/tools/report/report.jinja
@@ -138,7 +138,6 @@ The following are the metrics obtained during this test:
The following system statistics were collected during testcase execution:
{% for process in test.stats %}
-| --------------------------------------------------------------- |
| Process: {{ "%-54s |"|format('_'.join(process.split('_')[:-1])) }}
| ------------------------------ | ------------------------------ |
| Statistic | Value |