Fixing some more copyright dates
[samplevnf.git] / VNFs / DPPD-PROX / helper-scripts / rapid / rapid_parser.py
index 864f84b..6dd2e21 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 ##
-## Copyright (c) 2010-2020 Intel Corporation
+## Copyright (c) 2020 Intel Corporation
 ##
 ## Licensed under the Apache License, Version 2.0 (the "License");
 ## you may not use this file except in compliance with the License.
@@ -59,9 +59,9 @@ class RapidConfigParser(object):
             section = 'test%d'%test_index
             options = testconfig.options(section)
             for option in options:
-                if option in ['packetsizes','flows']:
+                if option in ['imix','imixs','flows']:
                     test[option] = ast.literal_eval(testconfig.get(section, option))
-                    test[option] = [int(i) for i in test[option]]
+#                    test[option] = [int(i) for i in test[option]]
                 elif option in ['maxframespersecondallingress','stepsize']:
                     test[option] = int(testconfig.get(section, option))
                 elif option in ['startspeed','drop_rate_threshold','lat_avg_threshold','lat_perc_threshold','lat_max_threshold','accuracy','maxr','maxz','pass_threshold']:
@@ -87,7 +87,7 @@ class RapidConfigParser(object):
                 section = 'TestM%d'%test_machine
                 options = testconfig.options(section)
                 for option in options:
-                    if option in ['prox_socket','prox_launch_exit']:
+                    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))
@@ -96,41 +96,41 @@ class RapidConfigParser(object):
                     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)
-                if 'monitor' not in machine.keys():
-                    machine['monitor'] = True
-                else:    
-                    machine['monitor'] = config.getboolean(section, option)
                 machines.append(dict(machine))
         for machine in machines:
             dp_ports = []
             if 'dest_vm' in machine.keys():
                 index = 1
-                dp_ip_key = 'dp_ip{}'.format(index)
-                dp_mac_key = 'dp_mac{}'.format(index)
-                if dp_ip_key in machines[int(machine['dest_vm'])-1].keys() and \
-                        dp_mac_key in machines[int(machine['dest_vm'])-1].keys():
-                    dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key],
-                            'mac' : machines[int(machine['dest_vm'])-1][dp_mac_key]}
-                    dp_ports.append(dict(dp_port))
-                    index += 1
-                else:
-                    break
-                machine['dest_ports'] = list(dp_ports)
+                while True: 
+                    dp_ip_key = 'dp_ip{}'.format(index)
+                    dp_mac_key = 'dp_mac{}'.format(index)
+                    if dp_ip_key in machines[int(machine['dest_vm'])-1].keys() and \
+                            dp_mac_key in machines[int(machine['dest_vm'])-1].keys():
+                        dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key],
+                                'mac' : machines[int(machine['dest_vm'])-1][dp_mac_key]}
+                        dp_ports.append(dict(dp_port))
+                        index += 1
+                    else:
+                        break
+                    machine['dest_ports'] = list(dp_ports)
             gw_ips = []
             if 'gw_vm' in machine.keys():
                 index = 1
-                gw_ip_key = 'dp_ip{}'.format(index)
-                if gw_ip_key in machines[int(machine['gw_vm'])-1].keys():
-                    gw_ip = machines[int(machine['dest_vm'])-1][gw_ip_key]
-                    gw_ips.append(gw_ip)
-                    index += 1
-                else:
-                    break
-                machine['gw_ips'] = list(gw_ips)
+                while True:
+                    gw_ip_key = 'dp_ip{}'.format(index)
+                    if gw_ip_key in machines[int(machine['gw_vm'])-1].keys():
+                        gw_ip = machines[int(machine['dest_vm'])-1][gw_ip_key]
+                        gw_ips.append(gw_ip)
+                        index += 1
+                    else:
+                        break
+                    machine['gw_ips'] = list(gw_ips)
         test_params['machines'] = machines
         return (test_params)