Add image_ref_alt

Add image_ref_alt to tempest config parameters

Change-Id: I7de166a27b1720a6729b144d08c1d7ea41331833
diff --git a/_modules/runtest/tempest_sections/compute.py b/_modules/runtest/tempest_sections/compute.py
index 494c9dc..238ebb5 100644
--- a/_modules/runtest/tempest_sections/compute.py
+++ b/_modules/runtest/tempest_sections/compute.py
@@ -52,7 +52,8 @@
         c = conditions.BaseRule(field='keystone.client.enabled', op='eq',
                                 val=True)
         nodes = self.get_nodes_where_condition_match(c)
-        flavor_name = self.runtest_opts.get('convert_to_uuid', {}).get('flavor_name')
+        flavor_name = self.runtest_opts.get('convert_to_uuid', {}).get(
+            'compute', {}).get('flavor_ref')
         if not flavor_name:
             return
 
@@ -68,7 +69,8 @@
         c = conditions.BaseRule(field='keystone.client.enabled', op='eq',
                                 val=True)
         nodes = self.get_nodes_where_condition_match(c)
-        flavor_name = self.runtest_opts.get('convert_to_uuid', {}).get('flavor_alt_name')
+        flavor_name = self.runtest_opts.get('convert_to_uuid', {}).get(
+            'compute', {}).get('flavor_ref_alt')
         if not flavor_name:
             return
 
@@ -88,7 +90,8 @@
         c = conditions.BaseRule(field='keystone.client.enabled', op='eq',
                                 val=True)
         nodes = self.get_nodes_where_condition_match(c)
-        image_name = self.runtest_opts.get('convert_to_uuid', {}).get('image_name')
+        image_name = self.runtest_opts.get('convert_to_uuid', {}).get(
+            'compute', {}).get('image_ref')
         if not image_name:
             return
 
@@ -104,7 +107,23 @@
 
     @property
     def image_ref_alt(self):
-        pass
+        c = conditions.BaseRule(field='keystone.client.enabled', op='eq',
+                                val=True)
+        nodes = self.get_nodes_where_condition_match(c)
+        image_name = self.runtest_opts.get('convert_to_uuid', {}).get(
+            'compute', {}).get('image_ref_alt')
+        if not image_name:
+            return
+
+        keystone_profile_admin = self.runtest_opts.get('keystone_profile_admin', {})
+        res = self.authenticated_openstack_module_call(
+             nodes[0], 'glanceng.image_list', profile=keystone_profile_admin)[nodes[0]]
+        images = [n['id'] for n in res if n['name'] == image_name]
+
+        if len(images) != 1:
+            raise Exception("Error getting images: {}".format(images))
+
+        return images[0]
 
     @property
     def max_microversion(self):
diff --git a/metadata/service/tempest/init.yml b/metadata/service/tempest/init.yml
index d59a7e0..86be784 100644
--- a/metadata/service/tempest/init.yml
+++ b/metadata/service/tempest/init.yml
@@ -21,9 +21,11 @@
       test_target: ${_param:tempest_test_target}
       keystone_profile_admin: admin_identity
       convert_to_uuid:
-        image_name: ${glance:client:identity:admin_identity:image:cirros:name}
-        flavor_name: 'm1.extra_tiny_test'
-        flavor_alt_name: 'm1.tiny_test'
+        compute:
+          image_ref: ${glance:client:identity:admin_identity:image:cirros:name}
+          flavor_ref: 'm1.extra_tiny_test'
+          flavor_ref_alt: 'm1.tiny_test'
+          image_ref_alt: ${glance:client:identity:admin_identity:image:cirros:name}
       heat_plugin:
         skip_scenario_test_list: ${_param:runtest_heat_plugin_skip_scenario_test_list}
         skip_functional_test_list: ${_param:runtest_heat_plugin_skip_functional_test_list}