本文整理匯總了Python中tempest.lib.exceptions.NotFound方法的典型用法代碼示例。如果您正苦於以下問題:Python exceptions.NotFound方法的具體用法?Python exceptions.NotFound怎麽用?Python exceptions.NotFound使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tempest.lib.exceptions
的用法示例。
在下文中一共展示了exceptions.NotFound方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_delete_action_plan
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_delete_action_plan(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
_, audit = self.create_audit(audit_template['uuid'])
self.assertTrue(test_utils.call_until_true(
func=functools.partial(self.has_audit_finished, audit['uuid']),
duration=30,
sleep_for=.5
))
_, action_plans = self.client.list_action_plans(
audit_uuid=audit['uuid'])
action_plan = action_plans['action_plans'][0]
_, action_plan = self.client.show_action_plan(action_plan['uuid'])
self.client.delete_action_plan(action_plan['uuid'])
self.assertRaises(exceptions.NotFound, self.client.show_action_plan,
action_plan['uuid'])
示例2: _log_console_output
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def _log_console_output(self, servers=None):
if not CONF.compute_feature_enabled.console_output:
LOG.debug('Console output not supported, cannot log')
return
if not servers:
servers = self.servers_client.list_servers()
servers = servers['servers']
for server in servers:
try:
console_output = self.servers_client.get_console_output(
server['id'])['output']
LOG.debug('Console output for %s\nbody=\n%s',
server['id'], console_output)
except lib_exc.NotFound:
LOG.debug("Server %s disappeared(deleted) while looking "
"for the console log", server['id'])
示例3: _wait_firewall_while
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def _wait_firewall_while(self, firewall_id, statuses, not_found_ok=False):
start = int(time.time())
if not_found_ok:
expected_exceptions = (lib_exc.NotFound)
else:
expected_exceptions = ()
while True:
try:
fw = self.fwaasv1_client.show_firewall(firewall_id)
except expected_exceptions:
break
status = fw['firewall']['status']
if status not in statuses:
break
if int(time.time()) - start >= self.fwaasv1_client.build_timeout:
msg = ("Firewall %(firewall)s failed to reach "
"non PENDING status (current %(status)s)") % {
"firewall": firewall_id,
"status": status,
}
raise lib_exc.TimeoutException(msg)
time.sleep(constants.NSX_BACKEND_VERY_SMALL_TIME_INTERVAL)
示例4: test_subnetpools_crud_operations
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_subnetpools_crud_operations(self):
# create subnet pool
subnetpool_name = data_utils.rand_name('subnetpools')
body = self._create_subnet_pool(self.cmgr_adm, subnetpool_name)
subnetpool_client = self.cmgr_adm.subnetpools_client
subnetpool_id = body["subnetpool"]["id"]
self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
# get detail about subnet pool
body = subnetpool_client.show_subnetpool(subnetpool_id)
self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
# update the subnet pool
subnetpool_name = data_utils.rand_name('subnetpools_update')
body = subnetpool_client.update_subnetpool(subnetpool_id,
name=subnetpool_name)
self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
# delete subnet pool
body = subnetpool_client.delete_subnetpool(subnetpool_id)
self.assertRaises(lib_exc.NotFound,
subnetpool_client.show_subnetpool,
subnetpool_id)
示例5: test_delete_listener
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_delete_listener(self):
"""Test delete listener"""
create_new_listener_kwargs = self.create_listener_kwargs
create_new_listener_kwargs['protocol_port'] = 8083
new_listener = self._create_listener(**create_new_listener_kwargs)
new_listener_id = new_listener['id']
self._check_status_tree(
load_balancer_id=self.load_balancer_id,
listener_ids=[self.listener_id, new_listener_id])
listener = self._show_listener(new_listener_id)
self.assertEqual(new_listener, listener)
self.assertNotEqual(self.listener, new_listener)
self._delete_listener(new_listener_id)
self.assertRaises(exceptions.NotFound,
self._show_listener,
new_listener_id)
示例6: test_egress_rule_delete
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_egress_rule_delete(self):
"""qos-bandwidth-limit-egress-rule-delete RULE-ID POLICY_ID."""
qos_client = self.adm_qos_client
max_kbps = 2000
max_burst_kbps = 1337
policy = self.create_qos_policy(name='test-policy',
description='test policy',
shared=False)
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.adm_qos_client.delete_policy, policy['id'])
rule = self.create_qos_bandwidth_limit_rule(
policy['id'],
max_kbps=max_kbps, max_burst_kbps=max_burst_kbps)
retrieved_rule = qos_client.show_bandwidth_limit_rule(
rule['id'], policy['id'])
self.assertEqual(rule['id'], retrieved_rule['id'])
qos_client.delete_bandwidth_limit_rule(
rule['id'], policy['id'])
self.assertRaises(exceptions.NotFound,
qos_client.show_bandwidth_limit_rule,
rule['id'], policy['id'])
示例7: test_ingress_rule_delete
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_ingress_rule_delete(self):
"""qos-bandwidth-limit-ingress-rule-delete RULE-ID POLICY_ID."""
qos_client = self.adm_qos_client
max_kbps = 2000
max_burst_kbps = 1337
policy = self.create_qos_policy(name='test-policy',
description='test policy',
shared=False)
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
self.adm_qos_client.delete_policy, policy['id'])
rule = self.create_qos_bandwidth_limit_rule(
policy['id'],
max_kbps=max_kbps, max_burst_kbps=max_burst_kbps,
direction='ingress')
retrieved_rule = qos_client.show_bandwidth_limit_rule(
rule['id'], policy['id'])
self.assertEqual(rule['id'], retrieved_rule['id'])
qos_client.delete_bandwidth_limit_rule(
rule['id'], policy['id'])
self.assertRaises(exceptions.NotFound,
qos_client.show_bandwidth_limit_rule,
rule['id'], policy['id'])
示例8: test_create_l2gwc_with_nonexist_l2gw
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_create_l2gwc_with_nonexist_l2gw(self):
"""
Create l2 gateway connection using non exist l2gw uuid.
"""
LOG.info("Testing test_l2_gateway_connection_create api")
self.deploy_l2gateway_topology()
non_exist_l2gw_uuid = NON_EXIST_UUID
cluster_info = self.nsx_bridge_cluster_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
l2gw_param = [device_1]
l2gw_rsp, _ = self.create_l2gw(l2gw_name, l2gw_param)
l2gwc_param = {"l2_gateway_id": non_exist_l2gw_uuid,
"network_id":
self.topology_networks["network_l2gateway"]["id"],
"segmentation_id": self.VLAN_1}
# Delete l2gw must raise Conflict exception.
self.assertRaises(lib_exc.NotFound, self.create_l2gw_connection,
l2gwc_param)
示例9: test_create_l2gwc_with_nonexist_network
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_create_l2gwc_with_nonexist_network(self):
"""
Create l2 gateway connection using non exist l2gw uuid.
"""
LOG.info("Testing test_l2_gateway_connection_create api")
non_exist_network_uuid = NON_EXIST_UUID
cluster_info = self.nsx_bridge_cluster_info()
device_name, interface_name = cluster_info[0][0], cluster_info[0][1]
l2gw_name = data_utils.rand_name(constants.L2GW)
device_1 = {"dname": device_name, "iname": interface_name}
l2gw_param = [device_1]
l2gw_rsp, _ = self.create_l2gw(l2gw_name, l2gw_param)
l2gwc_param = {"l2_gateway_id": l2gw_rsp[constants.L2GW]["id"],
"network_id": non_exist_network_uuid,
"segmentation_id": self.VLAN_1}
# Delete l2gw must raise Conflict exception.
self.assertRaises(lib_exc.NotFound, self.create_l2gw_connection,
l2gwc_param)
示例10: wait_for_node
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def wait_for_node(self, node_name):
def check_node():
try:
self.node_show(node_name)
except lib_exc.NotFound:
return False
return True
if not test_utils.call_until_true(
check_node,
duration=CONF.baremetal_introspection.discovery_timeout,
sleep_for=20):
msg = ("Timed out waiting for node %s " % node_name)
raise lib_exc.TimeoutException(msg)
inspected_node = self.node_show(self.node_info['name'])
self.wait_for_introspection_finished(inspected_node['uuid'])
# TODO(aarefiev): switch to call_until_true
示例11: test_update_port_nonexistent
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_update_port_nonexistent(self):
node_id = self.node['uuid']
address = data_utils.rand_mac_address()
extra = {'key': 'value'}
_, port = self.create_port(node_id=node_id, address=address,
extra=extra)
port_id = port['uuid']
_, body = self.client.delete_port(port_id)
patch = [{'path': '/extra/key',
'op': 'replace',
'value': 'new-value'}]
self.assertRaises(lib_exc.NotFound,
self.client.update_port, port_id, patch)
示例12: does_cluster_exist
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def does_cluster_exist(self, cluster_id):
try:
resp, model = self.get_cluster(cluster_id)
if model.status in ['CREATED', 'CREATE_COMPLETE']:
self.LOG.info('Cluster %s is created.' % cluster_id)
return True
elif model.status in ['ERROR', 'CREATE_FAILED']:
self.LOG.error('Cluster %s is in fail state.' %
cluster_id)
raise exceptions.ServerFault(
"Got into an error condition: %s for %s" %
(model.status, cluster_id))
else:
return False
except exceptions.NotFound:
self.LOG.warning('Cluster %s is not found.' % cluster_id)
return False
示例13: test_delete_zone_pending_create
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_delete_zone_pending_create(self):
LOG.info('Create a zone')
_, zone = self.client.create_zone()
self.addCleanup(self.client.delete_zone, zone['id'],
ignore_errors=lib_exc.NotFound)
# NOTE(kiall): This is certainly a little racey, it's entirely
# possible the zone will become active before we delete
# it. Worst case, that means we get an unexpected pass.
# Theres not a huge amount we can do, given this is
# black-box testing.
LOG.info('Delete the zone while it is still pending')
_, zone = self.client.delete_zone(zone['id'])
LOG.info('Ensure we respond with DELETE+PENDING')
self.assertEqual('DELETE', zone['action'])
self.assertEqual('PENDING', zone['status'])
waiters.wait_for_zone_404(self.client, zone['id'])
示例14: test_delete_audit
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_delete_audit(self):
_, goal = self.client.show_goal("dummy")
_, audit_template = self.create_audit_template(goal['uuid'])
_, body = self.create_audit(audit_template['uuid'])
audit_uuid = body['uuid']
test_utils.call_until_true(
func=functools.partial(
self.is_audit_idle, audit_uuid),
duration=10,
sleep_for=.5
)
def is_audit_deleted(uuid):
try:
return not bool(self.client.show_audit(uuid))
except exceptions.NotFound:
return True
self.delete_audit(audit_uuid)
test_utils.call_until_true(
func=functools.partial(is_audit_deleted, audit_uuid),
duration=5,
sleep_for=1
)
self.assertTrue(is_audit_deleted(audit_uuid))
示例15: test_delete_audit_template
# 需要導入模塊: from tempest.lib import exceptions [as 別名]
# 或者: from tempest.lib.exceptions import NotFound [as 別名]
def test_delete_audit_template(self):
_, goal = self.client.show_goal("dummy")
_, body = self.create_audit_template(goal=goal['uuid'])
audit_uuid = body['uuid']
self.delete_audit_template(audit_uuid)
self.assertRaises(exceptions.NotFound, self.client.show_audit_template,
audit_uuid)