
Add vdpa smoke test for [1]. The network, subnet, port creation, and verification had a lot of similarities to the test_sriov.SRIOVBase class. Moved these common methods to the base.BaseWhiteboxComputeTest class and updated impacted tests accordingly. In addition the sriov tests were reliant on provider_net_base_segmentation_id for configuring the vlan id for the network. To allow the vdpa and sriov networks their own vlan, moved the vlan id configuration to whitebox_hardware via sriov_vlan_id and vdpa_vlan_id. [1] https://specs.openstack.org/openstack/nova-specs/specs/wallaby/implemented/libvirt-vdpa-support.html Change-Id: Ia823d0503dbfb97eda35c6d3cf09a38407802fed
86 lines
3.0 KiB
Python
86 lines
3.0 KiB
Python
# Copyright 2020 Red Hat Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from tempest import config
|
|
|
|
from whitebox_tempest_plugin.api.compute import base
|
|
|
|
from oslo_log import log as logging
|
|
|
|
CONF = config.CONF
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
class VDPASmokeTests(base.BaseWhiteboxComputeTest):
|
|
|
|
@classmethod
|
|
def skip_checks(cls):
|
|
super(VDPASmokeTests, cls).skip_checks()
|
|
if getattr(CONF.whitebox_hardware,
|
|
'vdpa_physnet', None) is None:
|
|
raise cls.skipException('Requires vdpa_physnet parameter '
|
|
'to be set in order to execute test '
|
|
'cases.')
|
|
if getattr(CONF.whitebox_hardware,
|
|
'vdpa_vlan_id', None) is None:
|
|
raise cls.skipException('Requires '
|
|
'vdpa_vlan_id parameter to be set in '
|
|
'order to execute test cases.')
|
|
|
|
def setUp(self):
|
|
super(VDPASmokeTests, self).setUp()
|
|
self.vlan_id = \
|
|
CONF.whitebox_hardware.vdpa_vlan_id
|
|
self.physical_net = CONF.whitebox_hardware.vdpa_physnet
|
|
|
|
self.network = self._create_net_from_physical_network(
|
|
self.vlan_id,
|
|
self.physical_net)
|
|
self._create_subnet(self.network['network']['id'])
|
|
|
|
def test_guest_creation_with_vdpa_port(self):
|
|
"""Creates a guest that requires a vdpa port"""
|
|
flavor = self.create_flavor()
|
|
|
|
port = self._create_port_from_vnic_type(
|
|
net=self.network,
|
|
vnic_type='vdpa'
|
|
)
|
|
|
|
server = self.create_test_server(
|
|
flavor=flavor['id'],
|
|
networks=[{'port': port['port']['id']}],
|
|
wait_until='ACTIVE'
|
|
)
|
|
|
|
interface_xml_element = self._get_xml_interface_device(
|
|
server['id'],
|
|
port['port']['id'],
|
|
)
|
|
if CONF.whitebox.rx_queue_size:
|
|
driver = interface_xml_element.find("./driver[@name='vhost']")
|
|
self.assertEqual(
|
|
str(CONF.whitebox.rx_queue_size),
|
|
driver.attrib['rx_queue_size'],
|
|
"VDPA rx_queue_size equaling %s not found" %
|
|
str(CONF.whitebox.rx_queue_size))
|
|
|
|
# Confirm dev_type, allocation status, and pci address information are
|
|
# correct in pci_devices table of openstack DB
|
|
self._verify_neutron_port_binding(
|
|
server['id'],
|
|
port['port']['id']
|
|
)
|