Update validate_ports from BaremetalBasicOps

Get node attached vifs via v1/nodes/<node>/vifs when max supported
Ironic API microversion is higher or equal 1.28. Fallback to
 port-show otherwise.

Change-Id: I20e889d255c070897ee1cd4bece347cbf44a94d5
diff --git a/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py b/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py
index 1a91879..a17efc6 100644
--- a/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py
+++ b/ironic_tempest_plugin/tests/scenario/test_baremetal_basic_ops.py
@@ -15,11 +15,14 @@
 
 from oslo_log import log as logging
 from tempest.common import waiters
+from tempest import config
+from tempest.lib.common import api_version_request
 from tempest import test
 
 from ironic_tempest_plugin.tests.scenario import baremetal_manager
 
 LOG = logging.getLogger(__name__)
+CONF = config.CONF
 
 
 class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest):
@@ -98,7 +101,19 @@
 
     def validate_ports(self):
         node_uuid = self.node['uuid']
-        vifs = self.get_node_vifs(node_uuid)
+        vifs = []
+        # TODO(vsaienko) switch to get_node_vifs() when all stable releases
+        # supports Ironic API 1.28
+        if (api_version_request.APIVersionRequest(
+            CONF.baremetal.max_microversion) >=
+                api_version_request.APIVersionRequest('1.28')):
+            vifs = self.get_node_vifs(node_uuid)
+        else:
+            for port in self.get_ports(self.node['uuid']):
+                vif = port['extra'].get('vif_port_id')
+                if vif:
+                    vifs.append({'id': vif})
+
         ir_ports = self.get_ports(node_uuid)
         ir_ports_addresses = [x['address'] for x in ir_ports]
         for vif in vifs: