fix regex expression to find IPV4 address
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / rapid_parser.py
index d7d8fab..ee8fa67 100644 (file)
@@ -46,6 +46,13 @@ 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', 'sleep_time'):
+            test_params['sleep_time'] = int(testconfig.get('TestParameters', 'sleep_time'))
+            if test_params['sleep_time'] < 2:
+                test_params['sleep_time'] = 2
+        else:
+            test_params['sleep_time'] = 2
+
         if testconfig.has_option('TestParameters', 'ipv6'):
             test_params['ipv6'] = testconfig.getboolean('TestParameters','ipv6')
         else:
@@ -53,14 +60,21 @@ class RapidConfigParser(object):
         config = configparser.RawConfigParser()
         config.read(test_params['environment_file'])
         test_params['vim_type'] = config.get('Varia', 'vim')
-        test_params['key'] = config.get('ssh', 'key')
         test_params['user'] = config.get('ssh', 'user')
-        if test_params['user'] in ['rapid']:
-            if test_params['key'] != 'rapid_rsa_key':
-                RapidLog.debug(("Key file {} for user {} overruled by key file:"
-                        " rapid_rsa_key").format(test_params['key'],
-                        test_params['user']))
-                test_params['key'] = 'rapid_rsa_key'
+        if config.has_option('ssh', 'key'):
+            test_params['key'] = config.get('ssh', 'key')
+            if test_params['user'] in ['rapid']:
+                if test_params['key'] != 'rapid_rsa_key':
+                    RapidLog.debug(("Key file {} for user {} overruled by key file:"
+                            " rapid_rsa_key").format(test_params['key'],
+                            test_params['user']))
+                    test_params['key'] = 'rapid_rsa_key'
+        else:
+            test_params['key'] = None
+        if config.has_option('ssh', 'password'):
+            test_params['password'] = config.get('ssh', 'password')
+        else:
+            test_params['password'] = None
         test_params['total_number_of_machines'] = int(config.get('rapid',
             'total_number_of_machines'))
         tests = []
@@ -77,19 +91,20 @@ class RapidConfigParser(object):
                         'flowsize','warmupflowsize','warmuptime', 'steps']:
                     test[option] = int(testconfig.get(section, option))
                 elif option in ['startspeed', 'step', 'drop_rate_threshold',
-                        'lat_avg_threshold','lat_perc_threshold',
+                        'generator_threshold','lat_avg_threshold','lat_perc_threshold',
                         'lat_max_threshold','accuracy','maxr','maxz',
-                        'ramp_step','warmupspeed']:
+                        'ramp_step','warmupspeed','mis_ordered_threshold']:
                     test[option] = float(testconfig.get(section, option))
                 else:
                     test[option] = testconfig.get(section, option)
             tests.append(dict(test))
         for test in tests:
-            if test['test'] in ['flowsizetest','TST009test']:
+            if test['test'] in ['flowsizetest', 'TST009test', 'increment_till_fail']:
                 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:
+                thresholds = ['generator_threshold','lat_avg_threshold', \
+                        'lat_perc_threshold','lat_max_threshold','mis_ordered_threshold']
+                for threshold in thresholds:
                     if threshold not in test.keys():
                         test[threshold] = inf
         test_params['tests'] = tests