aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2015-12-02 10:04:19 +0000
committerMaryam Tahhan <maryam.tahhan@intel.com>2015-12-02 13:48:37 +0000
commit5f98dededf101ce7ee3c11bd41d84ae61cce7feb (patch)
treec8c821f18036dcbcfd4c36ad7c03e4d9f74ab7e4
parent0c292cdcf82ca1d5a71a93c1e1f91cb061a2c6f2 (diff)
vnfs: configurable loopback application support inside VM
For PVP and PVVP deployments, traffic inside virtual machines must be forwarded between its interfaces. There are several forwarding options supported by VSPERF, including DPDK testpmd, Huawei l2fwd kernel module and linux bridge. Another option is, that VM image has built in forwarding functionality and vsperf doesn't configure it itself. User can select VM loopback application by configuration option GUEST_LOOPBACK (per VM) or by SCALAR cli option guest_loopback (global settings). Selected guest loopback application(s) will be written into test results CSV file and test report MD file. Default wildcarded guest login prompt was added. Guest startup guarding timer can be configured. Path to OVS kernel module has been fixed. Change-Id: If738da1ea09112f9cf2267afcbc99a6797f3a03a JIRA: VSPERF-130 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
-rw-r--r--conf/02_vswitch.conf2
-rw-r--r--conf/04_vnf.conf21
-rw-r--r--core/results/results_constants.py1
-rwxr-xr-xdocs/guides/quickstart.rst28
-rw-r--r--src/dpdk/dpdk.py20
-rw-r--r--testcases/testcase.py62
-rw-r--r--vnfs/qemu/qemu.py166
-rw-r--r--vnfs/qemu/qemu_dpdk.py112
-rw-r--r--vnfs/qemu/qemu_dpdk_vhost_cuse.py4
-rw-r--r--vnfs/qemu/qemu_dpdk_vhost_user.py4
-rw-r--r--vnfs/qemu/qemu_virtio_net.py53
11 files changed, 269 insertions, 204 deletions
diff --git a/conf/02_vswitch.conf b/conf/02_vswitch.conf
index 2335b1f1..8085f3ca 100644
--- a/conf/02_vswitch.conf
+++ b/conf/02_vswitch.conf
@@ -71,7 +71,7 @@ VSWITCHD_VANILLA_ARGS = ['--pidfile']
VSWITCH_VANILLA_PHY_PORT_NAMES = ['', '']
# use full module path to load module matching OVS version built from the source
-VSWITCH_VANILLA_KERNEL_MODULES = [os.path.join(ROOT_DIR, 'datapath/linux/openvswitch.ko')]
+VSWITCH_VANILLA_KERNEL_MODULES = [os.path.join(OVS_DIR_VANILLA, 'datapath/linux/openvswitch.ko')]
# Bridge name to be used by VSWTICH
VSWITCH_BRIDGE_NAME = 'br0'
diff --git a/conf/04_vnf.conf b/conf/04_vnf.conf
index 1059482e..2be96859 100644
--- a/conf/04_vnf.conf
+++ b/conf/04_vnf.conf
@@ -31,6 +31,21 @@ GUEST_SHARE_DIR = ['/tmp/qemu0_share', '/tmp/qemu1_share']
# For 2 VNFs you may use ['guest1.img', 'guest2.img']
GUEST_IMAGE = ['', '']
+# guarding timer for VM start up
+# For 2 VNFs you may use [180, 180]
+GUEST_TIMEOUT = [180, 180]
+
+# guest loopback application method; supported options are:
+# 'testpmd' - testpmd from dpdk will be built and used
+# 'l2fwd' - l2fwd module provided by Huawei will be built and used
+# 'linux_bridge' - linux bridge will be configured
+# 'buildin' - nothing will be configured by vsperf; VM image must
+# ensure traffic forwarding between its interfaces
+# This configuration option can be overridden by CLI SCALAR option
+# guest_loopback, e.g. --test-param "guest_loopback=l2fwd"
+# For 2 VNFs you may use ['testpmd', 'l2fwd']
+GUEST_LOOPBACK = ['testpmd', 'testpmd']
+
# username for guest image
GUEST_USERNAME = ''
@@ -38,7 +53,7 @@ GUEST_USERNAME = ''
GUEST_PASSWORD = ''
# login username prompt for guest image
-GUEST_PROMPT_LOGIN = ''
+GUEST_PROMPT_LOGIN = '.* login:'
# login password prompt for guest image
GUEST_PROMPT_PASSWORD = ''
@@ -100,8 +115,8 @@ VANILLA_TGEN_PORT2_MAC = 'AA:BB:CC:DD:EE:F0'
VANILLA_BRIDGE_IP = ['1.1.1.5/16', '1.1.1.6/16']
-VANILLA_NIC1_NAME = ['eth0', 'eth2']
-VANILLA_NIC2_NAME = ['eth1', 'eth3']
+VANILLA_NIC1_NAME = ['eth1', 'eth3']
+VANILLA_NIC2_NAME = ['eth2', 'eth4']
VANILLA_NIC1_IP_CIDR = ['192.168.1.2/24', '192.168.1.4/24']
VANILLA_NIC2_IP_CIDR = ['192.168.1.3/24', '192.168.1.5/24']
diff --git a/core/results/results_constants.py b/core/results/results_constants.py
index 2af3f8d8..263e07a3 100644
--- a/core/results/results_constants.py
+++ b/core/results/results_constants.py
@@ -21,6 +21,7 @@ class ResultsConstants(object):
ID = 'id'
PACKET_SIZE = 'packet_size'
DEPLOYMENT = 'deployment'
+ GUEST_LOOPBACK = 'guest_loopback_app'
UNKNOWN_VALUE = "Unknown"
diff --git a/docs/guides/quickstart.rst b/docs/guides/quickstart.rst
index 7af068d2..b85b3c8a 100755
--- a/docs/guides/quickstart.rst
+++ b/docs/guides/quickstart.rst
@@ -354,6 +354,34 @@ To run tests using Vanilla OVS:
./vsperf --conf-file <path_to_settings_py>
+Selection of loopback application for PVP and PVVP tests
+--------------------------------------------------------
+To select loopback application, which will perform traffic forwarding
+inside VM, following configuration parameter should be configured:
+
+ .. code-block:: console
+
+ GUEST_LOOPBACK = ['testpmd', 'testpmd']
+
+ or use --test-param
+
+ ./vsperf --conf-file user_settings.py
+ --test-param "guest_loopback=testpmd"
+
+Supported loopback applications are:
+
+ .. code-block:: console
+
+ 'testpmd' - testpmd from dpdk will be built and used
+ 'l2fwd' - l2fwd module provided by Huawei will be built and used
+ 'linux_bridge' - linux bridge will be configured
+ 'buildin' - nothing will be configured by vsperf; VM image must
+ ensure traffic forwarding between its interfaces
+
+Guest loopback application must be configured, otherwise traffic
+will not be forwarded by VM and testcases with PVP and PVVP deployments
+will fail. Guest loopback application is set to 'testpmd' by default.
+
Code change verification by pylint
----------------------------------
Every developer participating in VSPERF project should run
diff --git a/src/dpdk/dpdk.py b/src/dpdk/dpdk.py
index e1a8e657..85d0001e 100644
--- a/src/dpdk/dpdk.py
+++ b/src/dpdk/dpdk.py
@@ -52,7 +52,6 @@ def init():
_insert_modules()
_remove_vhost_net()
_bind_nics()
- _copy_dpdk_for_guest()
def cleanup():
@@ -334,25 +333,6 @@ def _unbind_nics():
nic_drivers)
-def _copy_dpdk_for_guest():
- """Copy dpdk code to GUEST_SHARE_DIR[s] for use by guests.
- """
- for guest_dir in settings.getValue('GUEST_SHARE_DIR'):
- guest_share_dir = os.path.join(guest_dir, 'DPDK')
-
- if not os.path.exists(guest_share_dir):
- os.makedirs(guest_share_dir)
-
- try:
- tasks.run_task(['rsync', '-a', '-r', '-l', r'--exclude="\.git"',
- os.path.join(settings.getValue('RTE_SDK'), ''),
- guest_share_dir],
- _LOGGER,
- 'Copying DPDK to shared directory...',
- True)
- except subprocess.CalledProcessError:
- _LOGGER.error('Unable to copy DPDK to shared directory')
-
#
# Vhost-user cleanup
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 608a316b..b3ff2812 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -17,11 +17,13 @@
import csv
import os
import logging
+import subprocess
from collections import OrderedDict
from core.results.results_constants import ResultsConstants
import core.component_factory as component_factory
from core.loader import Loader
+from tools import tasks
from tools.report import report
from conf import settings as S
from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS
@@ -49,6 +51,18 @@ class TestCase(object):
if framerate == None:
framerate = cfg.get('iLoad', 100)
+ # identify guest loopback method, so it can be added into reports
+ self.guest_loopback = []
+ if self.deployment in ['pvp', 'pvvp']:
+ guest_loopback = get_test_param('guest_loopback', None)
+ if guest_loopback:
+ self.guest_loopback.append(guest_loopback)
+ else:
+ if self.deployment == 'pvp':
+ self.guest_loopback.append(S.getValue('GUEST_LOOPBACK')[0])
+ else:
+ self.guest_loopback = S.getValue('GUEST_LOOPBACK').copy()
+
# check if test requires background load and which generator it uses
self._load_cfg = cfg.get('Load', None)
if self._load_cfg and 'tool' in self._load_cfg:
@@ -69,6 +83,13 @@ class TestCase(object):
'multistream': cfg.get('MultiStream', 0),
'frame_rate': int(framerate)})
+ # OVS Vanilla requires guest VM MAC address and IPs to work
+ if 'linux_bridge' in self.guest_loopback:
+ self._traffic['l2'] = {'srcmac': S.getValue('GUEST_NET2_MAC')[0],
+ 'dstmac': S.getValue('GUEST_NET1_MAC')[0]}
+ self._traffic['l3'] = {'srcip': S.getValue('VANILLA_TGEN_PORT1_IP'),
+ 'dstip': S.getValue('VANILLA_TGEN_PORT2_IP')}
+
def run(self):
"""Run the test
@@ -76,13 +97,9 @@ class TestCase(object):
"""
self._logger.debug(self.name)
- # OVS Vanilla requires guest VM MAC address and IPs
- # to work
- if (self.deployment in ["pvp", "pvvp"] and S.getValue('VSWITCH') == "OvsVanilla"):
- self._traffic['l2'] = {'srcmac': S.getValue('GUEST_NET2_MAC')[0],
- 'dstmac': S.getValue('GUEST_NET1_MAC')[0]}
- self._traffic['l3'] = {'srcip': S.getValue('VANILLA_TGEN_PORT1_IP'),
- 'dstip': S.getValue('VANILLA_TGEN_PORT2_IP')}
+ # copy sources of l2 forwarding tools into VM shared dir if needed
+ if 'testpmd' in self.guest_loopback or 'l2fwd' in self.guest_loopback:
+ self._copy_fwd_tools_for_guest()
self._logger.debug("Controllers:")
loader = Loader()
@@ -221,9 +238,40 @@ class TestCase(object):
for item in results:
item[ResultsConstants.ID] = self.name
item[ResultsConstants.DEPLOYMENT] = self.deployment
+ if len(self.guest_loopback):
+ item[ResultsConstants.GUEST_LOOPBACK] = ' '.join(self.guest_loopback)
return results
+ def _copy_fwd_tools_for_guest(self):
+ """Copy dpdk and l2fwd code to GUEST_SHARE_DIR[s] for use by guests.
+ """
+ counter = 0
+ # method is executed only for pvp and pvvp, so let's count number of 'v'
+ while counter < self.deployment.count('v'):
+ guest_dir = S.getValue('GUEST_SHARE_DIR')[counter]
+
+ if not os.path.exists(guest_dir):
+ os.makedirs(guest_dir)
+
+ try:
+ tasks.run_task(['rsync', '-a', '-r', '-l', r'--exclude="\.git"',
+ os.path.join(S.getValue('RTE_SDK'), ''),
+ os.path.join(guest_dir, 'DPDK')],
+ self._logger,
+ 'Copying DPDK to shared directory...',
+ True)
+ tasks.run_task(['rsync', '-a', '-r', '-l',
+ os.path.join(S.getValue('ROOT_DIR'), 'src/l2fwd/'),
+ os.path.join(guest_dir, 'l2fwd')],
+ self._logger,
+ 'Copying l2fwd to shared directory...',
+ True)
+ except subprocess.CalledProcessError:
+ self._logger.error('Unable to copy DPDK and l2fwd to shared directory')
+
+ counter += 1
+
@staticmethod
def _write_result_to_file(results, output):
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index 2e2c63df..4b0bf0b2 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -22,6 +22,7 @@ import re
import subprocess
from conf import settings as S
+from conf import get_test_param
from vnfs.vnf.vnf import IVnf
class IVnfQemu(IVnf):
@@ -48,8 +49,10 @@ class IVnfQemu(IVnf):
self._logfile = os.path.join(
S.getValue('LOG_DIR'),
S.getValue('LOG_FILE_QEMU')) + str(self._number)
- self._timeout = 120
+ self._timeout = S.getValue('GUEST_TIMEOUT')[self._number]
self._monitor = '%s/vm%dmonitor' % ('/tmp', self._number)
+ self._net1 = S.getValue('VANILLA_NIC1_NAME')[self._number]
+ self._net2 = S.getValue('VANILLA_NIC2_NAME')[self._number]
name = 'Client%d' % self._number
vnc = ':%d' % self._number
@@ -59,7 +62,7 @@ class IVnfQemu(IVnf):
'-m', S.getValue('GUEST_MEMORY')[self._number],
'-smp', str(S.getValue('GUEST_SMP')[self._number]),
'-cpu', 'host',
- '-drive', 'if=scsi,file=' +
+ '-drive', 'if=ide,file=' +
S.getValue('GUEST_IMAGE')[self._number],
'-boot', 'c', '--enable-kvm',
'-monitor', 'unix:%s,server,nowait' % self._monitor,
@@ -70,6 +73,9 @@ class IVnfQemu(IVnf):
'-numa', 'node,memdev=mem -mem-prealloc',
'-nographic', '-vnc', str(vnc), '-name', name,
'-snapshot', '-net none', '-no-reboot',
+ '-drive',
+ 'if=ide,file=fat:rw:%s,snapshot=off' %
+ S.getValue('GUEST_SHARE_DIR')[self._number],
]
self._configure_logging()
@@ -99,7 +105,6 @@ class IVnfQemu(IVnf):
self._affinitize()
if self._timeout:
- self._login()
self._config_guest_loopback()
# helper functions
@@ -184,7 +189,21 @@ class IVnfQemu(IVnf):
"""
Configure VM to run VNF (e.g. port forwarding application)
"""
- pass
+ # set guest loopback application based on VNF configuration
+ # cli option take precedence to config file values
+ guest_loopback = get_test_param('guest_loopback', S.getValue('GUEST_LOOPBACK')[self._number])
+ if guest_loopback == 'testpmd':
+ self._login()
+ self._configure_testpmd()
+ elif guest_loopback == 'l2fwd':
+ self._login()
+ self._configure_l2fwd()
+ elif guest_loopback == 'linux_bridge':
+ self._login()
+ self._configure_linux_bridge()
+ elif guest_loopback != 'buildin':
+ self._logger.error('Unsupported guest loopback method "%s" was specified. Option'
+ ' "buildin" will be used as a fallback.', guest_loopback)
def wait(self, prompt=S.getValue('GUEST_PROMPT'), timeout=30):
super(IVnfQemu, self).wait(prompt=prompt, timeout=timeout)
@@ -193,3 +212,142 @@ class IVnfQemu(IVnf):
prompt=S.getValue('GUEST_PROMPT')):
super(IVnfQemu, self).execute_and_wait(cmd, timeout=timeout,
prompt=prompt)
+
+ def _modify_dpdk_makefile(self):
+ """
+ Modifies DPDK makefile in Guest before compilation
+ """
+ pass
+
+ def _configure_copy_sources(self, dirname):
+ """
+ Mount shared directory and copy DPDK and l2fwd sources
+ """
+ # mount shared directory
+ self.execute_and_wait('umount ' + S.getValue('OVS_DPDK_SHARE'))
+ self.execute_and_wait('rm -rf ' + S.getValue('GUEST_OVS_DPDK_DIR'))
+ self.execute_and_wait('mkdir -p ' + S.getValue('OVS_DPDK_SHARE'))
+ self.execute_and_wait('mount -o iocharset=utf8 /dev/sdb1 ' +
+ S.getValue('OVS_DPDK_SHARE'))
+ self.execute_and_wait('mkdir -p ' + S.getValue('GUEST_OVS_DPDK_DIR'))
+ self.execute_and_wait('cp -ra ' + os.path.join(S.getValue('OVS_DPDK_SHARE'), dirname) +
+ ' ' + S.getValue('GUEST_OVS_DPDK_DIR'))
+
+ def _configure_disable_firewall(self):
+ """
+ Disable firewall in VM
+ """
+ # Disable services (F16)
+ self.execute_and_wait('systemctl status iptables.service')
+ self.execute_and_wait('systemctl stop iptables.service')
+
+ def _configure_testpmd(self):
+ """
+ Configure VM to perform L2 forwarding between NICs by DPDK's testpmd
+ """
+ self._configure_copy_sources('DPDK')
+ self._configure_disable_firewall()
+
+ # Guest images _should_ have 1024 hugepages by default,
+ # but just in case:'''
+ self.execute_and_wait('sysctl vm.nr_hugepages=1024')
+
+ # Mount hugepages
+ self.execute_and_wait('mkdir -p /dev/hugepages')
+ self.execute_and_wait(
+ 'mount -t hugetlbfs hugetlbfs /dev/hugepages')
+
+ # build and configure system for dpdk
+ self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
+ '/DPDK')
+ self.execute_and_wait('export CC=gcc')
+ self.execute_and_wait('export RTE_SDK=' +
+ S.getValue('GUEST_OVS_DPDK_DIR') + '/DPDK')
+ self.execute_and_wait('export RTE_TARGET=%s' % S.getValue('RTE_TARGET'))
+
+ # modify makefile if needed
+ self._modify_dpdk_makefile()
+
+ self.execute_and_wait('make RTE_OUTPUT=$RTE_SDK/$RTE_TARGET -C '
+ '$RTE_SDK/lib/librte_eal/linuxapp/igb_uio')
+ self.execute_and_wait('modprobe uio')
+ self.execute_and_wait('insmod %s/kmod/igb_uio.ko' %
+ S.getValue('RTE_TARGET'))
+ self.execute_and_wait('./tools/dpdk_nic_bind.py --status')
+ self.execute_and_wait(
+ './tools/dpdk_nic_bind.py -b igb_uio' ' ' +
+ S.getValue('GUEST_NET1_PCI_ADDRESS')[self._number] + ' ' +
+ S.getValue('GUEST_NET2_PCI_ADDRESS')[self._number])
+
+ # build and run 'test-pmd'
+ self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
+ '/DPDK/app/test-pmd')
+ self.execute_and_wait('make clean')
+ self.execute_and_wait('make')
+ self.execute_and_wait('./testpmd -c 0x3 -n 4 --socket-mem 512 --'
+ ' --burst=64 -i --txqflags=0xf00 ' +
+ '--disable-hw-vlan', 60, "Done")
+ self.execute('set fwd mac_retry', 1)
+ self.execute_and_wait('start', 20,
+ 'TX RS bit threshold=0 - TXQ flags=0xf00')
+
+ def _configure_l2fwd(self):
+ """
+ Configure VM to perform L2 forwarding between NICs by l2fwd module
+ """
+ self._configure_copy_sources('l2fwd')
+ self._configure_disable_firewall()
+
+ # build and configure system for l2fwd
+ self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
+ '/l2fwd')
+ self.execute_and_wait('export CC=gcc')
+
+ self.execute_and_wait('make')
+ self.execute_and_wait('insmod ' + S.getValue('GUEST_OVS_DPDK_DIR') +
+ '/l2fwd' + '/l2fwd.ko net1=' + self._net1 +
+ ' net2=' + self._net2)
+
+ def _configure_linux_bridge(self):
+ """
+ Configure VM to perform L2 forwarding between NICs by linux bridge
+ """
+ self._configure_disable_firewall()
+ nic1_name = get_test_param('vanilla_nic1_name', self._net1)
+ self.execute('ifconfig ' + nic1_name + ' ' +
+ S.getValue('VANILLA_NIC1_IP_CIDR')[self._number])
+
+ nic2_name = get_test_param('vanilla_nic2_name', self._net2)
+ self.execute('ifconfig ' + nic2_name + ' ' +
+ S.getValue('VANILLA_NIC2_IP_CIDR')[self._number])
+
+ # configure linux bridge
+ self.execute('brctl addbr br0')
+ self.execute('brctl addif br0 ' + self._net1 + ' ' + self._net2)
+ self.execute('ifconfig br0 ' +
+ S.getValue('VANILLA_BRIDGE_IP')[self._number])
+
+ # Add the arp entries for the IXIA ports and the bridge you are using.
+ # Use command line values if provided.
+ trafficgen_mac = get_test_param('vanilla_tgen_port1_mac',
+ S.getValue('VANILLA_TGEN_PORT1_MAC'))
+ trafficgen_ip = get_test_param('vanilla_tgen_port1_ip',
+ S.getValue('VANILLA_TGEN_PORT1_IP'))
+
+ self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
+
+ trafficgen_mac = get_test_param('vanilla_tgen_port2_mac',
+ S.getValue('VANILLA_TGEN_PORT2_MAC'))
+ trafficgen_ip = get_test_param('vanilla_tgen_port2_ip',
+ S.getValue('VANILLA_TGEN_PORT2_IP'))
+
+ self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
+
+ # Enable forwarding
+ self.execute('sysctl -w net.ipv4.ip_forward=1')
+
+ # Controls source route verification
+ # 0 means no source validation
+ self.execute('sysctl -w net.ipv4.conf.all.rp_filter=0')
+ self.execute('sysctl -w net.ipv4.conf.' + self._net1 + '.rp_filter=0')
+ self.execute('sysctl -w net.ipv4.conf.' + self._net2 + '.rp_filter=0')
diff --git a/vnfs/qemu/qemu_dpdk.py b/vnfs/qemu/qemu_dpdk.py
deleted file mode 100644
index 02d720f3..00000000
--- a/vnfs/qemu/qemu_dpdk.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright 2015 Intel Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Automation of QEMU hypervisor for launching vhost-cuse enabled guests.
-"""
-
-from vnfs.qemu.qemu import IVnfQemu
-from conf import settings as S
-
-class IVnfQemuDpdk(IVnfQemu):
- """
- An abstract class for controling an instance of QEMU with DPDK vHost support
- """
-
- def __init__(self):
- """
- Initialisation function.
- """
- super(IVnfQemuDpdk, self).__init__()
- self._cmd += ['-drive',
- 'if=scsi,file=fat:rw:%s,snapshot=off' %
- S.getValue('GUEST_SHARE_DIR')[self._number],
- ]
-
- def _modify_dpdk_makefile(self):
- """
- Modifies DPDK makefile in Guest before compilation
- """
- pass
-
- def _config_guest_loopback(self):
- """
- Configure VM to run testpmd
-
- Configure performs the following:
- * Mount hugepages
- * mount shared directory for copying DPDK
- * Disable firewall
- * Compile DPDK
- * DPDK NIC bind
- * Run testpmd
- """
-
- # Guest images _should_ have 1024 hugepages by default,
- # but just in case:'''
- self.execute_and_wait('sysctl vm.nr_hugepages=1024')
-
- # Mount hugepages
- self.execute_and_wait('mkdir -p /dev/hugepages')
- self.execute_and_wait(
- 'mount -t hugetlbfs hugetlbfs /dev/hugepages')
-
- # mount shared directory
- self.execute_and_wait('umount ' + S.getValue('OVS_DPDK_SHARE'))
- self.execute_and_wait('rm -rf ' + S.getValue('GUEST_OVS_DPDK_DIR'))
- self.execute_and_wait('mkdir -p ' + S.getValue('OVS_DPDK_SHARE'))
- self.execute_and_wait('mount -o iocharset=utf8 /dev/sdb1 ' +
- S.getValue('OVS_DPDK_SHARE'))
- self.execute_and_wait('mkdir -p ' + S.getValue('GUEST_OVS_DPDK_DIR'))
- self.execute_and_wait('cp -a ' + S.getValue('OVS_DPDK_SHARE') + '/* ' +
- S.getValue('GUEST_OVS_DPDK_DIR'))
- # Get VM info
- self.execute_and_wait('cat /etc/default/grub')
-
- # Disable services (F16)
- self.execute_and_wait('systemctl status iptables.service')
- self.execute_and_wait('systemctl stop iptables.service')
-
- # build and configure system for dpdk
- self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
- '/DPDK')
- self.execute_and_wait('export CC=gcc')
- self.execute_and_wait('export RTE_SDK=' +
- S.getValue('GUEST_OVS_DPDK_DIR') + '/DPDK')
- self.execute_and_wait('export RTE_TARGET=%s' % S.getValue('RTE_TARGET'))
-
- # modify makefile if needed
- self._modify_dpdk_makefile()
-
- self.execute_and_wait('make RTE_OUTPUT=$RTE_SDK/$RTE_TARGET -C '
- '$RTE_SDK/lib/librte_eal/linuxapp/igb_uio')
- self.execute_and_wait('modprobe uio')
- self.execute_and_wait('insmod %s/kmod/igb_uio.ko' %
- S.getValue('RTE_TARGET'))
- self.execute_and_wait('./tools/dpdk_nic_bind.py --status')
- self.execute_and_wait(
- './tools/dpdk_nic_bind.py -b igb_uio' ' ' +
- S.getValue('GUEST_NET1_PCI_ADDRESS')[self._number] + ' ' +
- S.getValue('GUEST_NET2_PCI_ADDRESS')[self._number])
-
- # build and run 'test-pmd'
- self.execute_and_wait('cd ' + S.getValue('GUEST_OVS_DPDK_DIR') +
- '/DPDK/app/test-pmd')
- self.execute_and_wait('make clean')
- self.execute_and_wait('make')
- self.execute_and_wait('./testpmd -c 0x3 -n 4 --socket-mem 512 --'
- ' --burst=64 -i --txqflags=0xf00 ' +
- '--disable-hw-vlan', 60, "Done")
- self.execute('set fwd mac_retry', 1)
- self.execute_and_wait('start', 20,
- 'TX RS bit threshold=0 - TXQ flags=0xf00')
diff --git a/vnfs/qemu/qemu_dpdk_vhost_cuse.py b/vnfs/qemu/qemu_dpdk_vhost_cuse.py
index e5351813..e5a5e823 100644
--- a/vnfs/qemu/qemu_dpdk_vhost_cuse.py
+++ b/vnfs/qemu/qemu_dpdk_vhost_cuse.py
@@ -18,9 +18,9 @@
import logging
from conf import settings as S
-from vnfs.qemu.qemu_dpdk import IVnfQemuDpdk
+from vnfs.qemu.qemu import IVnfQemu
-class QemuDpdkVhostCuse(IVnfQemuDpdk):
+class QemuDpdkVhostCuse(IVnfQemu):
"""
Control an instance of QEMU with vHost cuse guest communication.
"""
diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py
index 94d87f9e..f0f97d8a 100644
--- a/vnfs/qemu/qemu_dpdk_vhost_user.py
+++ b/vnfs/qemu/qemu_dpdk_vhost_user.py
@@ -18,9 +18,9 @@
import logging
from conf import settings as S
-from vnfs.qemu.qemu_dpdk import IVnfQemuDpdk
+from vnfs.qemu.qemu import IVnfQemu
-class QemuDpdkVhostUser(IVnfQemuDpdk):
+class QemuDpdkVhostUser(IVnfQemu):
"""
Control an instance of QEMU with vHost user guest communication.
"""
diff --git a/vnfs/qemu/qemu_virtio_net.py b/vnfs/qemu/qemu_virtio_net.py
index 7de5ea1c..e5e895f2 100644
--- a/vnfs/qemu/qemu_virtio_net.py
+++ b/vnfs/qemu/qemu_virtio_net.py
@@ -18,7 +18,6 @@
import logging
from vnfs.qemu.qemu import IVnfQemu
from conf import settings as S
-from conf import get_test_param
from tools import tasks
class QemuVirtioNet(IVnfQemu):
@@ -41,8 +40,6 @@ class QemuVirtioNet(IVnfQemu):
i = self._number * 2
if1 = str(i)
if2 = str(i + 1)
- self._net1 = S.getValue('VANILLA_NIC1_NAME')[self._number]
- self._net2 = S.getValue('VANILLA_NIC2_NAME')[self._number]
self._cmd += ['-netdev',
'type=tap,id=' + self._net1 +
@@ -63,53 +60,3 @@ class QemuVirtioNet(IVnfQemu):
',netdev=' + self._net2 + ',csum=off,gso=off,' +
'guest_tso4=off,guest_tso6=off,guest_ecn=off',
]
-
- # helper functions
-
- def _config_guest_loopback(self):
- """
- Configure VM to perform forwarding between NICs
- """
-
- # Disable services (F16)
- self.execute_and_wait('systemctl stop iptables.service')
- self.execute_and_wait('systemctl stop irqbalance.service')
-
- nic1_name = get_test_param('vanilla_nic1_name', self._net1)
- self.execute('ifconfig ' + nic1_name + ' ' +
- S.getValue('VANILLA_NIC1_IP_CIDR')[self._number])
-
- nic2_name = get_test_param('vanilla_nic2_name', self._net2)
- self.execute('ifconfig ' + nic2_name + ' ' +
- S.getValue('VANILLA_NIC2_IP_CIDR')[self._number])
-
- # configure linux bridge
- self.execute('brctl addbr br0')
- self.execute('brctl addif br0 ' + self._net1 + ' ' + self._net2)
- self.execute('ifconfig br0 ' +
- S.getValue('VANILLA_BRIDGE_IP')[self._number])
-
- # Add the arp entries for the IXIA ports and the bridge you are using.
- # Use command line values if provided.
- trafficgen_mac = get_test_param('vanilla_tgen_port1_mac',
- S.getValue('VANILLA_TGEN_PORT1_MAC'))
- trafficgen_ip = get_test_param('vanilla_tgen_port1_ip',
- S.getValue('VANILLA_TGEN_PORT1_IP'))
-
- self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
-
- trafficgen_mac = get_test_param('vanilla_tgen_port2_mac',
- S.getValue('VANILLA_TGEN_PORT2_MAC'))
- trafficgen_ip = get_test_param('vanilla_tgen_port2_ip',
- S.getValue('VANILLA_TGEN_PORT2_IP'))
-
- self.execute('arp -s ' + trafficgen_ip + ' ' + trafficgen_mac)
-
- # Enable forwarding
- self.execute('sysctl -w net.ipv4.ip_forward=1')
-
- # Controls source route verification
- # 0 means no source validation
- self.execute('sysctl -w net.ipv4.conf.all.rp_filter=0')
- self.execute('sysctl -w net.ipv4.conf.' + self._net1 + '.rp_filter=0')
- self.execute('sysctl -w net.ipv4.conf.' + self._net2 + '.rp_filter=0')