本文整理汇总了Python中tempest.lib.common.utils.test_utils.call_and_ignore_notfound_exc函数的典型用法代码示例。如果您正苦于以下问题:Python call_and_ignore_notfound_exc函数的具体用法?Python call_and_ignore_notfound_exc怎么用?Python call_and_ignore_notfound_exc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call_and_ignore_notfound_exc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: delete_containers
def delete_containers(cls, container_client=None,
object_client=None):
"""Remove containers and all objects in them.
The containers should be visible from the container_client given.
Will not throw any error if the containers don't exist.
Will not check that object and container deletions succeed.
:param container_client: if None, use cls.container_client, this means
that the default testing user will be used (see 'username' in
'etc/tempest.conf')
:param object_client: if None, use cls.object_client
"""
if container_client is None:
container_client = cls.container_client
if object_client is None:
object_client = cls.object_client
for cont in cls.containers:
try:
params = {'limit': 9999, 'format': 'json'}
resp, objlist = container_client.list_container_contents(
cont, params)
# delete every object in the container
for obj in objlist:
test_utils.call_and_ignore_notfound_exc(
object_client.delete_object, cont, obj['name'])
container_client.delete_container(cont)
except lib_exc.NotFound:
pass
开发者ID:Tesora,项目名称:tesora-tempest,代码行数:29,代码来源:base.py
示例2: resource_cleanup
def resource_cleanup(cls):
for lb_id in cls._lbs_to_delete:
try:
lb = cls.load_balancers_client.get_load_balancer_status_tree(
lb_id).get('loadbalancer')
except exceptions.NotFound:
continue
for listener in lb.get('listeners'):
for pool in listener.get('pools'):
hm = pool.get('healthmonitor')
if hm:
test_utils.call_and_ignore_notfound_exc(
cls.health_monitors_client.delete_health_monitor,
pool.get('healthmonitor').get('id'))
cls._wait_for_load_balancer_status(lb_id)
test_utils.call_and_ignore_notfound_exc(
cls.pools_client.delete_pool,
pool.get('id'))
cls._wait_for_load_balancer_status(lb_id)
health_monitor = pool.get('healthmonitor')
if health_monitor:
test_utils.call_and_ignore_notfound_exc(
cls.health_monitors_client.delete_health_monitor,
health_monitor.get('id'))
cls._wait_for_load_balancer_status(lb_id)
test_utils.call_and_ignore_notfound_exc(
cls.listeners_client.delete_listener,
listener.get('id'))
cls._wait_for_load_balancer_status(lb_id)
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer, lb_id)
super(BaseTestCase, cls).resource_cleanup()
开发者ID:tc1989tc,项目名称:neutron-lbaas,代码行数:34,代码来源:base.py
示例3: clear_volume_type
def clear_volume_type(cls, vol_type_id):
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_types_client.delete_volume_type, vol_type_id)
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_types_client.wait_for_resource_deletion,
vol_type_id)
开发者ID:masayukig,项目名称:tempest,代码行数:7,代码来源:base.py
示例4: tearDown
def tearDown(self):
try:
test_utils.call_and_ignore_notfound_exc(
self.client.delete_agent, self.agent_id)
except Exception:
LOG.exception('Exception raised deleting agent %s', self.agent_id)
super(AgentsAdminTestJSON, self).tearDown()
开发者ID:WoolenWang,项目名称:tempest,代码行数:7,代码来源:test_agents.py
示例5: tearDown
def tearDown(self):
for obj in self.objects:
test_utils.call_and_ignore_notfound_exc(
self.object_client.delete_object,
self.container_name, obj)
self.container_client.delete_container(self.container_name)
super(ObjectSloTest, self).tearDown()
开发者ID:WoolenWang,项目名称:tempest,代码行数:7,代码来源:test_object_slo.py
示例6: delete_containers
def delete_containers(containers, container_client, object_client):
"""Remove containers and all objects in them.
The containers should be visible from the container_client given.
Will not throw any error if the containers don't exist.
Will not check that object and container deletions succeed.
After delete all the objects from a container, it will wait 2
seconds before delete the container itself, in order to deployments
using HA proxy sync the deletion properly, otherwise, the container
might fail to be deleted because it's not empty.
:param containers: List of containers to be deleted
:param container_client: Client to be used to delete containers
:param object_client: Client to be used to delete objects
"""
for cont in containers:
try:
params = {'limit': 9999, 'format': 'json'}
_, objlist = container_client.list_container_objects(cont, params)
# delete every object in the container
for obj in objlist:
test_utils.call_and_ignore_notfound_exc(
object_client.delete_object, cont, obj['name'])
# sleep 2 seconds to sync the deletion of the objects
# in HA deployment
time.sleep(2)
container_client.delete_container(cont)
except lib_exc.NotFound:
pass
开发者ID:Juniper,项目名称:tempest,代码行数:29,代码来源:base.py
示例7: clear_images
def clear_images(cls):
LOG.debug('Clearing images: %s', ','.join(cls.images))
for image_id in cls.images:
try:
test_utils.call_and_ignore_notfound_exc(
cls.compute_images_client.delete_image, image_id)
except Exception:
LOG.exception('Exception raised deleting image %s' % image_id)
开发者ID:RHOS-QE,项目名称:RHOS-Tempest-Plugin,代码行数:8,代码来源:base.py
示例8: resource_cleanup
def resource_cleanup(cls):
for image_id in cls.created_images:
test_utils.call_and_ignore_notfound_exc(
cls.client.delete_image, image_id)
for image_id in cls.created_images:
cls.client.wait_for_resource_deletion(image_id)
super(BaseImageTest, cls).resource_cleanup()
开发者ID:ssameerr,项目名称:tempest,代码行数:8,代码来源:base.py
示例9: delete_router
def delete_router(cls, router):
body = cls.ports_client.list_ports(device_id=router["id"])
interfaces = body["ports"]
for i in interfaces:
test_utils.call_and_ignore_notfound_exc(
cls.routers_client.remove_router_interface, router["id"], subnet_id=i["fixed_ips"][0]["subnet_id"]
)
cls.routers_client.delete_router(router["id"])
开发者ID:sebrandon1,项目名称:tempest,代码行数:8,代码来源:base.py
示例10: delete_router
def delete_router(cls, router):
body = cls.ports_client.list_ports(device_id=router['id'])
interfaces = body['ports']
for i in interfaces:
test_utils.call_and_ignore_notfound_exc(
cls.routers_client.remove_router_interface, router['id'],
subnet_id=i['fixed_ips'][0]['subnet_id'])
cls.routers_client.delete_router(router['id'])
开发者ID:fnaval,项目名称:tempest,代码行数:8,代码来源:base.py
示例11: trunks_cleanup
def trunks_cleanup(client, trunks):
for trunk in trunks:
subports = test_utils.call_and_ignore_notfound_exc(
client.get_subports, trunk['id'])
if subports:
client.remove_subports(
trunk['id'], subports['sub_ports'])
test_utils.call_and_ignore_notfound_exc(
client.delete_trunk, trunk['id'])
开发者ID:biruce-openstack,项目名称:neutron,代码行数:9,代码来源:test_trunk.py
示例12: _clear_stacks
def _clear_stacks(cls):
for stack_identifier in cls.stacks:
test_utils.call_and_ignore_notfound_exc(
cls.client.delete_stack, stack_identifier)
for stack_identifier in cls.stacks:
test_utils.call_and_ignore_notfound_exc(
cls.client.wait_for_stack_status, stack_identifier,
'DELETE_COMPLETE')
开发者ID:Tesora,项目名称:tesora-tempest,代码行数:9,代码来源:base.py
示例13: resource_cleanup
def resource_cleanup(cls):
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer,
cls.load_balancer['id'])
cls._wait_for_load_balancer_status(
load_balancer_id=cls.load_balancer['id'], delete=True)
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer,
cls.tenant_load_balancer['id'])
cls._wait_for_load_balancer_status(
load_balancer_id=cls.tenant_load_balancer['id'], delete=True)
开发者ID:richbrowne,项目名称:neutron-lbaas,代码行数:11,代码来源:test_load_balancers_admin.py
示例14: clear_server_groups
def clear_server_groups(cls):
LOG.debug('Clearing server groups: %s', ','.join(cls.server_groups))
for server_group_id in cls.server_groups:
try:
test_utils.call_and_ignore_notfound_exc(
cls.server_groups_client.delete_server_group,
server_group_id
)
except Exception:
LOG.exception('Exception raised deleting server-group %s',
server_group_id)
开发者ID:RHOS-QE,项目名称:RHOS-Tempest-Plugin,代码行数:11,代码来源:base.py
示例15: clear_security_groups
def clear_security_groups(cls):
LOG.debug('Clearing security groups: %s', ','.join(
str(sg['id']) for sg in cls.security_groups))
for sg in cls.security_groups:
try:
test_utils.call_and_ignore_notfound_exc(
cls.security_groups_client.delete_security_group, sg['id'])
except Exception as exc:
LOG.info('Exception raised deleting security group %s',
sg['id'])
LOG.exception(exc)
开发者ID:RHOS-QE,项目名称:RHOS-Tempest-Plugin,代码行数:11,代码来源:base.py
示例16: clear_resources
def clear_resources(cls, resource_name, resources, resource_del_func):
LOG.debug('Clearing %s: %s', resource_name,
','.join(map(str, resources)))
for res_id in resources:
try:
test_utils.call_and_ignore_notfound_exc(
resource_del_func, res_id)
except Exception as exc:
LOG.exception('Exception raised deleting %s: %s',
resource_name, res_id)
LOG.exception(exc)
开发者ID:vedujoshi,项目名称:tempest,代码行数:11,代码来源:base.py
示例17: clear_volume_types
def clear_volume_types(cls):
for vol_type in cls.volume_types:
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_types_client.delete_volume_type, vol_type)
for vol_type in cls.volume_types:
# Resource dictionary uses for is_resource_deleted method,
# to distinguish between volume-type to encryption-type.
resource = {'id': vol_type, 'type': 'volume-type'}
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_types_client.wait_for_resource_deletion,
resource)
开发者ID:WoolenWang,项目名称:tempest,代码行数:12,代码来源:base.py
示例18: resource_cleanup
def resource_cleanup(cls):
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer,
cls.load_balancer['id'])
cls._wait_for_load_balancer_status(
load_balancer_id=cls.load_balancer['id'], delete=True)
cls._wait_for_neutron_port_delete(cls.load_balancer['vip_port_id'])
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer,
cls.tenant_load_balancer['id'])
cls._wait_for_load_balancer_status(
load_balancer_id=cls.tenant_load_balancer['id'], delete=True)
cls._wait_for_neutron_port_delete(
cls.tenant_load_balancer['vip_port_id'])
super(LoadBalancersTestAdmin, cls).resource_cleanup()
开发者ID:openstack,项目名称:neutron-lbaas,代码行数:15,代码来源:test_load_balancers_admin.py
示例19: clear_volumes
def clear_volumes(cls):
LOG.debug('Clearing volumes: %s', ','.join(
volume['id'] for volume in cls.volumes))
for volume in cls.volumes:
try:
test_utils.call_and_ignore_notfound_exc(
cls.volumes_client.delete_volume, volume['id'])
except Exception:
LOG.exception('Deleting volume %s failed', volume['id'])
for volume in cls.volumes:
try:
cls.volumes_client.wait_for_resource_deletion(volume['id'])
except Exception:
LOG.exception('Waiting for deletion of volume %s failed',
volume['id'])
开发者ID:Tesora,项目名称:tesora-tempest,代码行数:16,代码来源:base.py
示例20: resource_cleanup
def resource_cleanup(cls):
"""Deletes any auto_allocated_network and it's associated resources."""
# Find the auto-allocated router for the tenant.
# This is a bit hacky since we don't have a great way to find the
# auto-allocated router given the private tenant network we have.
routers = cls.routers_client.list_routers().get('routers', [])
if len(routers) > 1:
# This indicates a race where nova is concurrently calling the
# neutron auto-allocated-topology API for multiple server builds
# at the same time (it's called from nova-compute when setting up
# networking for a server). Neutron will detect duplicates and
# automatically clean them up, but there is a window where the API
# can return multiple and we don't have a good way to filter those
# out right now, so we'll just handle them.
LOG.info('(%s) Found more than one router for tenant.',
test_utils.find_test_caller())
# Remove any networks, duplicate or otherwise, that these tests
# created. All such networks will be in the current tenant. Neutron
# will cleanup duplicate resources automatically, so ignore 404s.
search_opts = {'tenant_id': cls.networks_client.tenant_id}
networks = cls.networks_client.list_networks(
**search_opts).get('networks', [])
for router in routers:
# Disassociate the subnets from the router. Because of the race
# mentioned above the subnets might not be associated with the
# router so ignore any 404.
for network in networks:
for subnet_id in network['subnets']:
test_utils.call_and_ignore_notfound_exc(
cls.routers_client.remove_router_interface,
router['id'], subnet_id=subnet_id)
# Delete the router.
cls.routers_client.delete_router(router['id'])
for network in networks:
# Get and delete the ports for the given network.
ports = cls.ports_client.list_ports(
network_id=network['id']).get('ports', [])
for port in ports:
test_utils.call_and_ignore_notfound_exc(
cls.ports_client.delete_port, port['id'])
# Delete the subnets.
for subnet_id in network['subnets']:
test_utils.call_and_ignore_notfound_exc(
cls.subnets_client.delete_subnet, subnet_id)
# Delete the network.
test_utils.call_and_ignore_notfound_exc(
cls.networks_client.delete_network, network['id'])
super(AutoAllocateNetworkTest, cls).resource_cleanup()
开发者ID:Juniper,项目名称:tempest,代码行数:56,代码来源:test_auto_allocate_network.py
注:本文中的tempest.lib.common.utils.test_utils.call_and_ignore_notfound_exc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论