summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaryam Tahhan <maryam.tahhan@intel.com>2016-08-05 10:36:51 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-08-05 10:36:51 +0000
commit236073f3963ee4dc038eea3b42d60644ebfc703f (patch)
treefe3da3e1b8d92a912f8ff46934d0073d4eca39fd
parentbf43287f11e85143148e5be6c81b7e9894652eac (diff)
parent4c8f968b405c065fec0a4b8ac41ab164d5189241 (diff)
Merge "pkt_gen: MoonGen start rates not correct"
-rw-r--r--conf/03_traffic.conf4
-rw-r--r--conf/10_custom.conf3
-rw-r--r--docs/configguide/trafficgen.rst2
-rw-r--r--tools/pkt_gen/moongen/moongen.py27
4 files changed, 30 insertions, 6 deletions
diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf
index fb9ce837..a5a8629d 100644
--- a/conf/03_traffic.conf
+++ b/conf/03_traffic.conf
@@ -182,10 +182,14 @@ TRAFFICGEN_XENA_PORT1_GATEWAY = '192.168.199.1'
###################################################
# MoonGen Configuration and Connection Info-- BEGIN
+# Ex: TRAFFICGEN_MOONGEN_HOST_IP_ADDR = "192.10.1.1"
TRAFFICGEN_MOONGEN_HOST_IP_ADDR = ''
TRAFFICGEN_MOONGEN_USER = ''
TRAFFICGEN_MOONGEN_BASE_DIR = ''
TRAFFICGEN_MOONGEN_PORTS = ''
+# Ex. 10 Gbps: TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS = '10'
+# Today only 10 Gbps is supported
+TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS = ''
# MoonGen Configuration and Connection Info-- END
###################################################
diff --git a/conf/10_custom.conf b/conf/10_custom.conf
index 044339fc..fdb5031a 100644
--- a/conf/10_custom.conf
+++ b/conf/10_custom.conf
@@ -87,6 +87,9 @@ TRAFFICGEN_MOONGEN_HOST_IP_ADDR = ""
TRAFFICGEN_MOONGEN_USER = "root"
TRAFFICGEN_MOONGEN_BASE_DIR = "/root/MoonGen"
TRAFFICGEN_MOONGEN_PORTS = "{0,1}"
+# Ex. 10 Gbps: TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS = '10'
+# Today only 10 Gbps is supported
+TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS = '10'
# MoonGen Configuration and Connection Info-- END
###################################################
diff --git a/docs/configguide/trafficgen.rst b/docs/configguide/trafficgen.rst
index 7b2944e9..302a8d5e 100644
--- a/docs/configguide/trafficgen.rst
+++ b/docs/configguide/trafficgen.rst
@@ -385,6 +385,8 @@ can be found here:
https://github.com/emmericp/MoonGen
+* Note: Today, MoonGen with VSPERF only supports 10Gbps line speeds.
+
For VSPerf use, MoonGen should be cloned from here (as opposed to the afore
mentioned GitHub):
diff --git a/tools/pkt_gen/moongen/moongen.py b/tools/pkt_gen/moongen/moongen.py
index efd8e004..e14c6a79 100644
--- a/tools/pkt_gen/moongen/moongen.py
+++ b/tools/pkt_gen/moongen/moongen.py
@@ -20,10 +20,11 @@ Moongen Traffic Generator Model
"""
# python imports
-import logging
from collections import OrderedDict
-import subprocess
+import logging
+import math
import re
+import subprocess
# VSPerf imports
from conf import settings
@@ -49,6 +50,13 @@ class Moongen(ITrafficGenerator):
self._moongen_user = settings.getValue('TRAFFICGEN_MOONGEN_USER')
self._moongen_ports = settings.getValue('TRAFFICGEN_MOONGEN_PORTS')
+ if settings.getValue('TRAFFICGEN_MOONGEN_LINE_SPEED_GBPS') == '10':
+ self._moongen_line_speed = math.pow(10, 10)
+ else:
+ raise RuntimeError(
+ 'MOONGEN: Invalid line speed in configuration ' + \
+ 'file (today 10Gbps supported)')
+
@property
def traffic_defaults(self):
"""Default traffic values.
@@ -157,10 +165,17 @@ class Moongen(ITrafficGenerator):
if one_shot:
out_file.write("oneShot = true,\n")
- # Assume 10G line rates at the moment. Need to convert VSPERF
- # frame_rate (percentage of line rate) to Mpps for Moongen
+ # Need to convert VSPERF frame_rate (percentage of line rate)
+ # to Mpps for Moongen
+ start_rate = str(
+ (traffic['frame_rate'] / 100) * (self._moongen_line_speed / \
+ (8 * (traffic['l2']['framesize'] + 20)) / math.pow(10, 6)))
+
+ logging.debug("startRate = " + start_rate)
+
+ out_file.write("startRate = " + \
+ start_rate + "\n")
- out_file.write("startRate = " + str((traffic['frame_rate'] / 100) * 14.88) + "\n")
out_file.write("}" + "\n")
out_file.close()
@@ -476,7 +491,7 @@ class Moongen(ITrafficGenerator):
if results_match and parameters_match:
# Assume for now 10G link speed
max_theoretical_mfps = (
- (10000000000 / 8) / (frame_size + 20))
+ (self._moongen_line_speed / 8) / (frame_size + 20))
moongen_results[ResultsConstants.THROUGHPUT_RX_FPS] = (
float(results_match.group(6)) * 1000000)