diff options
author | Martin Klozik <martinx.klozik@intel.com> | 2015-12-02 10:04:19 +0000 |
---|---|---|
committer | Maryam Tahhan <maryam.tahhan@intel.com> | 2015-12-02 13:48:37 +0000 |
commit | 5f98dededf101ce7ee3c11bd41d84ae61cce7feb (patch) | |
tree | c8c821f18036dcbcfd4c36ad7c03e4d9f74ab7e4 /testcases | |
parent | 0c292cdcf82ca1d5a71a93c1e1f91cb061a2c6f2 (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>
Diffstat (limited to 'testcases')
-rw-r--r-- | testcases/testcase.py | 62 |
1 files changed, 55 insertions, 7 deletions
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): |