diff options
-rw-r--r-- | conf/02_vswitch.conf | 5 | ||||
-rw-r--r-- | conf/03_traffic.conf | 4 | ||||
-rw-r--r-- | conf/10_custom.conf | 3 | ||||
-rwxr-xr-x | docs/configguide/installation.rst | 12 | ||||
-rw-r--r-- | docs/configguide/trafficgen.rst | 2 | ||||
-rwxr-xr-x | systems/centos/build_base_machine.sh | 2 | ||||
-rwxr-xr-x | systems/fedora/20/build_base_machine.sh | 6 | ||||
-rwxr-xr-x | systems/fedora/21/build_base_machine.sh | 4 | ||||
-rwxr-xr-x | systems/fedora/22/build_base_machine.sh | 6 | ||||
-rwxr-xr-x | systems/rhel/7.2/build_base_machine.sh | 4 | ||||
-rwxr-xr-x | systems/ubuntu/14.04/build_base_machine.sh | 4 | ||||
-rwxr-xr-x | systems/ubuntu/build_base_machine.sh | 2 | ||||
-rw-r--r-- | tools/hugepages.py | 45 | ||||
-rw-r--r-- | tools/pkt_gen/moongen/moongen.py | 27 | ||||
-rw-r--r-- | tools/pkt_gen/xena/XenaDriver.py | 16 |
15 files changed, 130 insertions, 12 deletions
diff --git a/conf/02_vswitch.conf b/conf/02_vswitch.conf index 79f0afbd..e5736138 100644 --- a/conf/02_vswitch.conf +++ b/conf/02_vswitch.conf @@ -100,6 +100,11 @@ VSWITCH_BRIDGE_NAME = 'br0' # directory where hugepages will be mounted on system init HUGEPAGE_DIR = '/dev/hugepages' +# If no hugepages are available, try to allocate HUGEPAGE_RAM_ALLOCATION. +# Default is 2 x 1048576 = 2097152 kB. +# 10 GB (10485760 kB) or more is recommended for PVP & PVVP testing scenarios. +HUGEPAGE_RAM_ALLOCATION = 2097152 + # Sets OVS PMDs core mask to 30 for affinitization to 5th and 6th CPU core. # Note that the '0x' notation should not be used. VSWITCH_PMD_CPU_MASK = '30' 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/installation.rst b/docs/configguide/installation.rst index c426dcea..048c2675 100755 --- a/docs/configguide/installation.rst +++ b/docs/configguide/installation.rst @@ -42,6 +42,12 @@ download at OPNFV website. vloop-vnf changelog: ==================== +* `vloop-vnf-ubuntu-14.04_20160804`_ + + * Linux kernel 4.4.0 installed + * libnuma-dev installed + * security updates applied + * `vloop-vnf-ubuntu-14.04_20160303`_ * snmpd service is disabled by default to avoid error messages during VM boot @@ -144,6 +150,7 @@ running any of the above. For example: .. _a link: http://www.softwarecollections.org/en/scls/rhscl/python33/ .. _virtualenv: https://virtualenv.readthedocs.org/en/latest/ +.. _vloop-vnf-ubuntu-14.04_20160804: http://artifacts.opnfv.org/vswitchperf/vnf/vloop-vnf-ubuntu-14.04_20160804.qcow2 .. _vloop-vnf-ubuntu-14.04_20160303: http://artifacts.opnfv.org/vswitchperf/vnf/vloop-vnf-ubuntu-14.04_20160303.qcow2 .. _vloop-vnf-ubuntu-14.04_20151216: http://artifacts.opnfv.org/vswitchperf/vnf/vloop-vnf-ubuntu-14.04_20151216.qcow2 @@ -194,3 +201,8 @@ You can review your hugepage amounts by executing the following command .. code:: bash cat /proc/meminfo | grep Huge + +If no hugepages are available vsperf will try to automatically allocate some. +Allocation is controlled by HUGEPAGE_RAM_ALLOCATION configuration parameter in +``02_vswitch.conf`` file. Default is 2GB, resulting in either 2 1GB hugepages +or 1024 2MB hugepages. 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/systems/centos/build_base_machine.sh b/systems/centos/build_base_machine.sh index d3ac3e2b..d94dc975 100755 --- a/systems/centos/build_base_machine.sh +++ b/systems/centos/build_base_machine.sh @@ -58,6 +58,8 @@ zlib-devel glib2-devel pixman-devel socat +numactl +numactl-devel # install gvim vim-X11 diff --git a/systems/fedora/20/build_base_machine.sh b/systems/fedora/20/build_base_machine.sh index 96bb17df..839d2bee 100755 --- a/systems/fedora/20/build_base_machine.sh +++ b/systems/fedora/20/build_base_machine.sh @@ -62,6 +62,10 @@ libreport-python3 abrt-python3 abrt-addon-python3 +# libs +numactl +numactl-devel + # install git-review tool git-review -" | grep -v ^#)
\ No newline at end of file +" | grep -v ^#) diff --git a/systems/fedora/21/build_base_machine.sh b/systems/fedora/21/build_base_machine.sh index 69b067f9..e4969893 100755 --- a/systems/fedora/21/build_base_machine.sh +++ b/systems/fedora/21/build_base_machine.sh @@ -65,6 +65,10 @@ libreport-python3 abrt-python3 abrt-addon-python3 +# libs +numactl +numactl-devel + # install git-review tool git-review " | grep -v ^#) || exit 1 diff --git a/systems/fedora/22/build_base_machine.sh b/systems/fedora/22/build_base_machine.sh index 0ca565f3..3cfe0c78 100755 --- a/systems/fedora/22/build_base_machine.sh +++ b/systems/fedora/22/build_base_machine.sh @@ -66,9 +66,13 @@ libreport-python3 abrt-python3 abrt-addon-python3 +# libs +numactl +numactl-devel + # install git-review tool git-review " | grep -v ^#) # Create hugepage dirs -mkdir -p /dev/hugepages
\ No newline at end of file +mkdir -p /dev/hugepages diff --git a/systems/rhel/7.2/build_base_machine.sh b/systems/rhel/7.2/build_base_machine.sh index 86608066..2319535b 100755 --- a/systems/rhel/7.2/build_base_machine.sh +++ b/systems/rhel/7.2/build_base_machine.sh @@ -50,6 +50,8 @@ pkglist=( socat\ tk-devel\ wget\ + numactl\ + numactl-devel\ ) # python tools for proper QEMU, DPDK, and OVS make @@ -95,4 +97,4 @@ rm -f Python-3.4.2.tar.xz pip3.4 install virtualenv # Create hugepage dirs -mkdir -p /dev/hugepages
\ No newline at end of file +mkdir -p /dev/hugepages diff --git a/systems/ubuntu/14.04/build_base_machine.sh b/systems/ubuntu/14.04/build_base_machine.sh index 9fa8511c..04f4a7e1 100755 --- a/systems/ubuntu/14.04/build_base_machine.sh +++ b/systems/ubuntu/14.04/build_base_machine.sh @@ -77,6 +77,10 @@ python3-tk libpython3.4 python3-reportlab +# libs +libnuma1 +libnuma-dev + # install git-review tool git-review " | grep -v ^#) diff --git a/systems/ubuntu/build_base_machine.sh b/systems/ubuntu/build_base_machine.sh index a2b48a26..1b42a790 100755 --- a/systems/ubuntu/build_base_machine.sh +++ b/systems/ubuntu/build_base_machine.sh @@ -44,6 +44,8 @@ apt-get -y install autoconf libtool apt-get -y install libpcap-dev apt-get -y install libglib2.0 apt-get -y install libfuse-dev +apt-get -y install libnuma1 +apt-get -y install libnuma-dev # Some useful tools you may optionally install #apt-get -y install ctags diff --git a/tools/hugepages.py b/tools/hugepages.py index 3a434d6e..119f94b5 100644 --- a/tools/hugepages.py +++ b/tools/hugepages.py @@ -20,6 +20,7 @@ import re import subprocess import logging import locale +import math from tools import tasks from conf import settings @@ -30,6 +31,46 @@ _LOGGER = logging.getLogger(__name__) # hugepage management # +def get_hugepage_size(): + """Return the size of the configured hugepages + """ + hugepage_size_re = re.compile(r'^Hugepagesize:\s+(?P<size_hp>\d+)\s+kB', + re.IGNORECASE) + with open('/proc/meminfo', 'r') as fh: + data = fh.readlines() + for line in data: + match = hugepage_size_re.search(line) + if match: + _LOGGER.info('Hugepages size: %s', match.group('size_hp')) + return int(match.group('size_hp')) + else: + _LOGGER.error('Could not parse for hugepage size') + return 0 + + + +def allocate_hugepages(): + """Allocate hugepages on the fly + """ + hp_size = get_hugepage_size() + + if hp_size > 0: + nr_hp = int(math.ceil(settings.getValue('HUGEPAGE_RAM_ALLOCATION')/hp_size)) + _LOGGER.info('Will allocate %s hugepages.', nr_hp) + + nr_hugepages = 'vm.nr_hugepages=' + str(nr_hp) + try: + tasks.run_task(['sudo', 'sysctl', nr_hugepages], + _LOGGER, 'Trying to allocate hugepages..', True) + except subprocess.CalledProcessError: + _LOGGER.error('Unable to allocate hugepages.') + return False + return True + + else: + _LOGGER.error('Division by 0 will be supported in next release') + return False + def is_hugepage_available(): """Check if hugepages are available on the system. @@ -47,8 +88,10 @@ def is_hugepage_available(): continue num_huge = result.group('num_hp') - if not num_huge: + if num_huge == '0': _LOGGER.info('No free hugepages.') + if not allocate_hugepages(): + return False else: _LOGGER.info('Found \'%s\' free hugepage(s).', num_huge) return True 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) diff --git a/tools/pkt_gen/xena/XenaDriver.py b/tools/pkt_gen/xena/XenaDriver.py index aa8443c9..d3862312 100644 --- a/tools/pkt_gen/xena/XenaDriver.py +++ b/tools/pkt_gen/xena/XenaDriver.py @@ -1001,9 +1001,21 @@ class XenaTXStats(object): mydict = statdict return mydict - def aggregate_stats(stat1, stat2): """ + Judge whether stat1 and stat2 both have same key, if both have same key, + call the aggregate fuction, else use the stat1's value + """ + newstat = dict() + for keys in stat1.keys(): + if keys in stat2 and isinstance(stat1[keys], dict): + newstat[keys] = aggregate(stat1[keys], stat2[keys]) + else: + newstat[keys] = stat1[keys] + return newstat + +def aggregate(stat1, stat2): + """ Recursive function to aggregate two sets of statistics. This is used when bi directional traffic is done and statistics need to be calculated based on two sets of statistics. @@ -1014,7 +1026,7 @@ def aggregate_stats(stat1, stat2): newstat = dict() for (keys1, keys2) in zip(stat1.keys(), stat2.keys()): if isinstance(stat1[keys1], dict): - newstat[keys1] = aggregate_stats(stat1[keys1], stat2[keys2]) + newstat[keys1] = aggregate(stat1[keys1], stat2[keys2]) else: if not isinstance(stat1[keys1], int) and not isinstance( [keys1], float): |