Merge "Add system tests for SRIOV and DPDK."
This commit is contained in:
commit
447ffca9be
|
@ -359,3 +359,153 @@ Expected results
|
|||
################
|
||||
|
||||
All steps must be completed successfully, without any errors.
|
||||
|
||||
|
||||
Contrail DPDK boot instance
|
||||
---------------------------
|
||||
|
||||
|
||||
ID
|
||||
##
|
||||
|
||||
contrail_dpdk_boot_snapshot_vm
|
||||
|
||||
|
||||
Description
|
||||
###########
|
||||
|
||||
Launch instance, create snapshot, launch instance from snapshot.
|
||||
|
||||
|
||||
Complexity
|
||||
##########
|
||||
|
||||
advanced
|
||||
|
||||
|
||||
Steps
|
||||
#####
|
||||
|
||||
1. Create an environment with "Neutron with tunneling segmentation"
|
||||
as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Enable dpdk.
|
||||
4. Deploy cluster with some controller+ceph, compute, compute+dpdk
|
||||
and contrail-specified nodes.
|
||||
5. Run OSTF tests.
|
||||
6. Create no default network with subnet.
|
||||
7. Get existing flavor with hpgs.
|
||||
8. Launch an instance using the default image and flavor with hpgs
|
||||
in the hpgs availability zone.
|
||||
9. Make snapshot of the created instance.
|
||||
10. Delete the last created instance.
|
||||
11. Launch another instance from the snapshot created in step 2
|
||||
and flavor with hpgs in the hpgs availability zone.
|
||||
12. Delete the last created instance..
|
||||
|
||||
|
||||
Expected results
|
||||
################
|
||||
|
||||
All steps must be completed successfully, without any errors.
|
||||
|
||||
|
||||
Contrail DPDK boot instance from volume
|
||||
---------------------------------------
|
||||
|
||||
|
||||
ID
|
||||
##
|
||||
|
||||
contrail_dpdk_volume
|
||||
|
||||
|
||||
Description
|
||||
###########
|
||||
|
||||
Create volume and boot instance from it.
|
||||
|
||||
|
||||
Complexity
|
||||
##########
|
||||
|
||||
advanced
|
||||
|
||||
|
||||
Steps
|
||||
#####
|
||||
|
||||
1. Create an environment with "Neutron with tunneling segmentation"
|
||||
as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Enable dpdk
|
||||
4. Deploy cluster with some controller+ceph, compute, compute+dpdk and
|
||||
contrail-specified nodes.
|
||||
5. Run OSTF tests.
|
||||
6. Create no default network with subnet.
|
||||
7. Get existing flavor with hpgs.
|
||||
8. Create a new small-size volume from image.
|
||||
9. Wait for volume status to become "available".
|
||||
10. Launch an instance using the default image and flavor with hpgs
|
||||
in the hpgs availability zone.
|
||||
11. Wait for "Active" status.
|
||||
12. Delete the last created instance.
|
||||
13. Delete volume and verify that volume deleted.
|
||||
|
||||
|
||||
Expected results
|
||||
################
|
||||
|
||||
All steps must be completed successfully, without any errors.
|
||||
|
||||
|
||||
Contrail DPDK Check network connectivity from instance via floating IP
|
||||
----------------------------------------------------------------------
|
||||
|
||||
|
||||
ID
|
||||
##
|
||||
|
||||
contrail_dpdk_check_public_connectivity_from_instance
|
||||
|
||||
|
||||
Description
|
||||
###########
|
||||
|
||||
Check network connectivity from instance via floating IP
|
||||
|
||||
|
||||
Complexity
|
||||
##########
|
||||
|
||||
advanced
|
||||
|
||||
|
||||
Steps
|
||||
#####
|
||||
|
||||
1. Create an environment with "Neutron with tunneling segmentation"
|
||||
as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Enable dpdk
|
||||
4. Deploy cluster with some controller+ceph, compute, compute+dpdk and
|
||||
contrail-specified nodes.
|
||||
5. Run OSTF tests.
|
||||
6. Create no default network with subnet.
|
||||
7. Create Router_01, set gateway and add interface
|
||||
to external network.
|
||||
8. Get existing flavor with hpgs.
|
||||
9. Create a new security group (if it doesn`t exist yet).
|
||||
10. Launch an instance using the default image and flavor with hpgs
|
||||
in the hpgs availability zone.
|
||||
11. Create a new floating IP.
|
||||
12. Assign the new floating IP to the instance.
|
||||
13. Check connectivity to the floating IP using ping command.
|
||||
14. Check that public IP 8.8.8.8 can be pinged from instance.
|
||||
15. Delete instance.
|
||||
|
||||
|
||||
Expected results
|
||||
################
|
||||
|
||||
All steps must be completed successfully, without any errors.
|
||||
|
|
|
@ -315,3 +315,97 @@ Expected results
|
|||
################
|
||||
|
||||
All steps must be completed successfully, without any errors
|
||||
|
||||
|
||||
Contrail SRIOV boot instance
|
||||
----------------------------
|
||||
|
||||
|
||||
ID
|
||||
##
|
||||
|
||||
contrail_sriov_boot_snapshot_vm
|
||||
|
||||
|
||||
Description
|
||||
###########
|
||||
|
||||
Launch instance, create snapshot, launch instance from snapshot.
|
||||
|
||||
|
||||
Complexity
|
||||
##########
|
||||
|
||||
advanced
|
||||
|
||||
|
||||
Steps
|
||||
#####
|
||||
|
||||
1. Create an environment with "Neutron with tunneling segmentation"
|
||||
as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Deploy cluster with some controller+ceph, compute, compute+sriov
|
||||
and contrail-specified nodes.
|
||||
4. Run OSTF tests.
|
||||
5. Create physical network.
|
||||
6. Create a subnet.
|
||||
7. Create a port.
|
||||
8. Boot the instance with the port on the SRIOV host.
|
||||
9. Delete the instance created in step 8.
|
||||
10. Launch instance from snapshot.
|
||||
11. Delete the instance created in step 10.
|
||||
|
||||
|
||||
Expected results
|
||||
################
|
||||
|
||||
All steps must be completed successfully, without any errors.
|
||||
|
||||
|
||||
Contrail SRIOV boot instance from volume
|
||||
----------------------------------------
|
||||
|
||||
|
||||
ID
|
||||
##
|
||||
|
||||
contrail_sriov_volume
|
||||
|
||||
|
||||
Description
|
||||
###########
|
||||
|
||||
Create volume and boot instance from it.
|
||||
|
||||
|
||||
Complexity
|
||||
##########
|
||||
|
||||
advanced
|
||||
|
||||
|
||||
Steps
|
||||
#####
|
||||
|
||||
1. Create an environment with "Neutron with tunneling segmentation"
|
||||
as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Deploy cluster with some controller+ceph, compute, compute+sriov and
|
||||
contrail-specified nodes.
|
||||
4. Run OSTF tests.
|
||||
5. Create physical network.
|
||||
6. Create a subnet.
|
||||
7. Create a port.
|
||||
8. Create a new small-size volume from image.
|
||||
9. Wait for volume status to become "available".
|
||||
10. Launch instance from created volume and port on the SRIOV host.
|
||||
11. Wait for "Active" status.
|
||||
12. Delete instance.
|
||||
13. Delete volume and verify that volume deleted.
|
||||
|
||||
|
||||
Expected results
|
||||
################
|
||||
|
||||
All steps must be completed successfully, without any errors.
|
||||
|
|
|
@ -14,10 +14,14 @@ under the License.
|
|||
"""
|
||||
|
||||
import time
|
||||
|
||||
from proboscis.asserts import assert_true
|
||||
from devops.error import TimeoutError
|
||||
from devops.helpers.helpers import wait
|
||||
from fuelweb_test import logger
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
from fuelweb_test.helpers.checkers import check_repo_managment
|
||||
|
||||
import settings
|
||||
|
||||
|
||||
|
@ -33,6 +37,7 @@ def assign_net_provider(obj, **options):
|
|||
"objects_ceph": False,
|
||||
"volumes_lvm": True,
|
||||
"ceilometer": False,
|
||||
"osd_pool_size": '3'
|
||||
}
|
||||
|
||||
if "assert_deny" not in options:
|
||||
|
@ -159,3 +164,31 @@ def wait_for_cluster_status(obj, cluster_id,
|
|||
logger.info('Wait cluster id:"{}" deploy done in {}sec.'.format(cluster_id,
|
||||
wtime))
|
||||
return wtime
|
||||
|
||||
|
||||
def verify_instance_state(os_conn, instances=None,
|
||||
expected_state='ACTIVE',
|
||||
boot_timeout=300):
|
||||
"""Verify that current state of each instance/s is expected.
|
||||
|
||||
:param os_conn: type object, openstack
|
||||
:param instances: type list, list of created instances
|
||||
:param expected_state: type string, expected state of instance
|
||||
:param boot_timeout: type int, time in seconds to build instance
|
||||
"""
|
||||
if not instances:
|
||||
instances = os_conn.nova.servers.list()
|
||||
for instance in instances:
|
||||
try:
|
||||
wait(
|
||||
lambda:
|
||||
os_conn.get_instance_detail(
|
||||
instance).status == expected_state,
|
||||
timeout=boot_timeout)
|
||||
except TimeoutError:
|
||||
current_state = os_conn.get_instance_detail(instance).status
|
||||
assert_true(
|
||||
current_state == expected_state,
|
||||
"Timeout is reached. Current state of {0} is {1}".format(
|
||||
instance.name, current_state)
|
||||
)
|
||||
|
|
|
@ -14,11 +14,22 @@ under the License.
|
|||
"""
|
||||
|
||||
import os
|
||||
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_true
|
||||
|
||||
from devops.helpers.helpers import tcp_ping
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers import os_actions
|
||||
from fuelweb_test.settings import CONTRAIL_PLUGIN_PACK_UB_PATH
|
||||
from fuelweb_test.settings import SERVTEST_PASSWORD
|
||||
from fuelweb_test.settings import SERVTEST_TENANT
|
||||
from fuelweb_test.settings import SERVTEST_USERNAME
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
from helpers import plugin
|
||||
from helpers import openstack
|
||||
from helpers import baremetal
|
||||
|
@ -663,3 +674,294 @@ class DPDKTests(TestBasic):
|
|||
if vsrx_setup_result:
|
||||
self.show_step(9)
|
||||
self.fuel_web.run_ostf(cluster_id=self.cluster_id)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["contrail_dpdk_setup"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_dpdk_setup(self):
|
||||
"""Contrail DPDK setup.
|
||||
|
||||
Scenario:
|
||||
1. Create an environment with "Neutron with tunneling
|
||||
segmentation" as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Enable dpdk.
|
||||
4. Deploy cluster with following node configuration:
|
||||
node-01: 'controller', 'ceph-osd';
|
||||
node-02: 'compute';
|
||||
node-03: 'contrail-db', 'contrail-config', 'contrail-control';
|
||||
node-dpdk: 'compute', dpdk'.
|
||||
5. Run OSTF tests.
|
||||
|
||||
Duration 120 min
|
||||
|
||||
"""
|
||||
self.show_step(1)
|
||||
plugin.prepare_contrail_plugin(self, slaves=5,
|
||||
options={'images_ceph': True,
|
||||
'volumes_ceph': True,
|
||||
'ephemeral_ceph': True,
|
||||
'objects_ceph': True,
|
||||
'volumes_lvm': False,
|
||||
'osd_pool_size': '1'})
|
||||
self.bm_drv.host_prepare()
|
||||
|
||||
plugin.show_range(self, 2, 4)
|
||||
# enable plugin and ativate DPDK in contrail settings
|
||||
plugin.activate_dpdk(self)
|
||||
# activate vSRX image
|
||||
vsrx_setup_result = plugin.activate_vsrx()
|
||||
|
||||
self.show_step(4)
|
||||
self.bm_drv.setup_fuel_node(self,
|
||||
cluster_id=self.cluster_id,
|
||||
roles=['compute', 'dpdk'])
|
||||
|
||||
conf_nodes = {
|
||||
'slave-01': ['controller', 'ceph-osd'],
|
||||
'slave-02': ['compute'],
|
||||
'slave-03': ['contrail-db', 'contrail-config', 'contrail-control'],
|
||||
}
|
||||
# Cluster configurationeplication factor
|
||||
self.fuel_web.update_nodes(self.cluster_id,
|
||||
nodes_dict=conf_nodes,
|
||||
update_interfaces=False)
|
||||
self.bm_drv.update_vm_node_interfaces(self, self.cluster_id)
|
||||
|
||||
# Deploy cluster
|
||||
openstack.deploy_cluster(self)
|
||||
|
||||
self.show_step(5)
|
||||
# Run OSTF tests
|
||||
if vsrx_setup_result:
|
||||
self.fuel_web.run_ostf(
|
||||
cluster_id=self.cluster_id,
|
||||
test_sets=['smoke', 'sanity', 'ha'],
|
||||
should_fail=1,
|
||||
failed_test_name=['Instance live migration'])
|
||||
|
||||
@test(depends_on=[contrail_dpdk_setup],
|
||||
groups=["contrail_dpdk_boot_snapshot_vm"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_dpdk_boot_snapshot_vm(self):
|
||||
"""Launch instance, create snapshot, launch instance from snapshot.
|
||||
|
||||
Scenario:
|
||||
1. Setup contrail_dpdk_setup.
|
||||
2. Create no default network with subnet.
|
||||
3. Get existing flavor with hpgs.
|
||||
4. Launch an instance using the default image and flavor with hpgs
|
||||
in the hpgs availability zone.
|
||||
5. Make snapshot of the created instance.
|
||||
6. Delete the last created instance.
|
||||
7. Launch another instance from the snapshot created in step 2
|
||||
and flavor with hpgs in the hpgs availability zone.
|
||||
8. Delete the last created instance.
|
||||
|
||||
Duration 5 min
|
||||
|
||||
"""
|
||||
az_name = 'hpgs'
|
||||
subnet_cidr = '192.168.112.0/24'
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
net_name = 'net_1'
|
||||
|
||||
self.show_step(2)
|
||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||
os_conn = os_actions.OpenStackActions(
|
||||
os_ip, SERVTEST_USERNAME,
|
||||
SERVTEST_PASSWORD,
|
||||
SERVTEST_TENANT)
|
||||
|
||||
network = os_conn.create_network(
|
||||
network_name=net_name)['network']
|
||||
os_conn.create_subnet(
|
||||
subnet_name=net_name,
|
||||
network_id=network['id'],
|
||||
cidr=subnet_cidr,
|
||||
ip_version=4)
|
||||
|
||||
self.show_step(3)
|
||||
flavor = [
|
||||
f for f in os_conn.nova.flavors.list()
|
||||
if az_name in f.name][0]
|
||||
|
||||
self.show_step(4)
|
||||
srv_1 = os_conn.create_server_for_migration(
|
||||
neutron=True, availability_zone=az_name,
|
||||
label=net_name, flavor=flavor)
|
||||
|
||||
self.show_step(5)
|
||||
image = os_conn.nova.servers.create_image(srv_1, 'image1')
|
||||
wait(lambda: os_conn.nova.images.get(image).status == 'ACTIVE',
|
||||
timeout=300, timeout_msg='Image is not active.')
|
||||
|
||||
self.show_step(6)
|
||||
os_conn.delete_instance(srv_1)
|
||||
assert_true(
|
||||
os_conn.verify_srv_deleted(srv_1),
|
||||
"Instance was not deleted.")
|
||||
|
||||
self.show_step(7)
|
||||
srv_2 = os_conn.nova.servers.create(
|
||||
flavor=flavor, name='srv_2', image=image,
|
||||
availability_zone=az_name, nics=[{'net-id': network['id']}])
|
||||
openstack.verify_instance_state(os_conn, instances=[srv_2])
|
||||
|
||||
self.show_step(8)
|
||||
os_conn.delete_instance(srv_2)
|
||||
assert_true(
|
||||
os_conn.verify_srv_deleted(srv_2),
|
||||
"Instance was not deleted.")
|
||||
|
||||
@test(depends_on=[contrail_dpdk_setup],
|
||||
groups=["contrail_dpdk_volume"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_dpdk_volume(self):
|
||||
"""Create volume and boot instance from it.
|
||||
|
||||
Scenario:
|
||||
1. Setup contrail_dpdk_setup.
|
||||
2. Create no default network with subnet.
|
||||
3. Get existing flavor with hpgs.
|
||||
4. Create a new small-size volume from image.
|
||||
5. Wait for volume status to become "available".
|
||||
6. Launch an instance using the default image and flavor with hpgs
|
||||
in the hpgs availability zone.
|
||||
7. Wait for "Active" status.
|
||||
8. Delete the last created instance.
|
||||
9. Delete volume and verify that volume deleted.
|
||||
|
||||
Duration 5 min
|
||||
|
||||
"""
|
||||
az_name = 'hpgs'
|
||||
subnet_cidr = '192.168.112.0/24'
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
net_name = 'net_1'
|
||||
|
||||
self.show_step(2)
|
||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||
os_conn = os_actions.OpenStackActions(
|
||||
os_ip, SERVTEST_USERNAME,
|
||||
SERVTEST_PASSWORD,
|
||||
SERVTEST_TENANT)
|
||||
|
||||
network = os_conn.create_network(
|
||||
network_name=net_name)['network']
|
||||
os_conn.create_subnet(
|
||||
subnet_name=net_name,
|
||||
network_id=network['id'],
|
||||
cidr=subnet_cidr,
|
||||
ip_version=4)
|
||||
|
||||
self.show_step(3)
|
||||
flavor = [
|
||||
f for f in os_conn.nova.flavors.list()
|
||||
if az_name in f.name][0]
|
||||
|
||||
plugin.show_range(self, 4, 6)
|
||||
images_list = os_conn.nova.images.list()
|
||||
volume = os_conn.create_volume(image_id=images_list[0].id)
|
||||
|
||||
self.show_step(6)
|
||||
srv_1 = os_conn.create_server_for_migration(
|
||||
neutron=True, availability_zone=az_name,
|
||||
label=net_name, flavor=flavor,
|
||||
block_device_mapping={'vda': volume.id + ':::0'})
|
||||
|
||||
self.show_step(7)
|
||||
openstack.verify_instance_state(os_conn, instances=[srv_1])
|
||||
|
||||
self.show_step(8)
|
||||
os_conn.delete_instance(srv_1)
|
||||
assert_true(
|
||||
os_conn.verify_srv_deleted(srv_1),
|
||||
"Instance was not deleted.")
|
||||
|
||||
self.show_step(9)
|
||||
os_conn.delete_volume_and_wait(volume)
|
||||
|
||||
@test(depends_on=[contrail_dpdk_setup],
|
||||
groups=["contrail_dpdk_check_public_connectivity_from_instance"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_dpdk_check_public_connectivity_from_instance(self):
|
||||
"""Check network connectivity from instance via floating IP.
|
||||
|
||||
Scenario:
|
||||
1. Setup contrail_dpdk_setup.
|
||||
2. Create no default network with subnet.
|
||||
3. Create Router_01, set gateway and add interface
|
||||
to external network.
|
||||
4. Get existing flavor with hpgs.
|
||||
5. Create a new security group (if it doesn`t exist yet).
|
||||
6. Launch an instance using the default image and flavor with hpgs
|
||||
in the hpgs availability zone.
|
||||
7. Create a new floating IP.
|
||||
8. Assign the new floating IP to the instance.
|
||||
9. Check connectivity to the floating IP using ping command.
|
||||
10. Check that public IP 8.8.8.8 can be pinged from instance.
|
||||
11. Delete instance.
|
||||
|
||||
Duration 5 min
|
||||
|
||||
"""
|
||||
az_name = 'hpgs'
|
||||
subnet_cidr = '192.168.112.0/24'
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
net_name = 'net_1'
|
||||
ping_command = "ping -c 5 8.8.8.8"
|
||||
|
||||
self.show_step(2)
|
||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||
os_conn = os_actions.OpenStackActions(
|
||||
os_ip, SERVTEST_USERNAME,
|
||||
SERVTEST_PASSWORD,
|
||||
SERVTEST_TENANT)
|
||||
tenant = os_conn.get_tenant(SERVTEST_TENANT)
|
||||
|
||||
network = os_conn.create_network(
|
||||
network_name=net_name)['network']
|
||||
subnet = os_conn.create_subnet(
|
||||
subnet_name=net_name,
|
||||
network_id=network['id'],
|
||||
cidr=subnet_cidr,
|
||||
ip_version=4)
|
||||
|
||||
self.show_step(3)
|
||||
router = os_conn.create_router('router_1', tenant=tenant)
|
||||
os_conn.add_router_interface(
|
||||
router_id=router["id"],
|
||||
subnet_id=subnet["id"])
|
||||
|
||||
self.show_step(4)
|
||||
flavor = [
|
||||
f for f in os_conn.nova.flavors.list()
|
||||
if az_name in f.name][0]
|
||||
|
||||
plugin.show_range(self, 5, 7)
|
||||
srv = os_conn.create_server_for_migration(
|
||||
neutron=True, availability_zone=az_name,
|
||||
label=net_name, flavor=flavor)
|
||||
|
||||
plugin.show_range(self, 7, 9)
|
||||
fip = os_conn.assign_floating_ip(srv).ip
|
||||
|
||||
self.show_step(9)
|
||||
wait(
|
||||
lambda: tcp_ping(fip, 22), timeout=60, interval=5,
|
||||
timeout_msg="Node {0} is not accessible by SSH.".format(fip))
|
||||
|
||||
self.show_step(10)
|
||||
remote = self.fuel_web.get_nailgun_primary_node(
|
||||
self.env.d_env.nodes().slaves[0])
|
||||
assert_true(
|
||||
os_conn.execute_through_host(
|
||||
remote, fip, ping_command)['exit_code'] == 0,
|
||||
'Ping responce is not received.')
|
||||
|
||||
self.show_step(11)
|
||||
os_conn.delete_instance(srv)
|
||||
assert_true(
|
||||
os_conn.verify_srv_deleted(srv),
|
||||
"Instance was not deleted.")
|
||||
|
|
|
@ -14,11 +14,21 @@ under the License.
|
|||
"""
|
||||
|
||||
import os
|
||||
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_true
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from fuelweb_test.helpers import os_actions
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.settings import CONTRAIL_PLUGIN_PACK_UB_PATH
|
||||
from fuelweb_test.settings import SERVTEST_PASSWORD
|
||||
from fuelweb_test.settings import SERVTEST_TENANT
|
||||
from fuelweb_test.settings import SERVTEST_USERNAME
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
from helpers import plugin
|
||||
from helpers import openstack
|
||||
from helpers import baremetal
|
||||
|
@ -590,3 +600,237 @@ class SRIOVTests(TestBasic):
|
|||
failed_test_name=['Check that required '
|
||||
'services are running']
|
||||
)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["contrail_sriov_setup"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_sriov_setup(self):
|
||||
"""Contrail SRIOV setup.
|
||||
|
||||
Scenario:
|
||||
1. Create an environment with "Neutron with tunneling
|
||||
segmentation" as a network configuration and CEPH storage.
|
||||
2. Enable and configure Contrail plugin.
|
||||
3. Enable sriov.
|
||||
4. Deploy cluster with following node configuration:
|
||||
node-01: 'controller', 'ceph-osd';
|
||||
node-02: 'compute';
|
||||
node-03: 'contrail-db', 'contrail-config', 'contrail-control';
|
||||
node-sriov: 'compute', sriov'.
|
||||
5. Run OSTF tests.
|
||||
|
||||
Duration 120 min
|
||||
|
||||
"""
|
||||
self.show_step(1)
|
||||
plugin.prepare_contrail_plugin(self, slaves=5,
|
||||
options={'images_ceph': True,
|
||||
'volumes_ceph': True,
|
||||
'ephemeral_ceph': True,
|
||||
'objects_ceph': True,
|
||||
'volumes_lvm': False,
|
||||
'osd_pool_size': '1'})
|
||||
self.bm_drv.host_prepare()
|
||||
|
||||
plugin.show_range(self, 2, 4)
|
||||
# enable plugin and ativate SR-IOV in contrail settings
|
||||
plugin.activate_sriov(self)
|
||||
# activate vSRX image
|
||||
vsrx_setup_result = plugin.activate_vsrx()
|
||||
|
||||
self.show_step(4)
|
||||
self.bm_drv.setup_fuel_node(self,
|
||||
cluster_id=self.cluster_id,
|
||||
roles=['compute', 'sriov'])
|
||||
|
||||
conf_nodes = {
|
||||
'slave-01': ['controller', 'ceph-osd'],
|
||||
'slave-02': ['compute'],
|
||||
'slave-03': ['contrail-db', 'contrail-config', 'contrail-control'],
|
||||
}
|
||||
# Cluster configurationeplication factor
|
||||
self.fuel_web.update_nodes(self.cluster_id,
|
||||
nodes_dict=conf_nodes,
|
||||
update_interfaces=False)
|
||||
self.bm_drv.update_vm_node_interfaces(self, self.cluster_id)
|
||||
# Deploy cluster
|
||||
openstack.deploy_cluster(self)
|
||||
|
||||
self.show_step(5)
|
||||
# Run OSTF tests
|
||||
if vsrx_setup_result:
|
||||
self.fuel_web.run_ostf(
|
||||
cluster_id=self.cluster_id,
|
||||
test_sets=['smoke', 'sanity', 'ha'],
|
||||
should_fail=1,
|
||||
failed_test_name=['Instance live migration'])
|
||||
|
||||
@test(depends_on=[contrail_sriov_setup],
|
||||
groups=["contrail_sriov_boot_snapshot_vm"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_sriov_boot_snapshot_vm(self):
|
||||
"""Launch instance, create snapshot, launch instance from snapshot.
|
||||
|
||||
Scenario:
|
||||
1. Setup contrail_sriov_setup.
|
||||
2. Create physical network.
|
||||
3. Create a subnet.
|
||||
4. Create a port.
|
||||
5. Boot the instance with the port on the SRIOV host.
|
||||
6. Create snapshot of instance.
|
||||
7. Delete the instance created in step 5.
|
||||
8. Launch instance from snapshot.
|
||||
9. Delete the instance created in step 8.
|
||||
|
||||
Duration 5 min
|
||||
|
||||
"""
|
||||
net_name = 'sriov'
|
||||
subnet_cidr = '192.168.112.0/24'
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
binding_port = 'direct'
|
||||
|
||||
self.show_step(2)
|
||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||
os_conn = os_actions.OpenStackActions(
|
||||
os_ip, SERVTEST_USERNAME,
|
||||
SERVTEST_PASSWORD,
|
||||
SERVTEST_TENANT)
|
||||
|
||||
body = {
|
||||
'network': {
|
||||
'name': net_name,
|
||||
'provider:physical_network': 'physnet1',
|
||||
'provider:segmentation_id': '5'}}
|
||||
network = os_conn.neutron.create_network(body)['network']
|
||||
|
||||
self.show_step(3)
|
||||
os_conn.create_subnet(
|
||||
subnet_name=net_name,
|
||||
network_id=network['id'],
|
||||
cidr=subnet_cidr,
|
||||
ip_version=4)
|
||||
|
||||
self.show_step(4)
|
||||
|
||||
port = os_conn.neutron.create_port(
|
||||
{"port": {
|
||||
"network_id": network['id'],
|
||||
"binding:vnic_type": binding_port}})['port']
|
||||
|
||||
self.show_step(5)
|
||||
images_list = os_conn.nova.images.list()
|
||||
flavors = os_conn.nova.flavors.list()
|
||||
flavor = [f for f in flavors if f.name == 'm1.micro'][0]
|
||||
|
||||
srv_1 = os_conn.nova.servers.create(
|
||||
flavor=flavor, name='test1',
|
||||
image=images_list[0], nics=[{'port-id': port['id']}])
|
||||
|
||||
openstack.verify_instance_state(os_conn)
|
||||
|
||||
self.show_step(6)
|
||||
image = os_conn.nova.servers.create_image(srv_1, 'image1')
|
||||
wait(lambda: os_conn.nova.images.get(image).status == 'ACTIVE',
|
||||
timeout=300, timeout_msg='Image is not active.')
|
||||
|
||||
self.show_step(7)
|
||||
os_conn.delete_instance(srv_1)
|
||||
assert_true(
|
||||
os_conn.verify_srv_deleted(srv_1),
|
||||
"Instance was not deleted.")
|
||||
|
||||
self.show_step(8)
|
||||
port = os_conn.neutron.create_port(
|
||||
{"port": {
|
||||
"network_id": network['id'],
|
||||
"binding:vnic_type": binding_port}})['port']
|
||||
|
||||
srv_2 = os_conn.nova.servers.create(
|
||||
flavor=flavor, name='test1',
|
||||
image=image, nics=[{'port-id': port['id']}])
|
||||
openstack.verify_instance_state(os_conn, instances=[srv_2])
|
||||
|
||||
self.show_step(9)
|
||||
os_conn.delete_instance(srv_2)
|
||||
assert_true(
|
||||
os_conn.verify_srv_deleted(srv_2),
|
||||
"Instance was not deleted.")
|
||||
|
||||
@test(depends_on=[contrail_sriov_setup],
|
||||
groups=["contrail_sriov_volume"])
|
||||
@log_snapshot_after_test
|
||||
def contrail_sriov_volume(self):
|
||||
"""Create volume and boot instance from it.
|
||||
|
||||
Scenario:
|
||||
1. Setup contrail_sriov_setup.
|
||||
2. Create physical network.
|
||||
3. Create a subnet.
|
||||
4. Create a port.
|
||||
5. Create a new small-size volume from image.
|
||||
6. Wait for volume status to become "available".
|
||||
7. Launch instance from created volume and port on the SRIOV host.
|
||||
8. Wait for "Active" status.
|
||||
9. Delete instance.
|
||||
10. Delete volume and verify that volume deleted.
|
||||
|
||||
Duration 5 min
|
||||
|
||||
"""
|
||||
net_name = 'sriov'
|
||||
subnet_cidr = '192.168.112.0/24'
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
binding_port = 'direct'
|
||||
|
||||
self.show_step(2)
|
||||
os_ip = self.fuel_web.get_public_vip(cluster_id)
|
||||
os_conn = os_actions.OpenStackActions(
|
||||
os_ip, SERVTEST_USERNAME,
|
||||
SERVTEST_PASSWORD,
|
||||
SERVTEST_TENANT)
|
||||
|
||||
body = {
|
||||
'network': {
|
||||
'name': net_name,
|
||||
'provider:physical_network': 'physnet1',
|
||||
'provider:segmentation_id': '5'}}
|
||||
network = os_conn.neutron.create_network(body)['network']
|
||||
|
||||
self.show_step(3)
|
||||
os_conn.create_subnet(
|
||||
subnet_name=net_name,
|
||||
network_id=network['id'],
|
||||
cidr=subnet_cidr,
|
||||
ip_version=4)
|
||||
|
||||
self.show_step(4)
|
||||
|
||||
port = os_conn.neutron.create_port(
|
||||
{"port": {
|
||||
"network_id": network['id'],
|
||||
"binding:vnic_type": binding_port}})['port']
|
||||
|
||||
plugin.show_range(self, 5, 7)
|
||||
images_list = os_conn.nova.images.list()
|
||||
flavors = os_conn.nova.flavors.list()
|
||||
flavor = [f for f in flavors if f.name == 'm1.micro'][0]
|
||||
volume = os_conn.create_volume(image_id=images_list[0].id)
|
||||
|
||||
self.show_step(7)
|
||||
srv_1 = os_conn.nova.servers.create(
|
||||
flavor=flavor, name='test1',
|
||||
image=images_list[0],
|
||||
block_device_mapping={'vda': volume.id + ':::0'},
|
||||
nics=[{'port-id': port['id']}])
|
||||
|
||||
self.show_step(8)
|
||||
openstack.verify_instance_state(os_conn, instances=[srv_1])
|
||||
|
||||
self.show_step(9)
|
||||
os_conn.delete_instance(srv_1)
|
||||
assert_true(os_conn.verify_srv_deleted(srv_1),
|
||||
"Instance was not deleted.")
|
||||
|
||||
self.show_step(10)
|
||||
os_conn.delete_volume_and_wait(volume)
|
||||
|
|
Loading…
Reference in New Issue