當前位置: 首頁>>代碼示例>>Python>>正文


Python test_utils.call_and_ignore_notfound_exc方法代碼示例

本文整理匯總了Python中tempest.lib.common.utils.test_utils.call_and_ignore_notfound_exc方法的典型用法代碼示例。如果您正苦於以下問題:Python test_utils.call_and_ignore_notfound_exc方法的具體用法?Python test_utils.call_and_ignore_notfound_exc怎麽用?Python test_utils.call_and_ignore_notfound_exc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tempest.lib.common.utils.test_utils的用法示例。


在下文中一共展示了test_utils.call_and_ignore_notfound_exc方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: create_topology_network

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_topology_network(
            self, network_name, networks_client=None,
            tenant_id=None, port_security_enabled=True, **kwargs):
        if not networks_client:
            networks_client = self.networks_client
        if not tenant_id:
            tenant_id = networks_client.tenant_id
        network_name_ = constants.APPLIANCE_NAME_STARTS_WITH + network_name
        name = data_utils.rand_name(network_name_)
        # Neutron disables port security by default so we have to check the
        # config before trying to create the network with port_security_enabled
        if CONF.network_feature_enabled.port_security:
            port_security_enabled = True
        result = networks_client.create_network(
            name=name, tenant_id=tenant_id,
            port_security_enabled=port_security_enabled, **kwargs)
        network = result['network']
        self.assertEqual(network['name'], name)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        networks_client.delete_network, network['id'])
        self.topology_networks[network_name] = network
        return network 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:24,代碼來源:appliance_manager.py

示例2: create_floatingip

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_floatingip(self, thing, port_id, external_network_id=None,
                          ip4=None, client=None):
        """Create a floating IP and associates to a resource/port on Neutron"""
        if not external_network_id:
            external_network_id = self.topology_public_network_id
        if not client:
            client = self.floating_ips_client
        result = client.create_floatingip(
            floating_network_id=external_network_id,
            port_id=port_id,
            tenant_id=thing['tenant_id'],
            fixed_ip_address=ip4
        )
        floating_ip = result['floatingip']
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        client.delete_floatingip,
                        floating_ip['id'])
        return floating_ip 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:20,代碼來源:appliance_manager.py

示例3: create_l2gw_connection

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_l2gw_connection(self, l2gwc_param):
        """Creates L2GWC and return the response.

        :param l2gwc_param: L2GWC parameters.

        :return: response of L2GWC create API.

        """
        LOG.info("l2gwc param: %(param)s ", {"param": l2gwc_param})
        l2gwc_request_body = {"l2_gateway_id": l2gwc_param["l2_gateway_id"],
                              "network_id": l2gwc_param["network_id"]}
        if "segmentation_id" in l2gwc_param:
            l2gwc_request_body["segmentation_id"] = l2gwc_param[
                "segmentation_id"]
        LOG.info("l2gwc_request_body: %s", l2gwc_request_body)
        rsp = self.l2gwc_client.create_l2_gateway_connection(
            **l2gwc_request_body)
        LOG.info("l2gwc response: %s", rsp)
        self.addCleanup(
            test_utils.call_and_ignore_notfound_exc,
            self.l2gwc_client.delete_l2_gateway_connection,
            rsp[constants.L2GWC]["id"])
        return rsp 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:25,代碼來源:feature_manager.py

示例4: _create_security_group

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def _create_security_group(self):
        # Create security group
        sg_name = data_utils.rand_name(self.__class__.__name__)
        sg_desc = sg_name + " description"
        secgroup = self.compute_security_groups_client.create_security_group(
            name=sg_name, description=sg_desc)['security_group']
        self.assertEqual(secgroup['name'], sg_name)
        self.assertEqual(secgroup['description'], sg_desc)
        self.addCleanup(
            test_utils.call_and_ignore_notfound_exc,
            self.compute_security_groups_client.delete_security_group,
            secgroup['id'])

        # Add rules to the security group
        self._create_loginable_secgroup_rule(secgroup['id'])

        return secgroup 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:19,代碼來源:manager.py

示例5: create_floating_ip

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_floating_ip(self, thing, external_network_id=None,
                           port_id=None, client=None):
        """Create a floating IP and associates to a resource/port on Neutron"""
        if not external_network_id:
            external_network_id = CONF.network.public_network_id
        if not client:
            client = self.floating_ips_client
        if not port_id:
            port_id, ip4 = self._get_server_port_id_and_ip4(thing)
        else:
            ip4 = None
        result = client.create_floatingip(
            floating_network_id=external_network_id,
            port_id=port_id,
            tenant_id=thing['tenant_id'],
            fixed_ip_address=ip4
        )
        floating_ip = result['floatingip']
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        client.delete_floatingip,
                        floating_ip['id'])
        return floating_ip 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:24,代碼來源:manager.py

