Browse Source

Merge "Adding description for testcases - network part2"

changes/73/686073/7
Zuul 1 week ago
committed by Gerrit Code Review
parent
commit
10b4af0ade
9 changed files with 65 additions and 14 deletions
  1. +4
    -0
      tempest/api/network/admin/test_dhcp_agent_scheduler.py
  2. +17
    -6
      tempest/api/network/admin/test_external_network_extension.py
  3. +6
    -3
      tempest/api/network/admin/test_external_networks_negative.py
  4. +6
    -3
      tempest/api/network/admin/test_metering_extensions.py
  5. +11
    -2
      tempest/api/network/admin/test_routers.py
  6. +8
    -0
      tempest/api/network/test_routers.py
  7. +10
    -0
      tempest/api/network/test_routers_negative.py
  8. +2
    -0
      tempest/api/network/test_service_providers.py
  9. +1
    -0
      tempest/api/network/test_subnetpools_extensions.py

+ 4
- 0
tempest/api/network/admin/test_dhcp_agent_scheduler.py View File

@@ -18,6 +18,7 @@ from tempest.lib import decorators


class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):
"""Test network DHCP agent scheduler extension"""

@classmethod
def skip_checks(cls):
@@ -37,11 +38,13 @@ class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('5032b1fe-eb42-4a64-8f3b-6e189d8b5c7d')
def test_list_dhcp_agent_hosting_network(self):
"""Test Listing DHCP agents hosting a network"""
self.admin_networks_client.list_dhcp_agents_on_hosting_network(
self.network['id'])

@decorators.idempotent_id('30c48f98-e45d-4ffb-841c-b8aad57c7587')
def test_list_networks_hosted_by_one_dhcp(self):
"""Test Listing networks hosted by a DHCP agent"""
body = self.admin_networks_client.list_dhcp_agents_on_hosting_network(
self.network['id'])
agents = body['agents']
@@ -61,6 +64,7 @@ class DHCPAgentSchedulersTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('a0856713-6549-470c-a656-e97c8df9a14d')
def test_add_remove_network_from_dhcp_agent(self):
"""Test adding and removing network from a DHCP agent"""
# The agent is now bound to the network, we can free the port
self.ports_client.delete_port(self.port['id'])
agent = dict()


+ 17
- 6
tempest/api/network/admin/test_external_network_extension.py View File

@@ -23,6 +23,7 @@ CONF = config.CONF


class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
"""Test external networks"""

@classmethod
def resource_setup(cls):
@@ -42,8 +43,11 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('462be770-b310-4df9-9c42-773217e4c8b1')
def test_create_external_network(self):
# Create a network as an admin user specifying the
# external network extension attribute
"""Test creating external network

Create a network as an admin user specifying the
external network extension attribute
"""
ext_network = self._create_network()
# Verifies router:external parameter
self.assertIsNotNone(ext_network['id'])
@@ -51,8 +55,11 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('4db5417a-e11c-474d-a361-af00ebef57c5')
def test_update_external_network(self):
# Update a network as an admin user specifying the
# external network extension attribute
"""Test updating external network

Update a network as an admin user specifying the
external network extension attribute
"""
network = self._create_network(external=False)
self.assertFalse(network.get('router:external', False))
update_body = {'router:external': True}
@@ -64,6 +71,7 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('39be4c9b-a57e-4ff9-b7c7-b218e209dfcc')
def test_list_external_networks(self):
"""Test listing external networks"""
# Create external_net
external_network = self._create_network()
# List networks as a normal user and confirm the external
@@ -81,6 +89,7 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('2ac50ab2-7ebd-4e27-b3ce-a9e399faaea2')
def test_show_external_networks_attribute(self):
"""Test showing external network attribute"""
# Create external_net
external_network = self._create_network()
# Show an external network as a normal user and confirm the
@@ -101,9 +110,11 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
'Floating ips are not availabled')
def test_delete_external_networks_with_floating_ip(self):
# Verifies external network can be deleted while still holding
# (unassociated) floating IPs
"""Test deleting external network with unassociated floating ips

Verifies external network can be deleted while still holding
(unassociated) floating IPs
"""
body = self.admin_networks_client.create_network(
**{'router:external': True})
external_network = body['network']


+ 6
- 3
tempest/api/network/admin/test_external_networks_negative.py View File

@@ -25,16 +25,19 @@ CONF = config.CONF


class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
"""Negative tests of external network"""

