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:
parent
90b34a34ea
commit
3a5e334de6
@ -15,11 +15,14 @@
|
|||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from tempest.common import waiters
|
from tempest.common import waiters
|
||||||
|
from tempest import config
|
||||||
|
from tempest.lib.common import api_version_request
|
||||||
from tempest import test
|
from tempest import test
|
||||||
|
|
||||||
from ironic_tempest_plugin.tests.scenario import baremetal_manager
|
from ironic_tempest_plugin.tests.scenario import baremetal_manager
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest):
|
class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest):
|
||||||
@ -98,7 +101,19 @@ class BaremetalBasicOps(baremetal_manager.BaremetalScenarioTest):
|
|||||||
|
|
||||||
def validate_ports(self):
|
def validate_ports(self):
|
||||||
node_uuid = self.node['uuid']
|
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 = self.get_ports(node_uuid)
|
||||||
ir_ports_addresses = [x['address'] for x in ir_ports]
|
ir_ports_addresses = [x['address'] for x in ir_ports]
|
||||||
for vif in vifs:
|
for vif in vifs:
|
||||||
|
Loading…
Reference in New Issue
Block a user