From 75198fcb02fcb5aa5fbfee92e9df6e4f8b25792b Mon Sep 17 00:00:00 2001 From: Luc Provoost Date: Wed, 27 Jan 2021 17:18:31 +0100 Subject: creation of tests and configs subdirectories All test files are now in the tests directory. All PROX config files moved to the configs directory. When specifying a test on the runrapid.py command line, you should now also mention the directory: e.g. --test tests/basicrapid.test In these test files, you need now to also include the configs subdirectory when specifying the prox configuration that needs to be used. The --map parameter has also changed. It can still take the file name of the map file, that specifies which PROX instance to use during a test. On top of that, you can now also specify a list of indices of the machines to be used during a test: e.g. --map [1,3]. Change-Id: I887cba59834dd8c903a22bc80959b10da2775398 Signed-off-by: Luc Provoost --- .../DPPD-PROX/helper-scripts/rapid/rapid_parser.py | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py') diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py index e5ed10d0..136bc273 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py @@ -91,11 +91,29 @@ class RapidConfigParser(object): 'total_number_of_machines']: RapidLog.exception("Not enough VMs for this test: %d needed and only %d available" % (required_number_of_test_machines,total_number_of_machines)) raise Exception("Not enough VMs for this test: %d needed and only %d available" % (required_number_of_test_machines,total_number_of_machines)) + map_info = test_params['machine_map_file'].strip('[]').split(',') + map_info_length = len(map_info) + if map_info_length > 1: + if map_info_length < test_params[ + 'required_number_of_test_machines']: + RapidLog.exception('Not enough machine indices in --map \ + parameter: {}. Needing {} entries'.format(map_info, + test_params['required_number_of_test_machines'])) + machine_index = list(map(int,map_info)) + else: + machine_map = configparser.RawConfigParser() + machine_map.read(test_params['machine_map_file']) + machine_index = [] + for test_machine in range(1, + test_params['required_number_of_test_machines']+1): + machine_index.append(int(machine_map.get( + 'TestM%d'%test_machine, 'machine_index'))) machine_map = configparser.RawConfigParser() machine_map.read(test_params['machine_map_file']) machines = [] machine = {} - for test_machine in range(1, test_params['required_number_of_test_machines']+1): + for test_machine in range(1, test_params[ + 'required_number_of_test_machines']+1): machine.clear() section = 'TestM%d'%test_machine options = testconfig.options(section) @@ -108,7 +126,8 @@ class RapidConfigParser(object): elif option in ['bucket_size_exp']: machine[option] = int(testconfig.get(section, option)) if machine[option] < 11: - RapidLog.exception("Minimum Value for bucket_size_exp is 11") + RapidLog.exception( + "Minimum Value for bucket_size_exp is 11") else: machine[option] = testconfig.get(section, option) for key in ['prox_socket','prox_launch_exit']: @@ -116,9 +135,7 @@ class RapidConfigParser(object): machine[key] = True if 'monitor' not in machine.keys(): machine['monitor'] = True - index = int(machine_map.get('TestM%d'%test_machine, - 'machine_index')) - section = 'M%d'%index + section = 'M%d'%machine_index[test_machine-1] options = config.options(section) for option in options: machine[option] = config.get(section, option) -- cgit 1.2.3-korg