@decorators.attr(type=['negative'])
@decorators.idempotent_id('d402ae6c-0be0-4d8e-833b-a738895d98d0')
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_create_port_with_precreated_floatingip_as_fixed_ip(self):
# NOTE: External networks can be used to create both floating-ip as
# well as instance-ip. So, creating an instance-ip with a value of a
# pre-created floating-ip should be denied.
"""Test creating port with precreated floating ip as fixed ip

NOTE: External networks can be used to create both floating-ip as
well as instance-ip. So, creating an instance-ip with a value of a
pre-created floating-ip should be denied.
"""
# create a floating ip
body = self.admin_floating_ips_client.create_floatingip(
floating_network_id=CONF.network.public_network_id)


+ 6
- 3
tempest/api/network/admin/test_metering_extensions.py View File

@@ -92,13 +92,14 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('e2fb2f8c-45bf-429a-9f17-171c70444612')
def test_list_metering_labels(self):
# Verify label filtering
"""Verify listing metering labels"""
body = self.admin_metering_labels_client.list_metering_labels(id=33)
metering_labels = body['metering_labels']
self.assertEmpty(metering_labels)

@decorators.idempotent_id('ec8e15ff-95d0-433b-b8a6-b466bddb1e50')
def test_create_delete_metering_label_with_filters(self):
"""Verifies creating and deleting metering label with filters"""
# Creates a label
name = data_utils.rand_name('metering-label-')
description = "label created by tempest"
@@ -115,7 +116,7 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('30abb445-0eea-472e-bd02-8649f54a5968')
def test_show_metering_label(self):
# Verifies the details of a label
"""Verifies the details of a metering label"""
body = self.admin_metering_labels_client.show_metering_label(
self.metering_label['id'])
metering_label = body['metering_label']
@@ -128,6 +129,7 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('cc832399-6681-493b-9d79-0202831a1281')
def test_list_metering_label_rules(self):
"""Verifies listing metering label rules"""
client = self.admin_metering_label_rules_client
# Verify rule filtering
body = client.list_metering_label_rules(id=33)
@@ -136,6 +138,7 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('f4d547cd-3aee-408f-bf36-454f8825e045')
def test_create_delete_metering_label_rule_with_filters(self):
"""Verifies creating and deleting metering label rule with filters"""
# Creates a rule
remote_ip_prefix = ("10.0.1.0/24" if self._ip_version == 4
else "fd03::/64")
@@ -154,7 +157,7 @@ class MeteringTestJSON(base.BaseAdminNetworkTest):

@decorators.idempotent_id('b7354489-96ea-41f3-9452-bace120fb4a7')
def test_show_metering_label_rule(self):
# Verifies the details of a rule
"""Verifies the metering details of a rule"""
client = self.admin_metering_label_rules_client
body = (client.show_metering_label_rule(
self.metering_label_rule['id']))


+ 11
- 2
tempest/api/network/admin/test_routers.py View File

@@ -27,6 +27,8 @@ CONF = config.CONF


class RoutersAdminTest(base.BaseAdminNetworkTest):
"""Test routers operation supported by admin"""

# NOTE(salv-orlando): This class inherits from BaseAdminNetworkTest
# as some router operations, such as enabling or disabling SNAT
# require admin credentials by default
@@ -52,7 +54,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):

