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
This commit is contained in:
Vasyl Saienko 2017-01-12 21:02:27 +02:00
parent 90b34a34ea
commit 3a5e334de6

View File

@ -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 @@ class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest):
def validate_ports(self):
node_uuid = self.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: