Merge "NSB Prox minor refactor of BNG"
[yardstick.git] / yardstick / network_services / vnf_generic / vnf / prox_helpers.py
index 02ae061..63c6467 100644 (file)
@@ -364,6 +364,7 @@ class ProxSocketHelper(object):
         """ send data to the remote instance """
         LOG.debug("Sending data to socket: [%s]", to_send.rstrip('\n'))
         try:
+            # TODO: sendall will block, we need a timeout
             self._sock.sendall(to_send.encode('utf-8'))
         except:
             pass
@@ -593,6 +594,8 @@ _LOCAL_OBJECT = object()
 class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper):
     # the actual app is lowercase
     APP_NAME = 'prox'
+    # not used for Prox but added for consistency
+    VNF_TYPE = "PROX"
 
     LUA_PARAMETER_NAME = ""
     LUA_PARAMETER_PEER = {
@@ -609,6 +612,8 @@ class ProxDpdkVnfSetupEnvHelper(DpdkVnfSetupEnvHelper):
         self._prox_config_data = None
         self.additional_files = {}
         self.config_queue = Queue()
+        # allow_exit_without_flush
+        self.config_queue.cancel_join_thread()
         self._global_section = None
 
     @property
@@ -878,6 +883,7 @@ class ProxResourceHelper(ClientResourceHelper):
         return self._test_type
 
     def run_traffic(self, traffic_profile):
+        self._queue.cancel_join_thread()
         self.lower = 0.0
         self.upper = 100.0
 
@@ -1261,23 +1267,26 @@ class ProxBngProfileHelper(ProxProfileHelper):
                 continue
 
             for item_key, item_value in section:
-                if item_key == "name" and item_value.startswith("cpe"):
+                if item_key != 'name':
+                    continue
+
+                if item_value.startswith("cpe"):
                     core_tuple = CoreSocketTuple(section_name)
-                    core_tag = core_tuple.find_in_topology(self.cpu_topology)
-                    cpe_cores.append(core_tag)
+                    cpe_core = core_tuple.find_in_topology(self.cpu_topology)
+                    cpe_cores.append(cpe_core)
 
-                elif item_key == "name" and item_value.startswith("inet"):
+                elif item_value.startswith("inet"):
                     core_tuple = CoreSocketTuple(section_name)
                     inet_core = core_tuple.find_in_topology(self.cpu_topology)
                     inet_cores.append(inet_core)
 
-                elif item_key == "name" and item_value.startswith("arp"):
+                elif item_value.startswith("arp"):
                     core_tuple = CoreSocketTuple(section_name)
                     arp_core = core_tuple.find_in_topology(self.cpu_topology)
                     arp_cores.append(arp_core)
 
                 # We check the tasks/core separately
-                if item_key == "name" and item_value.startswith("arp_task"):
+                if item_value.startswith("arp_task"):
                     core_tuple = CoreSocketTuple(section_name)
                     arp_task_core = core_tuple.find_in_topology(self.cpu_topology)
                     arp_tasks_core.append(arp_task_core)