Add flavor_ref

Co-Authored-By: Alina Nesterova <anesterova@mirantis.com>
Change-Id: I27a2fd4d6e3c4f635826883ba8ae3c8e80339eb6
diff --git a/_modules/runtest/tempest_sections/compute.py b/_modules/runtest/tempest_sections/compute.py
index 9582559..7ae933e 100644
--- a/_modules/runtest/tempest_sections/compute.py
+++ b/_modules/runtest/tempest_sections/compute.py
@@ -49,7 +49,19 @@
 
     @property
     def flavor_ref(self):
-        pass
+        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')
+        if not flavor_name:
+            return
+
+        keystone_profile_admin = self.runtest_opts.get('keystone_profile_admin', {})
+        res = self.authenticated_openstack_module_call(
+            nodes[0], 'novang.flavor_list', profile=keystone_profile_admin)[nodes[0]]
+
+        if flavor_name in res:
+            return res[flavor_name]['id']
 
     @property
     def flavor_ref_alt(self):
diff --git a/metadata/service/tempest/init.yml b/metadata/service/tempest/init.yml
index 793557a..780c61f 100644
--- a/metadata/service/tempest/init.yml
+++ b/metadata/service/tempest/init.yml
@@ -22,6 +22,7 @@
       keystone_profile_admin: admin_identity
       convert_to_uuid:
         image_name: ${glance:client:identity:admin_identity:image:cirros:name}
+        flavor_name: 'm1.extra_tiny_test'
       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}