示例6: _create_router

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def _create_router(self, client=None, tenant_id=None,
                       namestart='router-smoke'):
        if not client:
            client = self.routers_client
        if not tenant_id:
            tenant_id = client.tenant_id
        name = data_utils.rand_name(namestart)
        result = client.create_router(name=name,
                                      admin_state_up=True,
                                      tenant_id=tenant_id)
        router = result['router']
        self.assertEqual(router['name'], name)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        client.delete_router,
                        router['id'])
        return router 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:18,代碼來源:manager.py

示例7: delete_lb_pool_resources

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def delete_lb_pool_resources(self, lb_id, pool):
        pool_id = pool.get('id')
        hm = pool.get('healthmonitor')
        if hm:
            test_utils.call_and_ignore_notfound_exc(
                self.health_monitors_client.delete_health_monitor,
                pool.get('healthmonitor').get('id'))
            self.wait_for_load_balancer_status(lb_id)
        test_utils.call_and_ignore_notfound_exc(
            self.pools_client.delete_pool, pool.get('id'))
        self.wait_for_load_balancer_status(lb_id)
        for member in pool.get('members', []):
            test_utils.call_and_ignore_notfound_exc(
                self.members_client.delete_member,
                pool_id, member.get('id'))
            self.wait_for_load_balancer_status(lb_id) 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:18,代碼來源:test_lbaas_round_robin_ops.py

示例8: create_router_by_type

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_router_by_type(self, router_type, name=None, **kwargs):
        routers_client = self.manager.routers_client
        router_name = name or data_utils.rand_name('fwaas-')
        create_kwargs = dict(name=router_name, external_gateway_info={
            "network_id": CONF.network.public_network_id})
        if router_type in ('shared', 'exclusive'):
            create_kwargs['router_type'] = router_type
        elif router_type in ('distributed'):
            create_kwargs['distributed'] = True
        kwargs.update(create_kwargs)
        router = routers_client.create_router(**kwargs)
        router = router['router'] if 'router' in router else router
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        routers_client.delete_router, router['id'])
        self.assertEqual(router['name'], router_name)
        return router 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:18,代碼來源:test_v1_fwaas_basic_ops.py

示例9: create_router_by_type

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_router_by_type(self, router_type, name=None, **kwargs):
        routers_client = self.admin_manager.routers_client
        router_name = name or data_utils.rand_name('mtz-')
        create_kwargs = dict(name=router_name, external_gateway_info={
            "network_id": CONF.network.public_network_id})
        if router_type in ('shared', 'exclusive'):
            create_kwargs['router_type'] = router_type
        elif router_type in ('distributed'):
            create_kwargs['distributed'] = True
        kwargs.update(create_kwargs)
        router = routers_client.create_router(**kwargs)
        router = router['router'] if 'router' in router else router
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        routers_client.delete_router, router['id'])
        self.assertEqual(router['name'], router_name)
        return (routers_client, router) 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:18,代碼來源:test_multiple_transport_zones.py

示例10: create_router_and_add_interfaces

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_router_and_add_interfaces(self, router_type, nets):
        (routers_client, router) = self.create_router_by_type(router_type)
        if router_type == 'exclusive':
            router_nsxv_name = '%s-%s' % (router['name'], router['id'])
            exc_edge = self.vsm.get_edge(router_nsxv_name)
            self.assertTrue(exc_edge is not None)
            self.assertEqual(exc_edge['edgeType'], 'gatewayServices')
        for net_id, (s_id, network, subnet) in six.iteritems(nets):
            # register to cleanup before adding interfaces so interfaces
            # and router can be deleted if test is aborted.
            self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                routers_client.remove_router_interface,
                router['id'], subnet_id=subnet['id'])
            routers_client.add_router_interface(
                router['id'], subnet_id=subnet['id'])
        return router 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:18,代碼來源:test_multiple_transport_zones.py

