aboutsummaryrefslogtreecommitdiffstats
path: root/vsperf
diff options
context:
space:
mode:
Diffstat (limited to 'vsperf')
-rwxr-xr-xvsperf69
1 files changed, 53 insertions, 16 deletions
diff --git a/vsperf b/vsperf
index 1afe858f..773ad759 100755
--- a/vsperf
+++ b/vsperf
@@ -40,11 +40,13 @@ import core.component_factory as component_factory
from core.loader import Loader
from testcases import PerformanceTestCase
from testcases import IntegrationTestCase
+from testcases import K8sPerformanceTestCase
from tools import tasks
from tools import networkcard
from tools import functions
from tools.pkt_gen import trafficgen
from tools.opnfvdashboard import opnfvdashboard
+from tools.os_deploy_tgen import osdt
sys.dont_write_bytecode = True
VERBOSITY_LEVELS = {
@@ -68,6 +70,7 @@ _TEMPLATE_MATRIX = "Performance Matrix\n------------------\n\n"\
"currently run tests. The metric used for comparison is {}.\n\n{}\n\n"
_LOGGER = logging.getLogger()
+logging.getLogger('matplotlib').setLevel(logging.ERROR)
def parse_param_string(values):
"""
@@ -178,6 +181,8 @@ def parse_arguments():
help='list all system vnfs and exit')
parser.add_argument('--list-loadgens', action='store_true',
help='list all background load generators')
+ parser.add_argument('--list-pods', action='store_true',
+ help='list all system pods')
parser.add_argument('--list-settings', action='store_true',
help='list effective settings configuration and exit')
parser.add_argument('exact_test_name', nargs='*', help='Exact names of\
@@ -201,6 +206,8 @@ def parse_arguments():
group.add_argument('--verbosity', choices=list_logging_levels(),
help='debug level')
group.add_argument('--integration', action='store_true', help='execute integration tests')
+ group.add_argument('--k8s', action='store_true', help='execute Kubernetes tests')
+ group.add_argument('--openstack', action='store_true', help='Run VSPERF with openstack')
group.add_argument('--trafficgen', help='traffic generator to use')
group.add_argument('--vswitch', help='vswitch implementation to use')
group.add_argument('--fwdapp', help='packet forwarding application to use')
@@ -241,21 +248,21 @@ def configure_logging(level):
'LOG_TIMESTAMP'),
ex=ext)
log_file_default = os.path.join(
- settings.getValue('LOG_DIR'), rename_default)
+ settings.getValue('RESULTS_PATH'), rename_default)
name, ext = os.path.splitext(settings.getValue('LOG_FILE_HOST_CMDS'))
rename_hostcmd = "{name}_{uid}{ex}".format(name=name,
uid=settings.getValue(
'LOG_TIMESTAMP'),
ex=ext)
log_file_host_cmds = os.path.join(
- settings.getValue('LOG_DIR'), rename_hostcmd)
+ settings.getValue('RESULTS_PATH'), rename_hostcmd)
name, ext = os.path.splitext(settings.getValue('LOG_FILE_TRAFFIC_GEN'))
rename_traffic = "{name}_{uid}{ex}".format(name=name,
uid=settings.getValue(
'LOG_TIMESTAMP'),
ex=ext)
log_file_traffic_gen = os.path.join(
- settings.getValue('LOG_DIR'), rename_traffic)
+ settings.getValue('RESULTS_PATH'), rename_traffic)
metrics_file = (settings.getValue('LOG_FILE_INFRA_METRICS_PFX') +
settings.getValue('LOG_TIMESTAMP') + '.log')
log_file_infra_metrics = os.path.join(settings.getValue('LOG_DIR'),
@@ -577,6 +584,10 @@ def handle_list_options(args):
print(Loader().get_loadgens_printable())
sys.exit(0)
+ if args['list_pods']:
+ print(Loader().get_pods_printable())
+ sys.exit(0)
+
if args['list_settings']:
print(str(settings))
sys.exit(0)
@@ -594,6 +605,8 @@ def list_testcases(args):
# configure tests
if args['integration']:
testcases = settings.getValue('INTEGRATION_TESTS')
+ elif args['k8s']:
+ testcases = settings.getValue('K8SPERFORMANCE_TESTS')
else:
testcases = settings.getValue('PERFORMANCE_TESTS')
@@ -672,14 +685,26 @@ def main():
settings.load_from_dir(os.path.join(_CURR_DIR, 'conf'))
- # Define the timestamp to be used by logs and results
+ # define the timestamp to be used by logs and results
date = datetime.datetime.fromtimestamp(time.time())
timestamp = date.strftime('%Y-%m-%d_%H-%M-%S')
settings.setValue('LOG_TIMESTAMP', timestamp)
- # Load non performance/integration tests
+ # generate results directory name
+ # integration test use vswitchd log in test step assertions, ensure that
+ # correct value will be set before loading integration test configuration
+ results_dir = "results_" + timestamp
+ results_path = os.path.join(settings.getValue('LOG_DIR'), results_dir)
+ settings.setValue('RESULTS_PATH', results_path)
+ # create results directory
+ if not os.path.exists(results_path):
+ os.makedirs(results_path)
+
+ # load non performance/integration tests
if args['integration']:
settings.load_from_dir(os.path.join(_CURR_DIR, 'conf/integration'))
+ if args['k8s']:
+ settings.load_from_dir(os.path.join(_CURR_DIR, 'conf/kubernetes'))
# load command line parameters first in case there are settings files
# to be used
@@ -697,6 +722,19 @@ def main():
settings.setValue('mode', args['mode'])
+ if args['k8s']:
+ settings.setValue('K8S', True)
+ else:
+ settings.setValue('K8S', False)
+
+ if args['openstack']:
+ result = osdt.deploy_testvnf()
+ if result:
+ _LOGGER.info('TestVNF successfully deployed on Openstack')
+ settings.setValue('mode', 'trafficgen')
+ else:
+ _LOGGER.error('Failed to deploy TestVNF in Openstac')
+ sys.exit(1)
# update paths to trafficgens if required
if settings.getValue('mode') == 'trafficgen':
functions.settings_update_paths()
@@ -706,6 +744,9 @@ def main():
configure_logging(settings.getValue('VERBOSITY'))
+ # CI build support
+ _LOGGER.info("Creating result directory: %s", results_path)
+
# check and fix locale
check_and_set_locale()
@@ -785,16 +826,7 @@ def main():
# for backward compatibility
settings.setValue('WHITELIST_NICS', list(nic['pci'] for nic in nic_list))
- # generate results directory name
- # date = datetime.datetime.fromtimestamp(time.time())
- results_dir = "results_" + timestamp
- results_path = os.path.join(settings.getValue('LOG_DIR'), results_dir)
- settings.setValue('RESULTS_PATH', results_path)
- # create results directory
- if not os.path.exists(results_path):
- _LOGGER.info("Creating result directory: %s", results_path)
- os.makedirs(results_path)
# pylint: disable=too-many-nested-blocks
if settings.getValue('mode') == 'trafficgen':
# execute only traffic generator
@@ -819,6 +851,8 @@ def main():
# configure tests
if args['integration']:
testcases = settings.getValue('INTEGRATION_TESTS')
+ elif args['k8s']:
+ testcases = settings.getValue('K8SPERFORMANCE_TESTS')
else:
testcases = settings.getValue('PERFORMANCE_TESTS')
@@ -861,6 +895,8 @@ def main():
if args['integration']:
test = IntegrationTestCase(cfg)
+ elif args['k8s']:
+ test = K8sPerformanceTestCase(cfg)
else:
test = PerformanceTestCase(cfg)
@@ -893,8 +929,9 @@ def main():
output=settings.getValue('XUNIT_DIR'), outsuffix="",
verbosity=0).run(suite)
- if args['opnfvpod']:
- pod_name = args['opnfvpod']
+ if args['opnfvpod'] or settings.getValue('OPNFVPOD'):
+ pod_name = (args['opnfvpod'] if args['opnfvpod'] else
+ settings.getValue('OPNFVPOD'))
installer_name = str(settings.getValue('OPNFV_INSTALLER')).lower()
opnfv_url = settings.getValue('OPNFV_URL')
pkg_list = settings.getValue('PACKAGE_LIST')