Merge changes from topic 'refactor_tempest'
[functest.git] / functest / opnfv_tests / openstack / rally / rally.py
index b2213c9..1502d58 100644 (file)
@@ -22,22 +22,20 @@ import uuid
 
 import pkg_resources
 import prettytable
-import yaml
-
-from functest.core import testcase
-from functest.energy import energy
-from functest.opnfv_tests.openstack.snaps import snaps_utils
-from functest.opnfv_tests.openstack.tempest import conf_utils
-from functest.utils import config
-from functest.utils import env
-
 from snaps.config.flavor import FlavorConfig
 from snaps.config.image import ImageConfig
 from snaps.config.network import NetworkConfig, SubnetConfig
 from snaps.config.router import RouterConfig
-
 from snaps.openstack.create_flavor import OpenStackFlavor
 from snaps.openstack.utils import deploy_utils
+from xtesting.core import testcase
+from xtesting.energy import energy
+import yaml
+
+from functest.opnfv_tests.openstack.snaps import snaps_utils
+from functest.opnfv_tests.openstack.tempest import conf_utils
+from functest.utils import config
+from functest.utils import env
 
 LOGGER = logging.getLogger(__name__)
 
@@ -110,13 +108,13 @@ class RallyBase(testcase.TestCase):
     def _build_task_args(self, test_file_name):
         """Build arguments for the Rally task."""
         task_args = {'service_list': [test_file_name]}
-        task_args['image_name'] = self.image_name
-        task_args['flavor_name'] = self.flavor_name
-        task_args['flavor_alt_name'] = self.flavor_alt_name
-        task_args['glance_image_location'] = self.GLANCE_IMAGE_PATH
-        task_args['glance_image_format'] = self.GLANCE_IMAGE_FORMAT
-        task_args['tmpl_dir'] = self.TEMPLATE_DIR
-        task_args['sup_dir'] = self.SUPPORT_DIR
+        task_args['image_name'] = str(self.image_name)
+        task_args['flavor_name'] = str(self.flavor_name)
+        task_args['flavor_alt_name'] = str(self.flavor_alt_name)
+        task_args['glance_image_location'] = str(self.GLANCE_IMAGE_PATH)
+        task_args['glance_image_format'] = str(self.GLANCE_IMAGE_FORMAT)
+        task_args['tmpl_dir'] = str(self.TEMPLATE_DIR)
+        task_args['sup_dir'] = str(self.SUPPORT_DIR)
         task_args['users_amount'] = self.USERS_AMOUNT
         task_args['tenants_amount'] = self.TENANTS_AMOUNT
         task_args['use_existing_users'] = False
@@ -191,7 +189,7 @@ class RallyBase(testcase.TestCase):
                 return False
 
             for result in report.get('result'):
-                if result is None or len(result.get('error')) > 0:
+                if result is None or result.get('error'):
                     return False
 
         return True
@@ -466,7 +464,8 @@ class RallyBase(testcase.TestCase):
                 segmentation_id=rally_segmentation_id,
                 subnet_settings=[SubnetConfig(
                     name=subnet_name,
-                    cidr=self.RALLY_PRIVATE_SUBNET_CIDR)]))
+                    cidr=self.RALLY_PRIVATE_SUBNET_CIDR,
+                    dns_nameservers=[env.get('NAMESERVER')])]))
         if network_creator is None:
             raise Exception("Failed to create private network")
         self.priv_net_id = network_creator.get_network().id