示例11: create_network_with_bad_dns_search_domain

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_network_with_bad_dns_search_domain(
            self, dns_search_domain="[email protected]"):
        networks_client = self.networks_client
        subnets_client = self.subnets_client
        network_name = data_utils.rand_name('dns-sear-negative')
        resp = networks_client.create_network(name=network_name)
        network = resp.get('network', resp)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        networks_client.delete_network,
                        network['id'])
        subnet_cfg = {
            'client': subnets_client,
            'name': network_name,
            'dns_search_domain': dns_search_domain}
        # should trigger exception of BadRequest with message:
        # Invalid input for dns_search_domain: ...
        resp = self.create_subnet(network, **subnet_cfg)
        subnet = resp.get('subnet', resp)
        return (network, subnet) 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:21,代碼來源:test_dns_search_domain_negative.py

示例12: create_router_by_type

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_router_by_type(self, router_type, name=None, **kwargs):
        routers_client = self.manager.routers_client
        router_name = name or data_utils.rand_name('mtz-')
        create_kwargs = dict(name=router_name, external_gateway_info={
            "network_id": CONF.network.public_network_id})
        if router_type in ('shared', 'exclusive'):
            create_kwargs['router_type'] = router_type
        elif router_type in ('distributed'):
            create_kwargs['distributed'] = True
        kwargs.update(create_kwargs)
        router = routers_client.create_router(**kwargs)
        router = router['router'] if 'router' in router else router
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        routers_client.delete_router, router['id'])
        self.assertEqual(router['name'], router_name)
        return router 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:18,代碼來源:test_v1_fwaas.py

示例13: create_security_group_policy

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def create_security_group_policy(self, cmgr=None, policy_id=None,
                                     tenant_id=None, provider=False):
        cmgr = cmgr or self.cmgr_adm
        policy_id = policy_id or self.default_policy_id
        sg_client = cmgr.security_groups_client
        sg_dict = dict(policy=policy_id,
                       name=data_utils.rand_name('admin-policy'))
        if tenant_id:
            sg_dict['tenant_id'] = tenant_id
        if provider:
            sg_dict['provider'] = True
        sg = sg_client.create_security_group(**sg_dict)
        sg = sg.get('security_group', sg)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.delete_security_group,
                        sg_client, sg.get('id'))
        return sg 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:19,代碼來源:test_admin_policy.py

示例14: test_enable_port_direct

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def test_enable_port_direct(self):
        """
        Test updating a port to be a direct openstack port.
        After updating, check nsx_v backend for the port type.
        """
        test_flat_net = self._create_flat_network()
        test_port_name = data_utils.rand_name('test-port-')
        orig_post = {'name': test_port_name,
                     'port_security_enabled': 'False',
                     'security_groups': []}
        LOG.debug("create NORMAL port: %s", str(orig_post))
        test_port = self.create_port(network_id=test_flat_net['id'],
                                     **orig_post)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.delete_port, test_port['port']['id'])
        post_body = {'binding:vnic_type': 'direct'}
        LOG.debug("update port to be DIRECT: %s", str(orig_post))
        self.assertEqual(test_port['port']['binding:vnic_type'], 'normal',
                         "Port vnic-type is not NORMAL")
        updated_port = self.update_port(test_port['port']['id'], **post_body)
        self.assertEqual(updated_port['port']['binding:vnic_type'], 'direct',
                         "Port vnic-type was not updated to DIRECT") 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:24,代碼來源:test_port_types.py

示例15: test_update_direct_port_wout_flat_net_with_port_configs_negative

# 需要導入模塊: from tempest.lib.common.utils import test_utils [as 別名]
# 或者: from tempest.lib.common.utils.test_utils import call_and_ignore_notfound_exc [as 別名]
def test_update_direct_port_wout_flat_net_with_port_configs_negative(self):
        """
        Create a network. Create a normal openstack port. Update port to direct
        vnic-type. Update should fail since flat net prereq is not met
        """
        net_name = data_utils.rand_name('test-net')
        net_body = self.create_network(name=net_name)
        test_net = net_body['network']
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.delete_network, test_net['id'])
        test_port_name = data_utils.rand_name('test-port-')
        orig_post = {'name': test_port_name}
        LOG.debug("create NORMAL port: %s", str(orig_post))
        test_port = self.create_port(network_id=test_net['id'],
                                     **orig_post)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.delete_port, test_port['port']['id'])
        post_body = {'port_security_enabled': 'False',
                     'security_groups': [],
                     'binding:vnic_type': 'direct'}
        self.assertRaises(ex.BadRequest, self.update_port,
                          test_port['port']['id'], **post_body) 
開發者ID:openstack,項目名稱:vmware-nsx-tempest-plugin,代碼行數:24,代碼來源:test_port_types.py


注:本文中的tempest.lib.common.utils.test_utils.call_and_ignore_notfound_exc方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。