Remove unused compute clients
Some compute clients of Tempest-like tests are not used at all. So this patch removes these clients' implementation. Change-Id: I64a928c4468b93ed5a1f7f2cadd975785274f745
This commit is contained in:
parent
be629f86aa
commit
d27692a1dd
@ -22,19 +22,14 @@ from neutron_lbaas.tests.tempest.lib.common import cred_provider
|
||||
from neutron_lbaas.tests.tempest.lib import config
|
||||
from neutron_lbaas.tests.tempest.lib import exceptions
|
||||
from neutron_lbaas.tests.tempest.lib import manager
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.flavors_client import FlavorsClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.floating_ips_client import \
|
||||
FloatingIPsClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.images_client import ImagesClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.interfaces_client import \
|
||||
InterfacesClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.keypairs_client import KeyPairsClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.networks_client import NetworksClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.security_groups_client import \
|
||||
SecurityGroupsClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.servers_client import ServersClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.compute.json.tenant_networks_client import \
|
||||
TenantNetworksClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.database.json.flavors_client import \
|
||||
DatabaseFlavorsClientJSON
|
||||
from neutron_lbaas.tests.tempest.lib.services.database.json.limits_client import \
|
||||
@ -194,15 +189,12 @@ class Manager(manager.Manager):
|
||||
# self.quotas_client = QuotasClientJSON(self.auth_provider, **params)
|
||||
# self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider,
|
||||
# **params)
|
||||
self.flavors_client = FlavorsClientJSON(self.auth_provider, **params)
|
||||
# self.extensions_client = ExtensionsClientJSON(self.auth_provider,
|
||||
# **params)
|
||||
self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider,
|
||||
**params)
|
||||
self.security_groups_client = SecurityGroupsClientJSON(
|
||||
self.auth_provider, **params)
|
||||
self.interfaces_client = InterfacesClientJSON(self.auth_provider,
|
||||
**params)
|
||||
# self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider,
|
||||
# **params)
|
||||
# self.availability_zone_client = AvailabilityZoneClientJSON(
|
||||
@ -217,8 +209,6 @@ class Manager(manager.Manager):
|
||||
# **params)
|
||||
# self.instance_usages_audit_log_client = \
|
||||
# InstanceUsagesAuditLogClientJSON(self.auth_provider, **params)
|
||||
self.tenant_networks_client = \
|
||||
TenantNetworksClientJSON(self.auth_provider, **params)
|
||||
# self.baremetal_nodes_client = BaremetalNodesClientJSON(
|
||||
# self.auth_provider, **params)
|
||||
|
||||
|
@ -1,178 +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.
|
||||
|
||||
import json
|
||||
|
||||
from six.moves.urllib import parse as urllib
|
||||
|
||||
from neutron_lbaas.tests.tempest.lib.api_schema.response.compute.v2_1 import flavors as schema
|
||||
from neutron_lbaas.tests.tempest.lib.api_schema.response.compute.v2_1 import flavors_access as schema_access
|
||||
from neutron_lbaas.tests.tempest.lib.api_schema.response.compute.v2_1 import flavors_extra_specs as schema_extra_specs
|
||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||
|
||||
|
||||
class FlavorsClientJSON(service_client.ServiceClient):
|
||||
|
||||
def list_flavors(self, params=None):
|
||||
url = 'flavors'
|
||||
if params:
|
||||
url += '?%s' % urllib.urlencode(params)
|
||||
|
||||
resp, body = self.get(url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_flavors, resp, body)
|
||||
return service_client.ResponseBodyList(resp, body['flavors'])
|
||||
|
||||
def list_flavors_with_detail(self, params=None):
|
||||
url = 'flavors/detail'
|
||||
if params:
|
||||
url += '?%s' % urllib.urlencode(params)
|
||||
|
||||
resp, body = self.get(url)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_flavors_details, resp, body)
|
||||
return service_client.ResponseBodyList(resp, body['flavors'])
|
||||
|
||||
def show_flavor(self, flavor_id):
|
||||
resp, body = self.get("flavors/%s" % str(flavor_id))
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.create_get_flavor_details, resp, body)
|
||||
return service_client.ResponseBody(resp, body['flavor'])
|
||||
|
||||
def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
|
||||
"""Creates a new flavor or instance type."""
|
||||
post_body = {
|
||||
'name': name,
|
||||
'ram': ram,
|
||||
'vcpus': vcpus,
|
||||
'disk': disk,
|
||||
'id': flavor_id,
|
||||
}
|
||||
if kwargs.get('ephemeral'):
|
||||
post_body['OS-FLV-EXT-DATA:ephemeral'] = kwargs.get('ephemeral')
|
||||
if kwargs.get('swap'):
|
||||
post_body['swap'] = kwargs.get('swap')
|
||||
if kwargs.get('rxtx'):
|
||||
post_body['rxtx_factor'] = kwargs.get('rxtx')
|
||||
if kwargs.get('is_public'):
|
||||
post_body['os-flavor-access:is_public'] = kwargs.get('is_public')
|
||||
post_body = json.dumps({'flavor': post_body})
|
||||
resp, body = self.post('flavors', post_body)
|
||||
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.create_get_flavor_details, resp, body)
|
||||
return service_client.ResponseBody(resp, body['flavor'])
|
||||
|
||||
def delete_flavor(self, flavor_id):
|
||||
"""Deletes the given flavor."""
|
||||
resp, body = self.delete("flavors/{0}".format(flavor_id))
|
||||
self.validate_response(schema.delete_flavor, resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def is_resource_deleted(self, id):
|
||||
# Did not use show_flavor(id) for verification as it gives
|
||||
# 200 ok even for deleted id. LP #981263
|
||||
# we can remove the loop here and use get by ID when bug gets sortedout
|
||||
flavors = self.list_flavors_with_detail()
|
||||
for flavor in flavors:
|
||||
if flavor['id'] == id:
|
||||
return False
|
||||
return True
|
||||
|
||||
@property
|
||||
def resource_type(self):
|
||||
"""Returns the primary type of resource this client works with."""
|
||||
return 'flavor'
|
||||
|
||||
def set_flavor_extra_spec(self, flavor_id, specs):
|
||||
"""Sets extra Specs to the mentioned flavor."""
|
||||
post_body = json.dumps({'extra_specs': specs})
|
||||
resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
|
||||
post_body)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body['extra_specs'])
|
||||
|
||||
def list_flavor_extra_specs(self, flavor_id):
|
||||
"""Gets extra Specs details of the mentioned flavor."""
|
||||
resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body['extra_specs'])
|
||||
|
||||
def show_flavor_extra_spec(self, flavor_id, key):
|
||||
"""Gets extra Specs key-value of the mentioned flavor and key."""
|
||||
resp, body = self.get('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
|
||||
key))
|
||||
body = json.loads(body)
|
||||
self.validate_response(
|
||||
schema_extra_specs.set_get_flavor_extra_specs_key,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
|
||||
"""Update specified extra Specs of the mentioned flavor and key."""
|
||||
resp, body = self.put('flavors/%s/os-extra_specs/%s' %
|
||||
(flavor_id, key), json.dumps(kwargs))
|
||||
body = json.loads(body)
|
||||
self.validate_response(
|
||||
schema_extra_specs.set_get_flavor_extra_specs_key,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def unset_flavor_extra_spec(self, flavor_id, key):
|
||||
"""Unsets extra Specs from the mentioned flavor."""
|
||||
resp, body = self.delete('flavors/%s/os-extra_specs/%s' %
|
||||
(str(flavor_id), key))
|
||||
self.validate_response(schema.unset_flavor_extra_specs, resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def list_flavor_access(self, flavor_id):
|
||||
"""Gets flavor access information given the flavor id."""
|
||||
resp, body = self.get('flavors/%s/os-flavor-access' % flavor_id)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema_access.add_remove_list_flavor_access,
|
||||
resp, body)
|
||||
return service_client.ResponseBodyList(resp, body['flavor_access'])
|
||||
|
||||
def add_flavor_access(self, flavor_id, tenant_id):
|
||||
"""Add flavor access for the specified tenant."""
|
||||
post_body = {
|
||||
'addTenantAccess': {
|
||||
'tenant': tenant_id
|
||||
}
|
||||
}
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema_access.add_remove_list_flavor_access,
|
||||
resp, body)
|
||||
return service_client.ResponseBodyList(resp, body['flavor_access'])
|
||||
|
||||
def remove_flavor_access(self, flavor_id, tenant_id):
|
||||
"""Remove flavor access from the specified tenant."""
|
||||
post_body = {
|
||||
'removeTenantAccess': {
|
||||
'tenant': tenant_id
|
||||
}
|
||||
}
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema_access.add_remove_list_flavor_access,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body['flavor_access'])
|
@ -1,109 +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.
|
||||
|
||||
import json
|
||||
import time
|
||||
|
||||
from neutron_lbaas.tests.tempest.lib.api_schema.response.compute.v2_1 import interfaces as schema
|
||||
from neutron_lbaas.tests.tempest.lib.api_schema.response.compute.v2_1 import servers as servers_schema
|
||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||
from neutron_lbaas.tests.tempest.lib import exceptions
|
||||
|
||||
|
||||
class InterfacesClientJSON(service_client.ServiceClient):
|
||||
|
||||
def list_interfaces(self, server):
|
||||
resp, body = self.get('servers/%s/os-interface' % server)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_interfaces, resp, body)
|
||||
return service_client.ResponseBodyList(resp,
|
||||
body['interfaceAttachments'])
|
||||
|
||||
def create_interface(self, server, port_id=None, network_id=None,
|
||||
fixed_ip=None):
|
||||
post_body = dict(interfaceAttachment=dict())
|
||||
if port_id:
|
||||
post_body['interfaceAttachment']['port_id'] = port_id
|
||||
if network_id:
|
||||
post_body['interfaceAttachment']['net_id'] = network_id
|
||||
if fixed_ip:
|
||||
fip = dict(ip_address=fixed_ip)
|
||||
post_body['interfaceAttachment']['fixed_ips'] = [fip]
|
||||
post_body = json.dumps(post_body)
|
||||
resp, body = self.post('servers/%s/os-interface' % server,
|
||||
body=post_body)
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.get_create_interfaces, resp, body)
|
||||
return service_client.ResponseBody(resp, body['interfaceAttachment'])
|
||||
|
||||
def show_interface(self, server, port_id):
|
||||
resp, body = self.get('servers/%s/os-interface/%s' % (server, port_id))
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.get_create_interfaces, resp, body)
|
||||
return service_client.ResponseBody(resp, body['interfaceAttachment'])
|
||||
|
||||
def delete_interface(self, server, port_id):
|
||||
resp, body = self.delete('servers/%s/os-interface/%s' % (server,
|
||||
port_id))
|
||||
self.validate_response(schema.delete_interface, resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def wait_for_interface_status(self, server, port_id, status):
|
||||
"""Waits for a interface to reach a given status."""
|
||||
body = self.show_interface(server, port_id)
|
||||
interface_status = body['port_state']
|
||||
start = int(time.time())
|
||||
|
||||
while(interface_status != status):
|
||||
time.sleep(self.build_interval)
|
||||
body = self.show_interface(server, port_id)
|
||||
interface_status = body['port_state']
|
||||
|
||||
timed_out = int(time.time()) - start >= self.build_timeout
|
||||
|
||||
if interface_status != status and timed_out:
|
||||
message = ('Interface %s failed to reach %s status '
|
||||
'(current %s) within the required time (%s s).' %
|
||||
(port_id, status, interface_status,
|
||||
self.build_timeout))
|
||||
raise exceptions.TimeoutException(message)
|
||||
|
||||
return body
|
||||
|
||||
def add_fixed_ip(self, server_id, network_id):
|
||||
"""Add a fixed IP to input server instance."""
|
||||
post_body = json.dumps({
|
||||
'addFixedIp': {
|
||||
'networkId': network_id
|
||||
}
|
||||
})
|
||||
resp, body = self.post('servers/%s/action' % str(server_id),
|
||||
post_body)
|
||||
self.validate_response(servers_schema.server_actions_common_schema,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
||||
|
||||
def remove_fixed_ip(self, server_id, ip_address):
|
||||
"""Remove input fixed IP from input server instance."""
|
||||
post_body = json.dumps({
|
||||
'removeFixedIp': {
|
||||
'address': ip_address
|
||||
}
|
||||
})
|
||||
resp, body = self.post('servers/%s/action' % str(server_id),
|
||||
post_body)
|
||||
self.validate_response(servers_schema.server_actions_common_schema,
|
||||
resp, body)
|
||||
return service_client.ResponseBody(resp, body)
|
@ -1,33 +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.
|
||||
|
||||
import json
|
||||
|
||||
from neutron_lbaas.tests.tempest.lib.api_schema.response.compute.v2_1 import tenant_networks as schema
|
||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||
|
||||
|
||||
class TenantNetworksClientJSON(service_client.ServiceClient):
|
||||
|
||||
def list_tenant_networks(self):
|
||||
resp, body = self.get("os-tenant-networks")
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.list_tenant_networks, resp, body)
|
||||
return service_client.ResponseBodyList(resp, body['networks'])
|
||||
|
||||
def get_tenant_network(self, network_id):
|
||||
resp, body = self.get("os-tenant-networks/%s" % str(network_id))
|
||||
body = json.loads(body)
|
||||
self.validate_response(schema.get_tenant_network, resp, body)
|
||||
return service_client.ResponseBody(resp, body['network'])
|
@ -46,7 +46,6 @@ class ScenarioTest(test.BaseTestCase):
|
||||
def setup_clients(cls):
|
||||
super(ScenarioTest, cls).setup_clients()
|
||||
# Clients (in alphabetical order)
|
||||
cls.flavors_client = cls.manager.flavors_client
|
||||
cls.floating_ips_client = cls.manager.floating_ips_client
|
||||
# Glance image client v1
|
||||
cls.image_client = cls.manager.image_client
|
||||
@ -58,7 +57,6 @@ class ScenarioTest(test.BaseTestCase):
|
||||
cls.servers_client = cls.manager.servers_client
|
||||
cls.volumes_client = cls.manager.volumes_client
|
||||
cls.snapshots_client = cls.manager.snapshots_client
|
||||
cls.interface_client = cls.manager.interfaces_client
|
||||
# Neutron network client
|
||||
cls.network_client = cls.manager.network_client
|
||||
# Heat client
|
||||
|
Loading…
Reference in New Issue
Block a user