Merge "Fix H404/405 violations for api tests(2/3)"

This commit is contained in:
Jenkins 2015-11-20 00:16:55 +00:00 committed by Gerrit Code Review
commit bd32ed3eae
16 changed files with 59 additions and 93 deletions

View File

@ -79,9 +79,8 @@ class AgentManagementTestJSON(base.BaseAdminNetworkTest):
self.assertEqual(updated_description, description) self.assertEqual(updated_description, description)
def _restore_agent(self): def _restore_agent(self):
""" """Restore the agent description after update test"""
Restore the agent description after update test.
"""
description = self.agent['description'] or '' description = self.agent['description'] or ''
origin_agent = {'description': description} origin_agent = {'description': description}
self.admin_client.update_agent(agent_id=self.agent['id'], self.admin_client.update_agent(agent_id=self.agent['id'],

View File

@ -91,10 +91,9 @@ class ExternalNetworksTestJSON(base.BaseAdminNetworkTest):
@test.idempotent_id('82068503-2cf2-4ed4-b3be-ecb89432e4bb') @test.idempotent_id('82068503-2cf2-4ed4-b3be-ecb89432e4bb')
def test_delete_external_networks_with_floating_ip(self): def test_delete_external_networks_with_floating_ip(self):
"""Verifies external network can be deleted while still holding # Verifies external network can be deleted while still holding
(unassociated) floating IPs # (unassociated) floating IPs
"""
# Set cls.client to admin to use base.create_subnet() # Set cls.client to admin to use base.create_subnet()
client = self.admin_client client = self.admin_client
body = self.admin_networks_client.create_network( body = self.admin_networks_client.create_network(

View File

@ -27,11 +27,9 @@ class ExternalNetworksAdminNegativeTestJSON(base.BaseAdminNetworkTest):
@test.attr(type=['negative']) @test.attr(type=['negative'])
@test.idempotent_id('d402ae6c-0be0-4d8e-833b-a738895d98d0') @test.idempotent_id('d402ae6c-0be0-4d8e-833b-a738895d98d0')
def test_create_port_with_precreated_floatingip_as_fixed_ip(self): def test_create_port_with_precreated_floatingip_as_fixed_ip(self):
""" # NOTE: External networks can be used to create both floating-ip as
External networks can be used to create both floating-ip as well # well as instance-ip. So, creating an instance-ip with a value of a
as instance-ip. So, creating an instance-ip with a value of a # pre-created floating-ip should be denied.
pre-created floating-ip should be denied.
"""
# create a floating ip # create a floating ip
client = self.admin_client client = self.admin_client

View File

@ -21,9 +21,7 @@ from tempest import test
class QuotasTest(base.BaseAdminNetworkTest): class QuotasTest(base.BaseAdminNetworkTest):
""" """Tests the following operations in the Neutron API:
Tests the following operations in the Neutron API using the REST client for
Neutron:
list quotas for tenants who have non-default quota values list quotas for tenants who have non-default quota values
show quotas for a specified tenant show quotas for a specified tenant

View File

@ -42,7 +42,8 @@ class RoutersTestDVR(base.BaseRouterTest):
@test.idempotent_id('08a2a0a8-f1e4-4b34-8e30-e522e836c44e') @test.idempotent_id('08a2a0a8-f1e4-4b34-8e30-e522e836c44e')
def test_distributed_router_creation(self): def test_distributed_router_creation(self):
""" """Test distributed router creation
Test uses administrative credentials to creates a Test uses administrative credentials to creates a
DVR (Distributed Virtual Routing) router using the DVR (Distributed Virtual Routing) router using the
distributed=True. distributed=True.
@ -59,7 +60,8 @@ class RoutersTestDVR(base.BaseRouterTest):
@test.idempotent_id('8a0a72b4-7290-4677-afeb-b4ffe37bc352') @test.idempotent_id('8a0a72b4-7290-4677-afeb-b4ffe37bc352')
def test_centralized_router_creation(self): def test_centralized_router_creation(self):
""" """Test centralized router creation
Test uses administrative credentials to creates a Test uses administrative credentials to creates a
CVR (Centralized Virtual Routing) router using the CVR (Centralized Virtual Routing) router using the
distributed=False. distributed=False.
@ -77,10 +79,11 @@ class RoutersTestDVR(base.BaseRouterTest):
@test.idempotent_id('acd43596-c1fb-439d-ada8-31ad48ae3c2e') @test.idempotent_id('acd43596-c1fb-439d-ada8-31ad48ae3c2e')
def test_centralized_router_update_to_dvr(self): def test_centralized_router_update_to_dvr(self):
""" """Test centralized router update
Test uses administrative credentials to creates a Test uses administrative credentials to creates a
CVR (Centralized Virtual Routing) router using the CVR (Centralized Virtual Routing) router using the
distributed=False.Then it will "update" the router distributed=False. Then it will "update" the router
distributed attribute to True distributed attribute to True
Acceptance Acceptance

View File

@ -28,9 +28,7 @@ LOG = logging.getLogger(__name__)
class BaseNetworkTest(tempest.test.BaseTestCase): class BaseNetworkTest(tempest.test.BaseTestCase):
"""Base class for the Neutron tests
"""
Base class for the Neutron tests that use the Tempest Neutron REST client
Per the Neutron API Guide, API v1.x was removed from the source code tree Per the Neutron API Guide, API v1.x was removed from the source code tree
(docs.openstack.org/api/openstack-network/2.0/content/Overview-d1e71.html) (docs.openstack.org/api/openstack-network/2.0/content/Overview-d1e71.html)

View File

@ -23,9 +23,9 @@ CONF = config.CONF
class AllowedAddressPairTestJSON(base.BaseNetworkTest): class AllowedAddressPairTestJSON(base.BaseNetworkTest):
""" """Tests the Neutron Allowed Address Pair API extension
Tests the Neutron Allowed Address Pair API extension using the Tempest
ReST client. The following API operations are tested with this extension: The following API operations are tested with this extension:
create port create port
list ports list ports

View File

@ -99,10 +99,9 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('e5517e62-6f16-430d-a672-f80875493d4c') @test.idempotent_id('e5517e62-6f16-430d-a672-f80875493d4c')
def test_dhcpv6_stateless_eui64(self): def test_dhcpv6_stateless_eui64(self):
"""When subnets configured with RAs SLAAC (AOM=100) and DHCP stateless # NOTE: When subnets configured with RAs SLAAC (AOM=100) and DHCP
(AOM=110) both for radvd and dnsmasq, port shall receive IP address # stateless (AOM=110) both for radvd and dnsmasq, port shall receive
calculated from its MAC. # IP address calculated from its MAC.
"""
for ra_mode, add_mode in ( for ra_mode, add_mode in (
('slaac', 'slaac'), ('slaac', 'slaac'),
('dhcpv6-stateless', 'dhcpv6-stateless'), ('dhcpv6-stateless', 'dhcpv6-stateless'),
@ -118,10 +117,9 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('ae2f4a5d-03ff-4c42-a3b0-ce2fcb7ea832') @test.idempotent_id('ae2f4a5d-03ff-4c42-a3b0-ce2fcb7ea832')
def test_dhcpv6_stateless_no_ra(self): def test_dhcpv6_stateless_no_ra(self):
"""When subnets configured with dnsmasq SLAAC and DHCP stateless # NOTE: When subnets configured with dnsmasq SLAAC and DHCP stateless
and there is no radvd, port shall receive IP address calculated # and there is no radvd, port shall receive IP address calculated
from its MAC and mask of subnet. # from its MAC and mask of subnet.
"""
for ra_mode, add_mode in ( for ra_mode, add_mode in (
(None, 'slaac'), (None, 'slaac'),
(None, 'dhcpv6-stateless'), (None, 'dhcpv6-stateless'),
@ -158,9 +156,8 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('21635b6f-165a-4d42-bf49-7d195e47342f') @test.idempotent_id('21635b6f-165a-4d42-bf49-7d195e47342f')
def test_dhcpv6_stateless_no_ra_no_dhcp(self): def test_dhcpv6_stateless_no_ra_no_dhcp(self):
"""If no radvd option and no dnsmasq option is configured # NOTE: If no radvd option and no dnsmasq option is configured
port shall receive IP from fixed IPs list of subnet. # port shall receive IP from fixed IPs list of subnet.
"""
real_ip, eui_ip = self._get_ips_from_subnet() real_ip, eui_ip = self._get_ips_from_subnet()
self._clean_network() self._clean_network()
self.assertNotEqual(eui_ip, real_ip, self.assertNotEqual(eui_ip, real_ip,
@ -171,11 +168,10 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('4544adf7-bb5f-4bdc-b769-b3e77026cef2') @test.idempotent_id('4544adf7-bb5f-4bdc-b769-b3e77026cef2')
def test_dhcpv6_two_subnets(self): def test_dhcpv6_two_subnets(self):
"""When one IPv6 subnet configured with dnsmasq SLAAC or DHCP stateless # NOTE: When one IPv6 subnet configured with dnsmasq SLAAC or DHCP
and other IPv6 is with DHCP stateful, port shall receive EUI-64 IP # stateless and other IPv6 is with DHCP stateful, port shall receive
addresses from first subnet and DHCP address from second one. # EUI-64 IP addresses from first subnet and DHCP address from second
Order of subnet creating should be unimportant. # one. Order of subnet creating should be unimportant.
"""
for order in ("slaac_first", "dhcp_first"): for order in ("slaac_first", "dhcp_first"):
for ra_mode, add_mode in ( for ra_mode, add_mode in (
('slaac', 'slaac'), ('slaac', 'slaac'),
@ -221,11 +217,10 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('4256c61d-c538-41ea-9147-3c450c36669e') @test.idempotent_id('4256c61d-c538-41ea-9147-3c450c36669e')
def test_dhcpv6_64_subnets(self): def test_dhcpv6_64_subnets(self):
"""When one IPv6 subnet configured with dnsmasq SLAAC or DHCP stateless # NOTE: When one IPv6 subnet configured with dnsmasq SLAAC or DHCP
and other IPv4 is with DHCP of IPv4, port shall receive EUI-64 IP # stateless and other IPv4 is with DHCP of IPv4, port shall receive
addresses from first subnet and IPv4 DHCP address from second one. # EUI-64 IP addresses from first subnet and IPv4 DHCP address from
Order of subnet creating should be unimportant. # second one. Order of subnet creating should be unimportant.
"""
for order in ("slaac_first", "dhcp_first"): for order in ("slaac_first", "dhcp_first"):
for ra_mode, add_mode in ( for ra_mode, add_mode in (
('slaac', 'slaac'), ('slaac', 'slaac'),
@ -265,9 +260,8 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('4ab211a0-276f-4552-9070-51e27f58fecf') @test.idempotent_id('4ab211a0-276f-4552-9070-51e27f58fecf')
def test_dhcp_stateful(self): def test_dhcp_stateful(self):
"""With all options below, DHCPv6 shall allocate address # NOTE: With all options below, DHCPv6 shall allocate address from
from subnet pool to port. # subnet pool to port.
"""
for ra_mode, add_mode in ( for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'), ('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None), ('dhcpv6-stateful', None),
@ -287,10 +281,9 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('51a5e97f-f02e-4e4e-9a17-a69811d300e3') @test.idempotent_id('51a5e97f-f02e-4e4e-9a17-a69811d300e3')
def test_dhcp_stateful_fixedips(self): def test_dhcp_stateful_fixedips(self):
"""With all options below, port shall be able to get # NOTE: With all options below, port shall be able to get
requested IP from fixed IP range not depending on # requested IP from fixed IP range not depending on
DHCP stateful (not SLAAC!) settings configured. # DHCP stateful (not SLAAC!) settings configured.
"""
for ra_mode, add_mode in ( for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'), ('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None), ('dhcpv6-stateful', None),
@ -316,9 +309,8 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('98244d88-d990-4570-91d4-6b25d70d08af') @test.idempotent_id('98244d88-d990-4570-91d4-6b25d70d08af')
def test_dhcp_stateful_fixedips_outrange(self): def test_dhcp_stateful_fixedips_outrange(self):
"""When port gets IP address from fixed IP range it # NOTE: When port gets IP address from fixed IP range it
shall be checked if it's from subnets range. # shall be checked if it's from subnets range.
"""
kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful', kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful',
'ipv6_address_mode': 'dhcpv6-stateful'} 'ipv6_address_mode': 'dhcpv6-stateful'}
subnet = self.create_subnet(self.network, **kwargs) subnet = self.create_subnet(self.network, **kwargs)
@ -334,9 +326,8 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('57b8302b-cba9-4fbb-8835-9168df029051') @test.idempotent_id('57b8302b-cba9-4fbb-8835-9168df029051')
def test_dhcp_stateful_fixedips_duplicate(self): def test_dhcp_stateful_fixedips_duplicate(self):
"""When port gets IP address from fixed IP range it # NOTE: When port gets IP address from fixed IP range it
shall be checked if it's not duplicate. # shall be checked if it's not duplicate.
"""
kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful', kwargs = {'ipv6_ra_mode': 'dhcpv6-stateful',
'ipv6_address_mode': 'dhcpv6-stateful'} 'ipv6_address_mode': 'dhcpv6-stateful'}
subnet = self.create_subnet(self.network, **kwargs) subnet = self.create_subnet(self.network, **kwargs)
@ -367,9 +358,8 @@ class NetworksTestDHCPv6(base.BaseNetworkTest):
@test.idempotent_id('e98f65db-68f4-4330-9fea-abd8c5192d4d') @test.idempotent_id('e98f65db-68f4-4330-9fea-abd8c5192d4d')
def test_dhcp_stateful_router(self): def test_dhcp_stateful_router(self):
"""With all options below the router interface shall # NOTE: With all options below the router interface shall
receive DHCPv6 IP address from allocation pool. # receive DHCPv6 IP address from allocation pool.
"""
for ra_mode, add_mode in ( for ra_mode, add_mode in (
('dhcpv6-stateful', 'dhcpv6-stateful'), ('dhcpv6-stateful', 'dhcpv6-stateful'),
('dhcpv6-stateful', None), ('dhcpv6-stateful', None),

View File

@ -19,10 +19,7 @@ from tempest import test
class ExtensionsTestJSON(base.BaseNetworkTest): class ExtensionsTestJSON(base.BaseNetworkTest):
"""Tests the following operations in the Neutron API:
"""
Tests the following operations in the Neutron API using the REST client for
Neutron:
List all available extensions List all available extensions

View File

@ -19,9 +19,7 @@ from tempest import test
class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest): class ExtraDHCPOptionsTestJSON(base.BaseNetworkTest):
""" """Tests the following operations with the Extra DHCP Options:
Tests the following operations with the Extra DHCP Options Neutron API
extension:
port create port create
port list port list

View File

@ -24,9 +24,7 @@ CONF = config.CONF
class FloatingIPTestJSON(base.BaseNetworkTest): class FloatingIPTestJSON(base.BaseNetworkTest):
""" """Tests the following operations in the Neutron API:
Tests the following operations in the Neutron API using the REST client for
Neutron:
Create a Floating IP Create a Floating IP
Update a Floating IP Update a Floating IP

View File

@ -25,8 +25,7 @@ CONF = config.CONF
class FloatingIPNegativeTestJSON(base.BaseNetworkTest): class FloatingIPNegativeTestJSON(base.BaseNetworkTest):
""" """Test the following negative operations for floating ips:
Test the following negative operations for floating ips:
Create floatingip with a port that is unreachable to external network Create floatingip with a port that is unreachable to external network
Create floatingip in private network Create floatingip in private network

View File

@ -23,9 +23,7 @@ LOG = logging.getLogger(__name__)
class MeteringTestJSON(base.BaseAdminNetworkTest): class MeteringTestJSON(base.BaseAdminNetworkTest):
""" """Tests the following operations in the Neutron API:
Tests the following operations in the Neutron API using the REST client for
Neutron:
List, Show, Create, Delete Metering labels List, Show, Create, Delete Metering labels
List, Show, Create, Delete Metering labels rules List, Show, Create, Delete Metering labels rules

View File

@ -28,9 +28,7 @@ CONF = config.CONF
class NetworksTest(base.BaseNetworkTest): class NetworksTest(base.BaseNetworkTest):
""" """Tests the following operations in the Neutron API:
Tests the following operations in the Neutron API using the REST client for
Neutron:
create a network for a tenant create a network for a tenant
list tenant's networks list tenant's networks
@ -95,9 +93,8 @@ class NetworksTest(base.BaseNetworkTest):
@classmethod @classmethod
def _create_subnet_with_last_subnet_block(cls, network, ip_version): def _create_subnet_with_last_subnet_block(cls, network, ip_version):
"""Derive last subnet CIDR block from tenant CIDR and # Derive last subnet CIDR block from tenant CIDR and
create the subnet with that derived CIDR # create the subnet with that derived CIDR
"""
if ip_version == 4: if ip_version == 4:
cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr) cidr = netaddr.IPNetwork(CONF.network.tenant_network_cidr)
mask_bits = CONF.network.tenant_network_mask_bits mask_bits = CONF.network.tenant_network_mask_bits
@ -133,9 +130,8 @@ class NetworksTest(base.BaseNetworkTest):
return [{'start': str(gateway + 2), 'end': str(gateway + 3)}] return [{'start': str(gateway + 2), 'end': str(gateway + 3)}]
def subnet_dict(self, include_keys): def subnet_dict(self, include_keys):
"""Return a subnet dict which has include_keys and their corresponding # Return a subnet dict which has include_keys and their corresponding
value from self._subnet_data # value from self._subnet_data
"""
return dict((key, self._subnet_data[self._ip_version][key]) return dict((key, self._subnet_data[self._ip_version][key])
for key in include_keys) for key in include_keys)
@ -405,9 +401,7 @@ class NetworksTest(base.BaseNetworkTest):
class BulkNetworkOpsTestJSON(base.BaseNetworkTest): class BulkNetworkOpsTestJSON(base.BaseNetworkTest):
""" """Tests the following operations in the Neutron API:
Tests the following operations in the Neutron API using the REST client for
Neutron:
bulk network creation bulk network creation
bulk subnet creation bulk subnet creation

View File

@ -28,8 +28,7 @@ CONF = config.CONF
class PortsTestJSON(sec_base.BaseSecGroupTest): class PortsTestJSON(sec_base.BaseSecGroupTest):
""" """Test the following operations for ports:
Test the following operations for ports:
port create port create
port delete port delete

View File

@ -22,9 +22,7 @@ CONF = config.CONF
class SubnetPoolsTestJSON(base.BaseNetworkTest): class SubnetPoolsTestJSON(base.BaseNetworkTest):
""" """Tests the following operations in the subnetpools API:
Tests the following operations in the subnetpools API using the REST client
for Neutron:
Create a subnet pool. Create a subnet pool.
Update a subnet pool. Update a subnet pool.