@decorators.idempotent_id('e54dd3a3-4352-4921-b09d-44369ae17397')
def test_create_router_setting_project_id(self):
# Test creating router from admin user setting project_id.
"""Test creating router from admin user setting project_id."""
project = data_utils.rand_name('test_tenant_')
description = data_utils.rand_name('desc_')
project = identity.identity_utils(self.os_admin).create_project(
@@ -74,7 +76,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_create_router_with_default_snat_value(self):
# Create a router with default snat rule
"""Create a router with default snat rule"""
router = self._create_router(
external_network_id=CONF.network.public_network_id)
self._verify_router_gateway(
@@ -86,6 +88,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_create_router_with_snat_explicit(self):
"""Test creating router with specified enable_snat value"""
name = data_utils.rand_name('snat-router')
# Create a router enabling snat attributes
enable_snat_states = [False, True]
@@ -134,6 +137,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_update_router_set_gateway(self):
"""Test updating router's gateway info"""
router = self._create_router()
self.routers_client.update_router(
router['id'],
@@ -150,6 +154,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_update_router_set_gateway_with_snat_explicit(self):
"""Test setting router's gateway with snat enabled"""
router = self._create_router()
self.admin_routers_client.update_router(
router['id'],
@@ -167,6 +172,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_update_router_set_gateway_without_snat(self):
"""Test setting router's gateway with snat not enabled"""
router = self._create_router()
self.admin_routers_client.update_router(
router['id'],
@@ -183,6 +189,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_update_router_unset_gateway(self):
"""Test unsetting router's gateway"""
router = self._create_router(
external_network_id=CONF.network.public_network_id)
self.routers_client.update_router(router['id'],
@@ -199,6 +206,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_update_router_reset_gateway_without_snat(self):
"""Test updating router's gateway to be with snat not enabled"""
router = self._create_router(
external_network_id=CONF.network.public_network_id)
self.admin_routers_client.update_router(
@@ -215,6 +223,7 @@ class RoutersAdminTest(base.BaseAdminNetworkTest):
@decorators.idempotent_id('cbe42f84-04c2-11e7-8adb-fa163e4fa634')
@utils.requires_ext(extension='ext-gw-mode', service='network')
def test_create_router_set_gateway_with_fixed_ip(self):
"""Test creating router setting gateway with fixed ip"""
# At first create an external network and then use that
# to create address and delete
network_name = data_utils.rand_name(self.__class__.__name__)


+ 8
- 0
tempest/api/network/test_routers.py View File

@@ -27,6 +27,7 @@ CONF = config.CONF


class RoutersTest(base.BaseNetworkTest):
"""Test routers"""

def _add_router_interface_with_subnet_id(self, router_id, subnet_id):
interface = self.routers_client.add_router_interface(
@@ -53,6 +54,7 @@ class RoutersTest(base.BaseNetworkTest):
@testtools.skipUnless(CONF.network.public_network_id,
'The public_network_id option must be specified.')
def test_create_show_list_update_delete_router(self):
"""Test create/show/list/update/delete of a router"""
# Create a router
router_name = data_utils.rand_name(self.__class__.__name__ + '-router')
router = self.create_router(
@@ -87,6 +89,7 @@ class RoutersTest(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('b42e6e39-2e37-49cc-a6f4-8467e940900a')
def test_add_remove_router_interface_with_subnet_id(self):
"""Test adding and removing router interface with subnet id"""
network_name = data_utils.rand_name(self.__class__.__name__)
network = self.networks_client.create_network(
name=network_name)['network']
@@ -113,6 +116,7 @@ class RoutersTest(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('2b7d2f37-6748-4d78-92e5-1d590234f0d5')
def test_add_remove_router_interface_with_port_id(self):
"""Test adding and removing router interface with port id"""
network_name = data_utils.rand_name(self.__class__.__name__)
network = self.networks_client.create_network(
name=network_name)['network']
@@ -145,6 +149,7 @@ class RoutersTest(base.BaseNetworkTest):
@decorators.idempotent_id('c86ac3a8-50bd-4b00-a6b8-62af84a0765c')
@utils.requires_ext(extension='extraroute', service='network')
def test_update_delete_extra_route(self):
"""Test updating and deleting router with extra route"""
# Create different cidr for each subnet to avoid cidr duplicate
# The cidr starts from project_cidr
next_cidr = self.cidr
@@ -215,6 +220,7 @@ class RoutersTest(base.BaseNetworkTest):

@decorators.idempotent_id('a8902683-c788-4246-95c7-ad9c6d63a4d9')
def test_update_router_admin_state(self):
"""Test updating router's admin state"""
router = self.create_router()
self.addCleanup(self.delete_router, router)
self.assertFalse(router['admin_state_up'])
@@ -228,6 +234,7 @@ class RoutersTest(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('802c73c9-c937-4cef-824b-2191e24a6aab')
def test_add_multiple_router_interfaces(self):
"""Test adding multiple router interfaces"""
network_name = data_utils.rand_name(self.__class__.__name__)
network01 = self.networks_client.create_network(
name=network_name)['network']
@@ -258,6 +265,7 @@ class RoutersTest(base.BaseNetworkTest):

@decorators.idempotent_id('96522edf-b4b5-45d9-8443-fa11c26e6eff')
def test_router_interface_port_update_with_fixed_ip(self):
"""Test updating router interface port's fixed ip"""
network_name = data_utils.rand_name(self.__class__.__name__)
network = self.networks_client.create_network(
name=network_name)['network']


+ 10
- 0
tempest/api/network/test_routers_negative.py View File

@@ -21,6 +21,7 @@ from tempest.lib import exceptions as lib_exc


class RoutersNegativeTest(base.BaseNetworkTest):
"""Negative tests of routers"""

@classmethod
def skip_checks(cls):
@@ -39,6 +40,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('37a94fc0-a834-45b9-bd23-9a81d2fd1e22')
def test_router_add_gateway_invalid_network_returns_404(self):
"""Test adding gateway with invalid network for router"""
self.assertRaises(lib_exc.NotFound,
self.routers_client.update_router,
self.router['id'],
@@ -48,6 +50,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('11836a18-0b15-4327-a50b-f0d9dc66bddd')
def test_router_add_gateway_net_not_external_returns_400(self):
"""Test adding gateway with not external network for router"""
alt_network = self.create_network()
sub_cidr = self.cidr.next()
self.create_subnet(alt_network, cidr=sub_cidr)
@@ -60,6 +63,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('957751a3-3c68-4fa2-93b6-eb52ea10db6e')
def test_add_router_interfaces_on_overlapping_subnets_returns_400(self):
"""Test adding router interface which is on overlapping subnets"""
network01 = self.create_network(
network_name=data_utils.rand_name('router-network01-'))
network02 = self.create_network(
@@ -79,6 +83,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('04df80f9-224d-47f5-837a-bf23e33d1c20')
def test_router_remove_interface_in_use_returns_409(self):
"""Test removing in-use interface from router"""
self.routers_client.add_router_interface(self.router['id'],
subnet_id=self.subnet['id'])
self.addCleanup(self.routers_client.remove_router_interface,
@@ -90,6 +95,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c2a70d72-8826-43a7-8208-0209e6360c47')
def test_show_non_existent_router_returns_404(self):
"""Test showing non existent router"""
router = data_utils.rand_name('non_exist_router')
self.assertRaises(lib_exc.NotFound, self.routers_client.show_router,
router)
@@ -97,6 +103,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('b23d1569-8b0c-4169-8d4b-6abd34fad5c7')
def test_update_non_existent_router_returns_404(self):
"""Test updating non existent router"""
router = data_utils.rand_name('non_exist_router')
self.assertRaises(lib_exc.NotFound, self.routers_client.update_router,
router, name="new_name")
@@ -104,6 +111,7 @@ class RoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('c7edc5ad-d09d-41e6-a344-5c0c31e2e3e4')
def test_delete_non_existent_router_returns_404(self):
"""Test deleting non existent router"""
router = data_utils.rand_name('non_exist_router')
self.assertRaises(lib_exc.NotFound, self.routers_client.delete_router,
router)
@@ -114,6 +122,7 @@ class RoutersNegativeIpV6Test(RoutersNegativeTest):


class DvrRoutersNegativeTest(base.BaseNetworkTest):
"""Negative tests of DVR router"""

@classmethod
def skip_checks(cls):
@@ -125,5 +134,6 @@ class DvrRoutersNegativeTest(base.BaseNetworkTest):
@decorators.attr(type=['negative'])
@decorators.idempotent_id('4990b055-8fc7-48ab-bba7-aa28beaad0b9')
def test_router_create_tenant_distributed_returns_forbidden(self):
"""Non admin user is not allowed to create distributed router"""
self.assertRaises(lib_exc.Forbidden, self.create_router,
distributed=True)

+ 2
- 0
tempest/api/network/test_service_providers.py View File

@@ -18,12 +18,14 @@ from tempest.lib import decorators


class ServiceProvidersTest(base.BaseNetworkTest):
"""Test network service providers"""

@decorators.idempotent_id('2cbbeea9-f010-40f6-8df5-4eaa0c918ea6')
@testtools.skipUnless(
utils.is_extension_enabled('service-type', 'network'),
'service-type extension not enabled.')
def test_service_providers_list(self):
"""Test listing network service providers"""
body = self.service_providers_client.list_service_providers()
self.assertIn('service_providers', body)
self.assertIsInstance(body['service_providers'], list)

+ 1
- 0
tempest/api/network/test_subnetpools_extensions.py View File

@@ -49,6 +49,7 @@ class SubnetPoolsTestJSON(base.BaseNetworkTest):
@decorators.attr(type='smoke')
@decorators.idempotent_id('62595970-ab1c-4b7f-8fcc-fddfe55e9811')
def test_create_list_show_update_delete_subnetpools(self):
"""Test create/list/show/update/delete of subnet pools"""
subnetpool_name = data_utils.rand_name('subnetpools')
# create subnet pool
prefix = CONF.network.default_network


Loading…
Cancel
Save