summaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
Diffstat (limited to 'testcases')
-rw-r--r--testcases/testcase.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 4b2751b5..7d5162e6 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2016 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ 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 import hugepages
from tools.report import report
from conf import settings as S
from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS
@@ -43,6 +44,7 @@ class TestCase(object):
values.
:param results_dir: Where the csv formatted results are written.
"""
+ self._hugepages_mounted = False
self._logger = logging.getLogger(__name__)
self.name = cfg['Name']
self.desc = cfg.get('Description', 'No description given.')
@@ -113,6 +115,9 @@ class TestCase(object):
"""
self._logger.debug(self.name)
+ # mount hugepages if needed
+ self._mount_hugepages()
+
# copy sources of l2 forwarding tools into VM shared dir if needed
self._copy_fwd_tools_for_guest()
@@ -154,6 +159,9 @@ class TestCase(object):
if not self._vswitch_none:
vswitch_ctl.dump_vswitch_flows()
+ # umount hugepages if mounted
+ self._umount_hugepages()
+
self._logger.debug("Traffic Results:")
traffic_ctl.print_results()
@@ -222,6 +230,21 @@ class TestCase(object):
counter += 1
+ def _mount_hugepages(self):
+ """Mount hugepages if usage of DPDK or Qemu is detected
+ """
+ # hugepages are needed by DPDK and Qemu
+ if not self._hugepages_mounted and \
+ (self.deployment.count('v') or S.getValue('VSWITCH').lower().count('dpdk')):
+ hugepages.mount_hugepages()
+ self._hugepages_mounted = True
+
+ def _umount_hugepages(self):
+ """Umount hugepages if they were mounted before
+ """
+ if self._hugepages_mounted:
+ hugepages.umount_hugepages()
+ self._hugepages_mounted = False
@staticmethod
def _write_result_to_file(results, output):