Support for xtesting
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / rapid_parser.py
index bdf2703..29d8755 100644 (file)
@@ -24,6 +24,7 @@ except ImportError:
     # Python 2.x fallback
     import ConfigParser as configparser
 import ast
+inf = float("inf")
 
 class RapidConfigParser(object):
     """
@@ -45,6 +46,10 @@ class RapidConfigParser(object):
             test_params['lat_percentile'] = 0.99
         RapidLog.info('Latency percentile at {:.0f}%'.format(
             test_params['lat_percentile']*100))
+        if testconfig.has_option('TestParameters', 'ipv6'):
+            test_params['ipv6'] = testconfig.getboolean('TestParameters','ipv6')
+        else:
+            test_params['ipv6'] = False
         config = configparser.RawConfigParser()
         config.read(test_params['environment_file'])
         test_params['vim_type'] = config.get('Varia', 'vim')
@@ -62,14 +67,13 @@ class RapidConfigParser(object):
                 if option in ['imix','imixs','flows']:
                     test[option] = ast.literal_eval(testconfig.get(section,
                         option))
-#                    test[option] = [int(i) for i in test[option]]
                 elif option in ['maxframespersecondallingress','stepsize',
                         'flowsize']:
                     test[option] = int(testconfig.get(section, option))
                 elif option in ['startspeed', 'step', 'drop_rate_threshold',
                         'lat_avg_threshold','lat_perc_threshold',
                         'lat_max_threshold','accuracy','maxr','maxz',
-                        'pass_threshold']:
+                        'pass_threshold','ramp_step']:
                     test[option] = float(testconfig.get(section, option))
                 else:
                     test[option] = testconfig.get(section, option)
@@ -78,6 +82,10 @@ class RapidConfigParser(object):
             if test['test'] in ['flowsizetest','TST009test']:
                 if 'drop_rate_threshold' not in test.keys():
                     test['drop_rate_threshold'] = 0
+                latency_thresholds = ['lat_avg_threshold','lat_perc_threshold','lat_max_threshold']
+                for threshold in latency_thresholds:
+                    if threshold not in test.keys():
+                        test[threshold] = inf
         test_params['tests'] = tests
         if test_params['required_number_of_test_machines'] > test_params[
                 'total_number_of_machines']:
@@ -89,33 +97,32 @@ class RapidConfigParser(object):
         machine = {}
         for test_machine in range(1, test_params['required_number_of_test_machines']+1):
             machine.clear()
-            if not(testconfig.has_option('TestM%d'%test_machine, 'prox_socket')
-                    and not testconfig.getboolean('TestM%d'%test_machine,
-                        'prox_socket')):
-                section = 'TestM%d'%test_machine
-                options = testconfig.options(section)
-                for option in options:
-                    if option in ['prox_socket','prox_launch_exit','monitor']:
-                        machine[option] = testconfig.getboolean(section, option)
-                    elif option in ['cores', 'gencores','latcores']:
-                        machine[option] = ast.literal_eval(testconfig.get(
-                            section, option))
-                    elif option in ['bucket_size_exp']:
-                        machine[option] = int(testconfig.get(section, option))
-                    else:
-                        machine[option] = testconfig.get(section, option)
-                    for key in ['prox_socket','prox_launch_exit']:
-                       if key not in machine.keys():
-                           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
-                options = config.options(section)
-                for option in options:
-                    machine[option] = config.get(section, option)
-                machines.append(dict(machine))
+            section = 'TestM%d'%test_machine
+            options = testconfig.options(section)
+            for option in options:
+                if option in ['prox_socket','prox_launch_exit','monitor']:
+                    machine[option] = testconfig.getboolean(section, option)
+                elif option in ['cores', 'gencores','latcores']:
+                    machine[option] = ast.literal_eval(testconfig.get(
+                        section, option))
+                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")
+                else:
+                    machine[option] = testconfig.get(section, option)
+                for key in ['prox_socket','prox_launch_exit']:
+                   if key not in machine.keys():
+                       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
+            options = config.options(section)
+            for option in options:
+                machine[option] = config.get(section, option)
+            machines.append(dict(machine))
         for machine in machines:
             dp_ports = []
             if 'dest_vm' in machine.keys():