Remove nova-network tests
nova-network was removed in rocky release and tempest master does not support rocky so we can remove those tests now. Along with the tests, it also removes the below service clients: * floating_ip_pools_client * floating_ips_bulk_client * fixed_ips_client * list_virtual_interfaces Change-Id: I682ebb0e3ea0d7ef0e429ad32899c406e46ffae7
This commit is contained in:
parent
2142671ea4
commit
5b5e81c6a1
@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
prelude: >
|
||||||
|
Tempest remove the nova-network tests and service clients.
|
||||||
|
The nova-network was removed from Rocky release and current
|
||||||
|
Tempest master does not support the Rocky release. Below are
|
||||||
|
the service clients have been removed:
|
||||||
|
|
||||||
|
* floating_ip_pools_client
|
||||||
|
* floating_ips_bulk_client
|
||||||
|
* fixed_ips_client
|
||||||
|
* list_virtual_interfaces
|
@ -1,72 +0,0 @@
|
|||||||
# Copyright 2013 IBM Corp
|
|
||||||
# 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.api.compute import base
|
|
||||||
from tempest.common import utils
|
|
||||||
from tempest import config
|
|
||||||
from tempest.lib import decorators
|
|
||||||
|
|
||||||
CONF = config.CONF
|
|
||||||
|
|
||||||
|
|
||||||
class FixedIPsTestJson(base.BaseV2ComputeAdminTest):
|
|
||||||
"""Test fixed ips API"""
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def skip_checks(cls):
|
|
||||||
super(FixedIPsTestJson, cls).skip_checks()
|
|
||||||
if CONF.service_available.neutron:
|
|
||||||
msg = ("%s skipped as neutron is available" % cls.__name__)
|
|
||||||
raise cls.skipException(msg)
|
|
||||||
if not utils.get_service_list()['network']:
|
|
||||||
raise cls.skipException("network service not enabled.")
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_clients(cls):
|
|
||||||
super(FixedIPsTestJson, cls).setup_clients()
|
|
||||||
cls.client = cls.os_admin.fixed_ips_client
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def resource_setup(cls):
|
|
||||||
super(FixedIPsTestJson, cls).resource_setup()
|
|
||||||
server = cls.create_test_server(wait_until='ACTIVE')
|
|
||||||
server = cls.servers_client.show_server(server['id'])['server']
|
|
||||||
cls.ip = None
|
|
||||||
for ip_set in server['addresses']:
|
|
||||||
for ip in server['addresses'][ip_set]:
|
|
||||||
if ip['OS-EXT-IPS:type'] == 'fixed':
|
|
||||||
cls.ip = ip['addr']
|
|
||||||
break
|
|
||||||
if cls.ip:
|
|
||||||
break
|
|
||||||
if cls.ip is None:
|
|
||||||
raise cls.skipException("No fixed ip found for server: %s"
|
|
||||||
% server['id'])
|
|
||||||
|
|
||||||
@decorators.idempotent_id('16b7d848-2f7c-4709-85a3-2dfb4576cc52')
|
|
||||||
def test_list_fixed_ip_details(self):
|
|
||||||
"""Test getting fixed ip details"""
|
|
||||||
fixed_ip = self.client.show_fixed_ip(self.ip)
|
|
||||||
self.assertEqual(fixed_ip['fixed_ip']['address'], self.ip)
|
|
||||||
|
|
||||||
@decorators.idempotent_id('5485077b-7e46-4cec-b402-91dc3173433b')
|
|
||||||
def test_set_reserve(self):
|
|
||||||
"""Test reserving fixed ip"""
|
|
||||||
self.client.reserve_fixed_ip(self.ip, reserve="None")
|
|
||||||
|
|
||||||
@decorators.idempotent_id('7476e322-b9ff-4710-bf82-49d51bac6e2e')
|
|
||||||
def test_set_unreserve(self):
|
|
||||||
"""Test unreserving fixed ip"""
|
|
||||||
self.client.reserve_fixed_ip(self.ip, unreserve="None")
|
|
@ -1,101 +0,0 @@
|
|||||||
# Copyright 2013 NEC Corporation. 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.api.compute import base
|
|
||||||
from tempest.common import utils
|
|
||||||
from tempest import config
|
|
||||||
from tempest.lib import decorators
|
|
||||||
from tempest.lib import exceptions as lib_exc
|
|
||||||
|
|
||||||
CONF = config.CONF
|
|
||||||
|
|
||||||
|
|
||||||
class FixedIPsNegativeTestJson(base.BaseV2ComputeAdminTest):
|
|
||||||
"""Negative tests of fixed ips API"""
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def skip_checks(cls):
|
|
||||||
super(FixedIPsNegativeTestJson, cls).skip_checks()
|
|
||||||
if CONF.service_available.neutron:
|
|
||||||
msg = ("%s skipped as neutron is available" % cls.__name__)
|
|
||||||
raise cls.skipException(msg)
|
|
||||||
if not utils.get_service_list()['network']:
|
|
||||||
raise cls.skipException("network service not enabled.")
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_clients(cls):
|
|
||||||
super(FixedIPsNegativeTestJson, cls).setup_clients()
|
|
||||||
cls.client = cls.os_admin.fixed_ips_client
|
|
||||||
cls.non_admin_client = cls.fixed_ips_client
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def resource_setup(cls):
|
|
||||||
super(FixedIPsNegativeTestJson, cls).resource_setup()
|
|
||||||
server = cls.create_test_server(wait_until='ACTIVE')
|
|
||||||
server = cls.servers_client.show_server(server['id'])['server']
|
|
||||||
cls.ip = None
|
|
||||||
for ip_set in server['addresses']:
|
|
||||||
for ip in server['addresses'][ip_set]:
|
|
||||||
if ip['OS-EXT-IPS:type'] == 'fixed':
|
|
||||||
cls.ip = ip['addr']
|
|
||||||
break
|
|
||||||
if cls.ip:
|
|
||||||
break
|
|
||||||
if cls.ip is None:
|
|
||||||
raise cls.skipException("No fixed ip found for server: %s"
|
|
||||||
% server['id'])
|
|
||||||
|
|
||||||
@decorators.attr(type=['negative'])
|
|
||||||
@decorators.idempotent_id('9f17f47d-daad-4adc-986e-12370c93e407')
|
|
||||||
def test_list_fixed_ip_details_with_non_admin_user(self):
|
|
||||||
"""Test listing fixed ip with detail by non-admin user is forbidden"""
|
|
||||||
self.assertRaises(lib_exc.Forbidden,
|
|
||||||
self.non_admin_client.show_fixed_ip, self.ip)
|
|
||||||
|
|
||||||
@decorators.attr(type=['negative'])
|
|
||||||
@decorators.idempotent_id('ce60042c-fa60-4836-8d43-1c8e3359dc47')
|
|
||||||
def test_set_reserve_with_non_admin_user(self):
|
|
||||||
"""Test reserving fixed ip by non-admin user is forbidden"""
|
|
||||||
self.assertRaises(lib_exc.Forbidden,
|
|
||||||
self.non_admin_client.reserve_fixed_ip,
|
|
||||||
self.ip, reserve="None")
|
|
||||||
|
|
||||||
@decorators.attr(type=['negative'])
|
|
||||||
@decorators.idempotent_id('f1f7a35b-0390-48c5-9803-5f27461439db')
|
|
||||||
def test_set_unreserve_with_non_admin_user(self):
|
|
||||||
"""Test unreserving fixed ip by non-admin user is forbidden"""
|
|
||||||
self.assertRaises(lib_exc.Forbidden,
|
|
||||||
self.non_admin_client.reserve_fixed_ip,
|
|
||||||
self.ip, unreserve="None")
|
|
||||||
|
|
||||||
@decorators.attr(type=['negative'])
|
|
||||||
@decorators.idempotent_id('f51cf464-7fc5-4352-bc3e-e75cfa2cb717')
|
|
||||||
def test_set_reserve_with_invalid_ip(self):
|
|
||||||
"""Test reserving invalid fixed ip should fail"""
|
|
||||||
# NOTE(maurosr): since this exercises the same code snippet, we do it
|
|
||||||
# only for reserve action
|
|
||||||
# NOTE(eliqiao): in Juno, the exception is NotFound, but in master, we
|
|
||||||
# change the error code to BadRequest, both exceptions should be
|
|
||||||
# accepted by tempest
|
|
||||||
self.assertRaises((lib_exc.NotFound, lib_exc.BadRequest),
|
|
||||||
self.client.reserve_fixed_ip,
|
|
||||||
"my.invalid.ip", reserve="None")
|
|
||||||
|
|
||||||
@decorators.attr(type=['negative'])
|
|
||||||
@decorators.idempotent_id('fd26ef50-f135-4232-9d32-281aab3f9176')
|
|
||||||
def test_fixed_ip_with_invalid_action(self):
|
|
||||||
"""Test operating fixed ip with invalid action should fail"""
|
|
||||||
self.assertRaises(lib_exc.BadRequest,
|
|
||||||
self.client.reserve_fixed_ip,
|
|
||||||
self.ip, invalid_action="None")
|
|
@ -1,85 +0,0 @@
|
|||||||
# Copyright 2014 NEC Technologies India Ltd.
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
import netaddr
|
|
||||||
|
|
||||||
from tempest.api.compute import base
|
|
||||||
from tempest.common import utils
|
|
||||||
from tempest import config
|
|
||||||
from tempest.lib.common.utils import test_utils
|
|
||||||
from tempest.lib import decorators
|
|
||||||
from tempest.lib import exceptions
|
|
||||||
|
|
||||||
CONF = config.CONF
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(stephenfin): Remove this test class once the nova queens branch goes
|
|
||||||
# into extended maintenance mode.
|
|
||||||
class FloatingIPsBulkAdminTestJSON(base.BaseV2ComputeAdminTest):
|
|
||||||
"""Tests Floating IPs Bulk APIs that require admin privileges.
|
|
||||||
|
|
||||||
API documentation - http://docs.openstack.org/api/openstack-compute/2/
|
|
||||||
content/ext-os-floating-ips-bulk.html
|
|
||||||
"""
|
|
||||||
max_microversion = '2.35'
|
|
||||||
depends_on_nova_network = True
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_clients(cls):
|
|
||||||
super(FloatingIPsBulkAdminTestJSON, cls).setup_clients()
|
|
||||||
cls.client = cls.os_admin.floating_ips_bulk_client
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def resource_setup(cls):
|
|
||||||
super(FloatingIPsBulkAdminTestJSON, cls).resource_setup()
|
|
||||||
cls.ip_range = CONF.validation.floating_ip_range
|
|
||||||
cls.verify_unallocated_floating_ip_range(cls.ip_range)
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def verify_unallocated_floating_ip_range(cls, ip_range):
|
|
||||||
# Verify whether configure floating IP range is not already allocated.
|
|
||||||
body = cls.client.list_floating_ips_bulk()['floating_ip_info']
|
|
||||||
allocated_ips_list = map(lambda x: x['address'], body)
|
|
||||||
for ip_addr in netaddr.IPNetwork(ip_range).iter_hosts():
|
|
||||||
if str(ip_addr) in allocated_ips_list:
|
|
||||||
msg = ("Configured unallocated floating IP range is already "
|
|
||||||
"allocated. Configure the correct unallocated range "
|
|
||||||
"as 'floating_ip_range'")
|
|
||||||
raise exceptions.InvalidConfiguration(msg)
|
|
||||||
return
|
|
||||||
|
|
||||||
@decorators.idempotent_id('2c8f145f-8012-4cb8-ac7e-95a587f0e4ab')
|
|
||||||
@utils.services('network')
|
|
||||||
def test_create_list_delete_floating_ips_bulk(self):
|
|
||||||
"""Creating, listing and deleting the Floating IPs Bulk"""
|
|
||||||
pool = 'test_pool'
|
|
||||||
# NOTE(GMann): Reserving the IP range but those are not attached
|
|
||||||
# anywhere. Using the below mentioned interface which is not ever
|
|
||||||
# expected to be used. Clean Up has been done for created IP range
|
|
||||||
interface = 'eth0'
|
|
||||||
body = (self.client.create_floating_ips_bulk(self.ip_range,
|
|
||||||
pool,
|
|
||||||
interface)
|
|
||||||
['floating_ips_bulk_create'])
|
|
||||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
|
||||||
self.client.delete_floating_ips_bulk, self.ip_range)
|
|
||||||
self.assertEqual(self.ip_range, body['ip_range'])
|
|
||||||
ips_list = self.client.list_floating_ips_bulk()['floating_ip_info']
|
|
||||||
self.assertNotEmpty(ips_list)
|
|
||||||
for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():
|
|
||||||
self.assertIn(str(ip), map(lambda x: x['address'], ips_list))
|
|
||||||
body = (self.client.delete_floating_ips_bulk(self.ip_range)
|
|
||||||
['floating_ips_bulk_delete'])
|
|
||||||
self.assertEqual(self.ip_range, body)
|
|
@ -79,7 +79,6 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
|||||||
cls.flavors_client = cls.os_primary.flavors_client
|
cls.flavors_client = cls.os_primary.flavors_client
|
||||||
cls.compute_images_client = cls.os_primary.compute_images_client
|
cls.compute_images_client = cls.os_primary.compute_images_client
|
||||||
cls.extensions_client = cls.os_primary.extensions_client
|
cls.extensions_client = cls.os_primary.extensions_client
|
||||||
cls.floating_ip_pools_client = cls.os_primary.floating_ip_pools_client
|
|
||||||
cls.floating_ips_client = cls.os_primary.compute_floating_ips_client
|
cls.floating_ips_client = cls.os_primary.compute_floating_ips_client
|
||||||
cls.keypairs_client = cls.os_primary.keypairs_client
|
cls.keypairs_client = cls.os_primary.keypairs_client
|
||||||
cls.security_group_rules_client = (
|
cls.security_group_rules_client = (
|
||||||
@ -94,7 +93,6 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
|||||||
cls.snapshots_extensions_client =\
|
cls.snapshots_extensions_client =\
|
||||||
cls.os_primary.snapshots_extensions_client
|
cls.os_primary.snapshots_extensions_client
|
||||||
cls.interfaces_client = cls.os_primary.interfaces_client
|
cls.interfaces_client = cls.os_primary.interfaces_client
|
||||||
cls.fixed_ips_client = cls.os_primary.fixed_ips_client
|
|
||||||
cls.availability_zone_client = cls.os_primary.availability_zone_client
|
cls.availability_zone_client = cls.os_primary.availability_zone_client
|
||||||
cls.agents_client = cls.os_primary.agents_client
|
cls.agents_client = cls.os_primary.agents_client
|
||||||
cls.aggregates_client = cls.os_primary.aggregates_client
|
cls.aggregates_client = cls.os_primary.aggregates_client
|
||||||
@ -120,35 +118,6 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
|||||||
raise lib_exc.InvalidConfiguration(
|
raise lib_exc.InvalidConfiguration(
|
||||||
'Either api_v1 or api_v2 must be True in '
|
'Either api_v1 or api_v2 must be True in '
|
||||||
'[image-feature-enabled].')
|
'[image-feature-enabled].')
|
||||||
cls._check_depends_on_nova_network()
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def _check_depends_on_nova_network(cls):
|
|
||||||
# Since nova-network APIs were removed from Nova in the Rocky release,
|
|
||||||
# determine, based on the max version from the version document, if
|
|
||||||
# the compute API is >Queens and if so, skip tests that rely on
|
|
||||||
# nova-network.
|
|
||||||
if not getattr(cls, 'depends_on_nova_network', False):
|
|
||||||
return
|
|
||||||
versions = cls.versions_client.list_versions()['versions']
|
|
||||||
# Find the v2.1 version which will tell us our max version for the
|
|
||||||
# compute API we're testing against.
|
|
||||||
for version in versions:
|
|
||||||
if version['id'] == 'v2.1':
|
|
||||||
max_version = api_version_request.APIVersionRequest(
|
|
||||||
version['version'])
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
LOG.warning(
|
|
||||||
'Unable to determine max v2.1 compute API version: %s',
|
|
||||||
versions)
|
|
||||||
return
|
|
||||||
|
|
||||||
# The max compute API version in Queens is 2.60 so we cap
|
|
||||||
# at that version.
|
|
||||||
queens = api_version_request.APIVersionRequest('2.60')
|
|
||||||
if max_version > queens:
|
|
||||||
raise cls.skipException('nova-network is gone')
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resource_setup(cls):
|
def resource_setup(cls):
|
||||||
|
@ -41,4 +41,3 @@ class BaseFloatingIPsTest(base.BaseV2ComputeTest):
|
|||||||
def setup_clients(cls):
|
def setup_clients(cls):
|
||||||
super(BaseFloatingIPsTest, cls).setup_clients()
|
super(BaseFloatingIPsTest, cls).setup_clients()
|
||||||
cls.client = cls.floating_ips_client
|
cls.client = cls.floating_ips_client
|
||||||
cls.pools_client = cls.floating_ip_pools_client
|
|
||||||
|
@ -66,10 +66,3 @@ class FloatingIPDetailsTestJSON(base.BaseFloatingIPsTest):
|
|||||||
self.assertEqual(floating_ip_fixed_ip,
|
self.assertEqual(floating_ip_fixed_ip,
|
||||||
body['fixed_ip'])
|
body['fixed_ip'])
|
||||||
self.assertEqual(floating_ip_id, body['id'])
|
self.assertEqual(floating_ip_id, body['id'])
|
||||||
|
|
||||||
@decorators.idempotent_id('df389fc8-56f5-43cc-b290-20eda39854d3')
|
|
||||||
def test_list_floating_ip_pools(self):
|
|
||||||
"""Test listing floating ip pools"""
|
|
||||||
floating_ip_pools = self.pools_client.list_floating_ip_pools()
|
|
||||||
self.assertNotEmpty(floating_ip_pools['floating_ip_pools'],
|
|
||||||
"Expected floating IP Pools. Got zero.")
|
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
# Copyright 2013 OpenStack Foundation
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
import netaddr
|
|
||||||
import testtools
|
|
||||||
|
|
||||||
from tempest.api.compute import base
|
|
||||||
from tempest.common import utils
|
|
||||||
from tempest import config
|
|
||||||
from tempest.lib import decorators
|
|
||||||
from tempest.lib import exceptions
|
|
||||||
|
|
||||||
CONF = config.CONF
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(mriedem): Remove this test class once the nova queens branch goes into
|
|
||||||
# extended maintenance mode.
|
|
||||||
class VirtualInterfacesTestJSON(base.BaseV2ComputeTest):
|
|
||||||
"""Test virtual interfaces API with compute microversion less than 2.44"""
|
|
||||||
|
|
||||||
max_microversion = '2.43'
|
|
||||||
|
|
||||||
depends_on_nova_network = True
|
|
||||||
|
|
||||||
create_default_network = True
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_clients(cls):
|
|
||||||
super(VirtualInterfacesTestJSON, cls).setup_clients()
|
|
||||||
cls.client = cls.servers_client
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def resource_setup(cls):
|
|
||||||
super(VirtualInterfacesTestJSON, cls).resource_setup()
|
|
||||||
cls.server = cls.create_test_server(wait_until='ACTIVE')
|
|
||||||
|
|
||||||
@decorators.idempotent_id('96c4e2ef-5e4d-4d7f-87f5-fed6dca18016')
|
|
||||||
@utils.services('network')
|
|
||||||
def test_list_virtual_interfaces(self):
|
|
||||||
"""Test listing virtual interfaces of a server"""
|
|
||||||
if CONF.service_available.neutron:
|
|
||||||
with testtools.ExpectedException(exceptions.BadRequest):
|
|
||||||
self.client.list_virtual_interfaces(self.server['id'])
|
|
||||||
else:
|
|
||||||
output = self.client.list_virtual_interfaces(self.server['id'])
|
|
||||||
virt_ifaces = output['virtual_interfaces']
|
|
||||||
self.assertNotEmpty(virt_ifaces,
|
|
||||||
'Expected virtual interfaces, got 0 '
|
|
||||||
'interfaces.')
|
|
||||||
for virt_iface in virt_ifaces:
|
|
||||||
mac_address = virt_iface['mac_address']
|
|
||||||
self.assertTrue(netaddr.valid_mac(mac_address),
|
|
||||||
"Invalid mac address detected. mac address: %s"
|
|
||||||
% mac_address)
|
|
@ -1,50 +0,0 @@
|
|||||||
# Copyright 2013 OpenStack Foundation
|
|
||||||
# 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.api.compute import base
|
|
||||||
from tempest.common import utils
|
|
||||||
from tempest.lib.common.utils import data_utils
|
|
||||||
from tempest.lib import decorators
|
|
||||||
from tempest.lib import exceptions as lib_exc
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(mriedem): Remove this test class once the nova queens branch goes into
|
|
||||||
# extended maintenance mode.
|
|
||||||
class VirtualInterfacesNegativeTestJSON(base.BaseV2ComputeTest):
|
|
||||||
"""Negative tests of virtual interfaces API
|
|
||||||
|
|
||||||
Negative tests of virtual interfaces API for compute microversion less
|
|
||||||
than 2.44.
|
|
||||||
"""
|
|
||||||
|
|
||||||
max_microversion = '2.43'
|
|
||||||
|
|
||||||
depends_on_nova_network = True
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def setup_credentials(cls):
|
|
||||||
# For this test no network resources are needed
|
|
||||||
cls.set_network_resources()
|
|
||||||
super(VirtualInterfacesNegativeTestJSON, cls).setup_credentials()
|
|
||||||
|
|
||||||
@decorators.attr(type=['negative'])
|
|
||||||
@decorators.idempotent_id('64ebd03c-1089-4306-93fa-60f5eb5c803c')
|
|
||||||
@utils.services('network')
|
|
||||||
def test_list_virtual_interfaces_invalid_server_id(self):
|
|
||||||
"""Test listing virtual interfaces of an invalid server should fail"""
|
|
||||||
invalid_server_id = data_utils.rand_uuid()
|
|
||||||
self.assertRaises(lib_exc.NotFound,
|
|
||||||
self.servers_client.list_virtual_interfaces,
|
|
||||||
invalid_server_id)
|
|
@ -124,15 +124,12 @@ class Manager(clients.ServiceClients):
|
|||||||
self.quota_classes_client = self.compute.QuotaClassesClient()
|
self.quota_classes_client = self.compute.QuotaClassesClient()
|
||||||
self.flavors_client = self.compute.FlavorsClient()
|
self.flavors_client = self.compute.FlavorsClient()
|
||||||
self.extensions_client = self.compute.ExtensionsClient()
|
self.extensions_client = self.compute.ExtensionsClient()
|
||||||
self.floating_ip_pools_client = self.compute.FloatingIPPoolsClient()
|
|
||||||
self.floating_ips_bulk_client = self.compute.FloatingIPsBulkClient()
|
|
||||||
self.compute_floating_ips_client = self.compute.FloatingIPsClient()
|
self.compute_floating_ips_client = self.compute.FloatingIPsClient()
|
||||||
self.compute_security_group_rules_client = (
|
self.compute_security_group_rules_client = (
|
||||||
self.compute.SecurityGroupRulesClient())
|
self.compute.SecurityGroupRulesClient())
|
||||||
self.compute_security_groups_client = (
|
self.compute_security_groups_client = (
|
||||||
self.compute.SecurityGroupsClient())
|
self.compute.SecurityGroupsClient())
|
||||||
self.interfaces_client = self.compute.InterfacesClient()
|
self.interfaces_client = self.compute.InterfacesClient()
|
||||||
self.fixed_ips_client = self.compute.FixedIPsClient()
|
|
||||||
self.availability_zone_client = self.compute.AvailabilityZoneClient()
|
self.availability_zone_client = self.compute.AvailabilityZoneClient()
|
||||||
self.aggregates_client = self.compute.AggregatesClient()
|
self.aggregates_client = self.compute.AggregatesClient()
|
||||||
self.services_client = self.compute.ServicesClient()
|
self.services_client = self.compute.ServicesClient()
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
# Copyright 2014 NEC Corporation. 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.lib.api_schema.response.compute.v2_1 import parameter_types
|
|
||||||
|
|
||||||
get_fixed_ip = {
|
|
||||||
'status_code': [200],
|
|
||||||
'response_body': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'fixed_ip': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'address': parameter_types.ip_address,
|
|
||||||
'cidr': {'type': 'string'},
|
|
||||||
'host': {'type': 'string'},
|
|
||||||
'hostname': {'type': 'string'}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['address', 'cidr', 'host', 'hostname']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['fixed_ip']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reserve_unreserve_fixed_ip = {
|
|
||||||
'status_code': [202]
|
|
||||||
}
|
|
@ -58,91 +58,6 @@ create_get_floating_ip = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list_floating_ip_pools = {
|
|
||||||
'status_code': [200],
|
|
||||||
'response_body': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'floating_ip_pools': {
|
|
||||||
'type': 'array',
|
|
||||||
'items': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'name': {'type': 'string'}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['name'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['floating_ip_pools'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
add_remove_floating_ip = {
|
add_remove_floating_ip = {
|
||||||
'status_code': [202]
|
'status_code': [202]
|
||||||
}
|
}
|
||||||
|
|
||||||
create_floating_ips_bulk = {
|
|
||||||
'status_code': [200],
|
|
||||||
'response_body': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'floating_ips_bulk_create': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'interface': {'type': ['string', 'null']},
|
|
||||||
'ip_range': {'type': 'string'},
|
|
||||||
'pool': {'type': ['string', 'null']},
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['interface', 'ip_range', 'pool'],
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['floating_ips_bulk_create'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete_floating_ips_bulk = {
|
|
||||||
'status_code': [200],
|
|
||||||
'response_body': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'floating_ips_bulk_delete': {'type': 'string'}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['floating_ips_bulk_delete'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
list_floating_ips_bulk = {
|
|
||||||
'status_code': [200],
|
|
||||||
'response_body': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'floating_ip_info': {
|
|
||||||
'type': 'array',
|
|
||||||
'items': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'address': parameter_types.ip_address,
|
|
||||||
'instance_uuid': {'type': ['string', 'null']},
|
|
||||||
'interface': {'type': ['string', 'null']},
|
|
||||||
'pool': {'type': ['string', 'null']},
|
|
||||||
'project_id': {'type': ['string', 'null']},
|
|
||||||
'fixed_ip': parameter_types.ip_address
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
# NOTE: fixed_ip is introduced after JUNO release,
|
|
||||||
# So it is not defined as 'required'.
|
|
||||||
'required': ['address', 'instance_uuid', 'interface',
|
|
||||||
'pool', 'project_id'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['floating_ip_info'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -250,33 +250,6 @@ rescue_server_with_admin_pass['response_body'].update(
|
|||||||
rescue_server_with_admin_pass['response_body'].update(
|
rescue_server_with_admin_pass['response_body'].update(
|
||||||
{'required': ['adminPass']})
|
{'required': ['adminPass']})
|
||||||
|
|
||||||
|
|
||||||
list_virtual_interfaces = {
|
|
||||||
'status_code': [200],
|
|
||||||
'response_body': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'virtual_interfaces': {
|
|
||||||
'type': 'array',
|
|
||||||
'items': {
|
|
||||||
'type': 'object',
|
|
||||||
'properties': {
|
|
||||||
'id': {'type': 'string'},
|
|
||||||
'mac_address': parameter_types.mac_address,
|
|
||||||
'OS-EXT-VIF-NET:net_id': {'type': 'string'}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
# 'OS-EXT-VIF-NET:net_id' is API extension So it is
|
|
||||||
# not defined as 'required'
|
|
||||||
'required': ['id', 'mac_address']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'additionalProperties': False,
|
|
||||||
'required': ['virtual_interfaces']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
common_attach_volume_info = {
|
common_attach_volume_info = {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
@ -24,12 +24,7 @@ from tempest.lib.services.compute.certificates_client import \
|
|||||||
CertificatesClient
|
CertificatesClient
|
||||||
from tempest.lib.services.compute.extensions_client import \
|
from tempest.lib.services.compute.extensions_client import \
|
||||||
ExtensionsClient
|
ExtensionsClient
|
||||||
from tempest.lib.services.compute.fixed_ips_client import FixedIPsClient
|
|
||||||
from tempest.lib.services.compute.flavors_client import FlavorsClient
|
from tempest.lib.services.compute.flavors_client import FlavorsClient
|
||||||
from tempest.lib.services.compute.floating_ip_pools_client import \
|
|
||||||
FloatingIPPoolsClient
|
|
||||||
from tempest.lib.services.compute.floating_ips_bulk_client import \
|
|
||||||
FloatingIPsBulkClient
|
|
||||||
from tempest.lib.services.compute.floating_ips_client import \
|
from tempest.lib.services.compute.floating_ips_client import \
|
||||||
FloatingIPsClient
|
FloatingIPsClient
|
||||||
from tempest.lib.services.compute.hosts_client import HostsClient
|
from tempest.lib.services.compute.hosts_client import HostsClient
|
||||||
@ -69,10 +64,9 @@ from tempest.lib.services.compute.volumes_client import \
|
|||||||
|
|
||||||
__all__ = ['AgentsClient', 'AggregatesClient', 'AssistedVolumeSnapshotsClient',
|
__all__ = ['AgentsClient', 'AggregatesClient', 'AssistedVolumeSnapshotsClient',
|
||||||
'AvailabilityZoneClient', 'BaremetalNodesClient',
|
'AvailabilityZoneClient', 'BaremetalNodesClient',
|
||||||
'CertificatesClient', 'ExtensionsClient', 'FixedIPsClient',
|
'CertificatesClient', 'ExtensionsClient', 'FlavorsClient',
|
||||||
'FlavorsClient', 'FloatingIPPoolsClient',
|
'FloatingIPsClient', 'HostsClient', 'HypervisorClient',
|
||||||
'FloatingIPsBulkClient', 'FloatingIPsClient', 'HostsClient',
|
'ImagesClient', 'InstanceUsagesAuditLogClient',
|
||||||
'HypervisorClient', 'ImagesClient', 'InstanceUsagesAuditLogClient',
|
|
||||||
'InterfacesClient', 'KeyPairsClient', 'LimitsClient',
|
'InterfacesClient', 'KeyPairsClient', 'LimitsClient',
|
||||||
'MigrationsClient', 'NetworksClient', 'QuotaClassesClient',
|
'MigrationsClient', 'NetworksClient', 'QuotaClassesClient',
|
||||||
'QuotasClient', 'SecurityGroupDefaultRulesClient',
|
'QuotasClient', 'SecurityGroupDefaultRulesClient',
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
# Copyright 2013 IBM Corp
|
|
||||||
# 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 oslo_serialization import jsonutils as json
|
|
||||||
|
|
||||||
from tempest.lib.api_schema.response.compute.v2_1 import fixed_ips as schema
|
|
||||||
from tempest.lib.common import rest_client
|
|
||||||
from tempest.lib.services.compute import base_compute_client
|
|
||||||
|
|
||||||
|
|
||||||
class FixedIPsClient(base_compute_client.BaseComputeClient):
|
|
||||||
|
|
||||||
def show_fixed_ip(self, fixed_ip):
|
|
||||||
url = "os-fixed-ips/%s" % fixed_ip
|
|
||||||
resp, body = self.get(url)
|
|
||||||
body = json.loads(body)
|
|
||||||
self.validate_response(schema.get_fixed_ip, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
||||||
|
|
||||||
def reserve_fixed_ip(self, fixed_ip, **kwargs):
|
|
||||||
"""Reserve/Unreserve a fixed IP.
|
|
||||||
|
|
||||||
For a full list of available parameters, please refer to the official
|
|
||||||
API reference:
|
|
||||||
https://docs.openstack.org/api-ref/compute/#reserve-or-release-a-fixed-ip
|
|
||||||
"""
|
|
||||||
url = "os-fixed-ips/%s/action" % fixed_ip
|
|
||||||
resp, body = self.post(url, json.dumps(kwargs))
|
|
||||||
self.validate_response(schema.reserve_unreserve_fixed_ip, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
@ -1,36 +0,0 @@
|
|||||||
# Copyright 2012 OpenStack Foundation
|
|
||||||
# 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 urllib import parse as urllib
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils as json
|
|
||||||
|
|
||||||
from tempest.lib.api_schema.response.compute.v2_1 import floating_ips as schema
|
|
||||||
from tempest.lib.common import rest_client
|
|
||||||
from tempest.lib.services.compute import base_compute_client
|
|
||||||
|
|
||||||
|
|
||||||
class FloatingIPPoolsClient(base_compute_client.BaseComputeClient):
|
|
||||||
|
|
||||||
def list_floating_ip_pools(self, params=None):
|
|
||||||
"""Gets all floating IP Pools list."""
|
|
||||||
url = 'os-floating-ip-pools'
|
|
||||||
if params:
|
|
||||||
url += '?%s' % urllib.urlencode(params)
|
|
||||||
|
|
||||||
resp, body = self.get(url)
|
|
||||||
body = json.loads(body)
|
|
||||||
self.validate_response(schema.list_floating_ip_pools, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
@ -1,51 +0,0 @@
|
|||||||
# Copyright 2012 OpenStack Foundation
|
|
||||||
# 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 oslo_serialization import jsonutils as json
|
|
||||||
|
|
||||||
from tempest.lib.api_schema.response.compute.v2_1 import floating_ips as schema
|
|
||||||
from tempest.lib.common import rest_client
|
|
||||||
from tempest.lib.services.compute import base_compute_client
|
|
||||||
|
|
||||||
|
|
||||||
class FloatingIPsBulkClient(base_compute_client.BaseComputeClient):
|
|
||||||
|
|
||||||
def create_floating_ips_bulk(self, ip_range, pool, interface):
|
|
||||||
"""Allocate floating IPs in bulk."""
|
|
||||||
post_body = {
|
|
||||||
'ip_range': ip_range,
|
|
||||||
'pool': pool,
|
|
||||||
'interface': interface
|
|
||||||
}
|
|
||||||
post_body = json.dumps({'floating_ips_bulk_create': post_body})
|
|
||||||
resp, body = self.post('os-floating-ips-bulk', post_body)
|
|
||||||
body = json.loads(body)
|
|
||||||
self.validate_response(schema.create_floating_ips_bulk, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
||||||
|
|
||||||
def list_floating_ips_bulk(self):
|
|
||||||
"""Gets all floating IPs in bulk."""
|
|
||||||
resp, body = self.get('os-floating-ips-bulk')
|
|
||||||
body = json.loads(body)
|
|
||||||
self.validate_response(schema.list_floating_ips_bulk, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
||||||
|
|
||||||
def delete_floating_ips_bulk(self, ip_range):
|
|
||||||
"""Deletes the provided floating IPs in bulk."""
|
|
||||||
post_body = json.dumps({'ip_range': ip_range})
|
|
||||||
resp, body = self.put('os-floating-ips-bulk/delete', post_body)
|
|
||||||
body = json.loads(body)
|
|
||||||
self.validate_response(schema.delete_floating_ips_bulk, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
@ -676,14 +676,6 @@ class ServersClient(base_compute_client.BaseComputeClient):
|
|||||||
self.validate_response(schema.get_remote_consoles, resp, body)
|
self.validate_response(schema.get_remote_consoles, resp, body)
|
||||||
return rest_client.ResponseBody(resp, body)
|
return rest_client.ResponseBody(resp, body)
|
||||||
|
|
||||||
def list_virtual_interfaces(self, server_id):
|
|
||||||
"""List the virtual interfaces used in an instance."""
|
|
||||||
resp, body = self.get('/'.join(['servers', server_id,
|
|
||||||
'os-virtual-interfaces']))
|
|
||||||
body = json.loads(body)
|
|
||||||
self.validate_response(schema.list_virtual_interfaces, resp, body)
|
|
||||||
return rest_client.ResponseBody(resp, body)
|
|
||||||
|
|
||||||
def rescue_server(self, server_id, **kwargs):
|
def rescue_server(self, server_id, **kwargs):
|
||||||
"""Rescue the provided server.
|
"""Rescue the provided server.
|
||||||
|
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
# Copyright 2015 NEC Corporation. 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.lib.services.compute import fixed_ips_client
|
|
||||||
from tempest.tests.lib import fake_auth_provider
|
|
||||||
from tempest.tests.lib.services import base
|
|
||||||
|
|
||||||
|
|
||||||
class TestFixedIPsClient(base.BaseServiceTest):
|
|
||||||
FIXED_IP_INFO = {"fixed_ip": {"address": "10.0.0.1",
|
|
||||||
"cidr": "10.11.12.0/24",
|
|
||||||
"host": "localhost",
|
|
||||||
"hostname": "OpenStack"}}
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestFixedIPsClient, self).setUp()
|
|
||||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
|
||||||
self.fixedIPsClient = (fixed_ips_client.
|
|
||||||
FixedIPsClient
|
|
||||||
(fake_auth, 'compute',
|
|
||||||
'regionOne'))
|
|
||||||
|
|
||||||
def _test_show_fixed_ip(self, bytes_body=False):
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.fixedIPsClient.show_fixed_ip,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
|
||||||
self.FIXED_IP_INFO, bytes_body,
|
|
||||||
status=200, fixed_ip='Identifier')
|
|
||||||
|
|
||||||
def test_show_fixed_ip_with_str_body(self):
|
|
||||||
self._test_show_fixed_ip()
|
|
||||||
|
|
||||||
def test_show_fixed_ip_with_bytes_body(self):
|
|
||||||
self._test_show_fixed_ip(True)
|
|
||||||
|
|
||||||
def _test_reserve_fixed_ip(self, bytes_body=False):
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.fixedIPsClient.reserve_fixed_ip,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.post',
|
|
||||||
{}, bytes_body,
|
|
||||||
status=202, fixed_ip='Identifier')
|
|
||||||
|
|
||||||
def test_reserve_fixed_ip_with_str_body(self):
|
|
||||||
self._test_reserve_fixed_ip()
|
|
||||||
|
|
||||||
def test_reserve_fixed_ip_with_bytes_body(self):
|
|
||||||
self._test_reserve_fixed_ip(True)
|
|
@ -1,46 +0,0 @@
|
|||||||
# Copyright 2015 NEC Corporation. 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.lib.services.compute import floating_ip_pools_client
|
|
||||||
from tempest.tests.lib import fake_auth_provider
|
|
||||||
from tempest.tests.lib.services import base
|
|
||||||
|
|
||||||
|
|
||||||
class TestFloatingIPPoolsClient(base.BaseServiceTest):
|
|
||||||
|
|
||||||
FAKE_FLOATING_IP_POOLS = {
|
|
||||||
"floating_ip_pools":
|
|
||||||
[
|
|
||||||
{"name": '\u3042'},
|
|
||||||
{"name": '\u3044'}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestFloatingIPPoolsClient, self).setUp()
|
|
||||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
|
||||||
self.client = floating_ip_pools_client.FloatingIPPoolsClient(
|
|
||||||
fake_auth, 'compute', 'regionOne')
|
|
||||||
|
|
||||||
def test_list_floating_ip_pools_with_str_body(self):
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.client.list_floating_ip_pools,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
|
||||||
self.FAKE_FLOATING_IP_POOLS)
|
|
||||||
|
|
||||||
def test_list_floating_ip_pools_with_bytes_body(self):
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.client.list_floating_ip_pools,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
|
||||||
self.FAKE_FLOATING_IP_POOLS, to_utf=True)
|
|
@ -1,88 +0,0 @@
|
|||||||
# Copyright 2015 NEC Corporation. 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.tests.lib import fake_auth_provider
|
|
||||||
|
|
||||||
from tempest.lib.services.compute import floating_ips_bulk_client
|
|
||||||
from tempest.tests.lib.services import base
|
|
||||||
|
|
||||||
|
|
||||||
class TestFloatingIPsBulkClient(base.BaseServiceTest):
|
|
||||||
|
|
||||||
FAKE_FIP_BULK_LIST = {"floating_ip_info": [{
|
|
||||||
"address": "10.10.10.1",
|
|
||||||
"instance_uuid": None,
|
|
||||||
"fixed_ip": None,
|
|
||||||
"interface": "eth0",
|
|
||||||
"pool": "nova",
|
|
||||||
"project_id": None
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"address": "10.10.10.2",
|
|
||||||
"instance_uuid": None,
|
|
||||||
"fixed_ip": None,
|
|
||||||
"interface": "eth0",
|
|
||||||
"pool": "nova",
|
|
||||||
"project_id": None
|
|
||||||
}]}
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
super(TestFloatingIPsBulkClient, self).setUp()
|
|
||||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
|
||||||
self.client = floating_ips_bulk_client.FloatingIPsBulkClient(
|
|
||||||
fake_auth, 'compute', 'regionOne')
|
|
||||||
|
|
||||||
def _test_list_floating_ips_bulk(self, bytes_body=False):
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.client.list_floating_ips_bulk,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
|
||||||
self.FAKE_FIP_BULK_LIST,
|
|
||||||
to_utf=bytes_body)
|
|
||||||
|
|
||||||
def _test_create_floating_ips_bulk(self, bytes_body=False):
|
|
||||||
fake_fip_create_data = {"floating_ips_bulk_create": {
|
|
||||||
"ip_range": "192.168.1.0/24", "pool": "nova", "interface": "eth0"}}
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.client.create_floating_ips_bulk,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.post',
|
|
||||||
fake_fip_create_data,
|
|
||||||
to_utf=bytes_body,
|
|
||||||
ip_range="192.168.1.0/24", pool="nova", interface="eth0")
|
|
||||||
|
|
||||||
def _test_delete_floating_ips_bulk(self, bytes_body=False):
|
|
||||||
fake_fip_delete_data = {"floating_ips_bulk_delete": "192.168.1.0/24"}
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.client.delete_floating_ips_bulk,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.put',
|
|
||||||
fake_fip_delete_data,
|
|
||||||
to_utf=bytes_body,
|
|
||||||
ip_range="192.168.1.0/24")
|
|
||||||
|
|
||||||
def test_list_floating_ips_bulk_with_str_body(self):
|
|
||||||
self._test_list_floating_ips_bulk()
|
|
||||||
|
|
||||||
def test_list_floating_ips_bulk_with_bytes_body(self):
|
|
||||||
self._test_list_floating_ips_bulk(True)
|
|
||||||
|
|
||||||
def test_create_floating_ips_bulk_with_str_body(self):
|
|
||||||
self._test_create_floating_ips_bulk()
|
|
||||||
|
|
||||||
def test_create_floating_ips_bulk_with_bytes_body(self):
|
|
||||||
self._test_create_floating_ips_bulk(True)
|
|
||||||
|
|
||||||
def test_delete_floating_ips_bulk_with_str_body(self):
|
|
||||||
self._test_delete_floating_ips_bulk()
|
|
||||||
|
|
||||||
def test_delete_floating_ips_bulk_with_bytes_body(self):
|
|
||||||
self._test_delete_floating_ips_bulk(True)
|
|
@ -789,21 +789,6 @@ class TestServersClient(base.BaseServiceTest):
|
|||||||
length='fake-length'
|
length='fake-length'
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_list_virtual_interfaces_with_str_body(self):
|
|
||||||
self._test_list_virtual_interfaces()
|
|
||||||
|
|
||||||
def test_list_virtual_interfaces_with_bytes_body(self):
|
|
||||||
self._test_list_virtual_interfaces(True)
|
|
||||||
|
|
||||||
def _test_list_virtual_interfaces(self, bytes_body=False):
|
|
||||||
self.check_service_client_function(
|
|
||||||
self.client.list_virtual_interfaces,
|
|
||||||
'tempest.lib.common.rest_client.RestClient.get',
|
|
||||||
{'virtual_interfaces': [self.FAKE_VIRTUAL_INTERFACES]},
|
|
||||||
bytes_body,
|
|
||||||
server_id=self.server_id
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_rescue_server_with_str_body(self):
|
def test_rescue_server_with_str_body(self):
|
||||||
self._test_rescue_server()
|
self._test_rescue_server()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user