aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rw-r--r--testcases/README.md (renamed from testcases/README)5
-rw-r--r--testcases/performance.py3
-rw-r--r--testcases/testcase.py47
3 files changed, 25 insertions, 30 deletions
diff --git a/testcases/README b/testcases/README.md
index be6ffae2..9a1eec49 100644
--- a/testcases/README
+++ b/testcases/README.md
@@ -1,3 +1,8 @@
+<!---
+This work is licensed under a Creative Commons Attribution 4.0 International License.
+http://creativecommons.org/licenses/by/4.0
+-->
+
### This folder contains various test cases for performance test.
* P2P: packets flow from PHY -> vSwitch -> PHY
diff --git a/testcases/performance.py b/testcases/performance.py
index 240d04a9..0be99724 100644
--- a/testcases/performance.py
+++ b/testcases/performance.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@ import logging
from testcases import TestCase
from tools.report import report
-from conf import settings as S
class PerformanceTestCase(TestCase):
"""PerformanceTestCase class
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 425581b7..4fbf9c04 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -38,11 +38,13 @@ from tools.teststepstools import TestStepsTools
CHECK_PREFIX = 'validate_'
+# pylint: disable=too-many-instance-attributes
class TestCase(object):
"""TestCase base class
In this basic form runs RFC2544 throughput test
"""
+ # pylint: disable=too-many-statements
def __init__(self, cfg):
"""Pull out fields from test config
@@ -138,7 +140,7 @@ class TestCase(object):
'tunnel_type': self._tunnel_type,})
# Packet Forwarding mode
- self._vswitch_none = 'none' == S.getValue('VSWITCH').strip().lower()
+ self._vswitch_none = S.getValue('VSWITCH').strip().lower() == 'none'
# trafficgen configuration required for tests of tunneling protocols
if self.deployment == "op2p":
@@ -255,9 +257,6 @@ class TestCase(object):
# umount hugepages if mounted
self._umount_hugepages()
- # restore original settings
- S.load_from_dict(self._settings_original)
-
# cleanup any namespaces created
if os.path.isdir('/tmp/namespaces'):
namespace_list = os.listdir('/tmp/namespaces')
@@ -331,6 +330,9 @@ class TestCase(object):
# report test results
self.run_report()
+ # restore original settings
+ S.load_from_dict(self._settings_original)
+
def _update_settings(self, param, value):
""" Check value of given configuration parameter
In case that new value is different, then testcase
@@ -428,6 +430,7 @@ class TestCase(object):
def _mount_hugepages(self):
"""Mount hugepages if usage of DPDK or Qemu is detected
"""
+ # pylint: disable=too-many-boolean-expressions
# hugepages are needed by DPDK and Qemu
if not self._hugepages_mounted and \
(self.deployment.count('v') or \
@@ -457,26 +460,11 @@ class TestCase(object):
# get hugepage amounts for each socket on dpdk
sock0_mem, sock1_mem = 0, 0
+
if S.getValue('VSWITCH').lower().count('dpdk'):
- # the import below needs to remain here and not put into the module
- # imports because of an exception due to settings not yet loaded
- from vswitches import ovs_dpdk_vhost
- if ovs_dpdk_vhost.OvsDpdkVhost.old_dpdk_config():
- match = re.search(
- r'-socket-mem\s+(\d+),(\d+)',
- ''.join(S.getValue('VSWITCHD_DPDK_ARGS')))
- if match:
- sock0_mem, sock1_mem = (int(match.group(1)) * 1024 / hugepage_size,
- int(match.group(2)) * 1024 / hugepage_size)
- else:
- logging.info(
- 'Could not parse socket memory config in dpdk params.')
- else:
- sock0_mem, sock1_mem = (
- S.getValue(
- 'VSWITCHD_DPDK_CONFIG')['dpdk-socket-mem'].split(','))
- sock0_mem, sock1_mem = (int(sock0_mem) * 1024 / hugepage_size,
- int(sock1_mem) * 1024 / hugepage_size)
+ sock_mem = S.getValue('DPDK_SOCKET_MEM')
+ sock0_mem, sock1_mem = (int(sock_mem[0]) * 1024 / hugepage_size,
+ int(sock_mem[1]) * 1024 / hugepage_size)
# If hugepages needed, verify the amounts are free
if any([hugepages_needed, sock0_mem, sock1_mem]):
@@ -505,8 +493,8 @@ class TestCase(object):
else:
result3 = True
- logging.info('Need a total of {} total hugepages'.format(
- hugepages_needed + sock1_mem + sock0_mem))
+ logging.info('Need a total of %s total hugepages',
+ hugepages_needed + sock1_mem + sock0_mem)
# The only drawback here is sometimes dpdk doesn't release
# its hugepages on a test failure. This could cause a test
@@ -561,7 +549,7 @@ class TestCase(object):
"""Add flows to the vswitch
"""
vswitch = self._vswitch_ctl.get_vswitch()
- # TODO BOM 15-08-07 the frame mod code assumes that the
+ # NOTE BOM 15-08-07 the frame mod code assumes that the
# physical ports are ports 1 & 2. The actual numbers
# need to be retrived from the vSwitch and the metadata value
# updated accordingly.
@@ -627,7 +615,7 @@ class TestCase(object):
'goto_table:3']}
vswitch.add_flow(bridge, flow)
elif self._frame_mod == "ip_port":
- # TODO BOM 15-08-27 The traffic generated is assumed
+ # NOTE BOM 15-08-27 The traffic generated is assumed
# to be UDP (nw_proto 17d) which is the default case but
# we will need to pick up the actual traffic params in use.
flow = {'table':'2', 'priority':'1000', 'metadata':'2',
@@ -711,6 +699,9 @@ class TestCase(object):
# initialize list with results
self._step_result = [None] * len(self.test)
+ # We have to suppress pylint report, because test_object has to be set according
+ # to the test step definition
+ # pylint: disable=redefined-variable-type
# run test step by step...
for i, step in enumerate(self.test):
step_ok = not self._step_check