当前位置: 首页>>代码示例>>Python>>正文


Python utils.load_interface_driver函数代码示例

本文整理汇总了Python中neutron.agent.common.utils.load_interface_driver函数的典型用法代码示例。如果您正苦于以下问题:Python load_interface_driver函数的具体用法?Python load_interface_driver怎么用?Python load_interface_driver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了load_interface_driver函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_load_interface_driver_does_not_consume_irrelevant_errors

 def test_load_interface_driver_does_not_consume_irrelevant_errors(self):
     self.conf.set_override('interface_driver',
                            'neutron.agent.linux.interface.NullDriver')
     with mock.patch('oslo_utils.importutils.import_class',
                     side_effect=RuntimeError()):
         with testlib_api.ExpectedException(RuntimeError):
             utils.load_interface_driver(self.conf)
开发者ID:cubeek,项目名称:neutron,代码行数:7,代码来源:test_utils.py

示例2: initialize_app

 def initialize_app(self, argv):
     super(NeutronDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
     client = self.client_manager.neutron
     cfg.CONF.register_opts(interface.OPTS)
     cfg.CONF.register_opts(config.EXT_NET_BRIDGE_OPTS)
     config.register_interface_driver_opts_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging()
     driver = utils.load_interface_driver(cfg.CONF)
     self.debug_agent = debug_agent.NeutronDebugAgent(cfg.CONF,
                                                      client,
                                                      driver)
开发者ID:davidcusatis,项目名称:neutron,代码行数:16,代码来源:shell.py

示例3: initialize_app

 def initialize_app(self, argv):
     super(NeutronDebugShell, self).initialize_app(argv)
     if not self.options.config_file:
         raise exc.CommandError(
             _("You must provide a config file for bridge -"
               " either --config-file or env[NEUTRON_TEST_CONFIG_FILE]"))
     client = self.client_manager.neutron
     config.register_interface_opts()
     config.register_interface_driver_opts_helper(cfg.CONF)
     cfg.CONF(['--config-file', self.options.config_file])
     config.setup_logging()
     driver = utils.load_interface_driver(cfg.CONF)
     self.debug_agent = debug_agent.NeutronDebugAgent(cfg.CONF,
                                                      client,
                                                      driver)
     self.log.warning('This tool is deprecated and will be removed '
                      'in the future to be replaced with a more '
                      'powerful troubleshooting toolkit.')
开发者ID:openstack,项目名称:neutron,代码行数:18,代码来源:shell.py

示例4: test_load_interface_driver_as_alias_wrong_driver

 def test_load_interface_driver_as_alias_wrong_driver(self):
     self.conf.set_override('interface_driver', 'openvswitchXX')
     with testlib_api.ExpectedException(SystemExit):
         utils.load_interface_driver(self.conf)
开发者ID:cubeek,项目名称:neutron,代码行数:4,代码来源:test_utils.py

示例5: test_load_ovs_interface_driver_success

 def test_load_ovs_interface_driver_success(self):
     self.conf.set_override('interface_driver',
                            'openvswitch')
     self.assertIsInstance(utils.load_interface_driver(self.conf),
                           interface.OVSInterfaceDriver)
开发者ID:cubeek,项目名称:neutron,代码行数:5,代码来源:test_utils.py

示例6: test_load_linuxbridge_interface_driver_success

 def test_load_linuxbridge_interface_driver_success(self):
     self.conf.set_override('interface_driver',
                            'linuxbridge')
     self.assertIsInstance(utils.load_interface_driver(self.conf),
                           interface.BridgeInterfaceDriver)
开发者ID:cubeek,项目名称:neutron,代码行数:5,代码来源:test_utils.py

示例7: test_load_null_interface_driver_success

 def test_load_null_interface_driver_success(self):
     self.conf.set_override('interface_driver',
                            'null')
     self.assertIsInstance(utils.load_interface_driver(self.conf),
                           interface.NullDriver)
开发者ID:cubeek,项目名称:neutron,代码行数:5,代码来源:test_utils.py

示例8: test_load_interface_driver_success

 def test_load_interface_driver_success(self):
     self.conf.set_override('interface_driver',
                            'neutron.agent.linux.interface.NullDriver')
     self.assertIsInstance(utils.load_interface_driver(self.conf),
                           interface.NullDriver)
开发者ID:cubeek,项目名称:neutron,代码行数:5,代码来源:test_utils.py

示例9: __init__

    def __init__(self, plugin, conf):
        self.plugin = plugin
        self.conf = conf or cfg.CONF
        self.routers = {}

        self.driver = common_utils.load_interface_driver(self.conf)
开发者ID:openstack,项目名称:neutron,代码行数:6,代码来源:iptables_driver.py

示例10: test_load_interface_driver_not_set

 def test_load_interface_driver_not_set(self):
     with testlib_api.ExpectedException(SystemExit):
         utils.load_interface_driver(self.conf)
开发者ID:cubeek,项目名称:neutron,代码行数:3,代码来源:test_utils.py

示例11: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.router_info = {}

        self._check_config_params()

        self.process_monitor = external_process.ProcessMonitor(
            config=self.conf,
            resource_type='router')

        self.driver = common_utils.load_interface_driver(self.conf)

        self.context = n_context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.L3PLUGIN, host)
        self.fullsync = True

        # Get the list of service plugins from Neutron Server
        # This is the first place where we contact neutron-server on startup
        # so retry in case its not ready to respond.
        retry_count = 5
        while True:
            retry_count = retry_count - 1
            try:
                self.neutron_service_plugins = (
                    self.plugin_rpc.get_service_plugin_list(self.context))
            except oslo_messaging.RemoteError as e:
                with excutils.save_and_reraise_exception() as ctx:
                    ctx.reraise = False
                    LOG.warning(_LW('l3-agent cannot check service plugins '
                                    'enabled at the neutron server when '
                                    'startup due to RPC error. It happens '
                                    'when the server does not support this '
                                    'RPC API. If the error is '
                                    'UnsupportedVersion you can ignore this '
                                    'warning. Detail message: %s'), e)
                self.neutron_service_plugins = None
            except oslo_messaging.MessagingTimeout as e:
                with excutils.save_and_reraise_exception() as ctx:
                    if retry_count > 0:
                        ctx.reraise = False
                        LOG.warning(_LW('l3-agent cannot check service '
                                        'plugins enabled on the neutron '
                                        'server. Retrying. '
                                        'Detail message: %s'), e)
                        continue
            break

        self.metadata_driver = None
        if self.conf.enable_metadata_proxy:
            self.metadata_driver = metadata_driver.MetadataDriver(self)

        self.namespaces_manager = namespace_manager.NamespaceManager(
            self.conf,
            self.driver,
            self.conf.use_namespaces,
            self.metadata_driver)

        self._queue = queue.RouterProcessingQueue()
        super(L3NATAgent, self).__init__(conf=self.conf)

        self.target_ex_net_id = None
        self.use_ipv6 = ipv6_utils.is_enabled()
开发者ID:shraddha-pandhe,项目名称:neutron,代码行数:65,代码来源:agent.py

示例12: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.router_info = {}

        self._check_config_params()

        self.process_monitor = external_process.ProcessMonitor(
            config=self.conf,
            resource_type='router')

        self.driver = common_utils.load_interface_driver(self.conf)

        self._context = n_context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.L3PLUGIN, host)
        self.fullsync = True
        self.sync_routers_chunk_size = SYNC_ROUTERS_MAX_CHUNK_SIZE

        # Get the HA router count from Neutron Server
        # This is the first place where we contact neutron-server on startup
        # so retry in case its not ready to respond.
        while True:
            try:
                self.ha_router_count = int(
                    self.plugin_rpc.get_host_ha_router_count(self.context))
            except oslo_messaging.MessagingTimeout as e:
                LOG.warning('l3-agent cannot contact neutron server '
                            'to retrieve HA router count. '
                            'Check connectivity to neutron server. '
                            'Retrying... '
                            'Detailed message: %(msg)s.', {'msg': e})
                continue
            break
        LOG.info("Agent HA routers count %s", self.ha_router_count)

        self.init_extension_manager(self.plugin_rpc)

        self.metadata_driver = None
        if self.conf.enable_metadata_proxy:
            self.metadata_driver = metadata_driver.MetadataDriver(self)

        self.namespaces_manager = namespace_manager.NamespaceManager(
            self.conf,
            self.driver,
            self.metadata_driver)

        # L3 agent router processing green pool
        self._pool = eventlet.GreenPool(size=ROUTER_PROCESS_GREENLET_MIN)
        self._queue = queue.ResourceProcessingQueue()
        super(L3NATAgent, self).__init__(host=self.conf.host)

        self.target_ex_net_id = None
        self.use_ipv6 = ipv6_utils.is_enabled_and_bind_by_default()

        self.pd = pd.PrefixDelegation(self.context, self.process_monitor,
                                      self.driver,
                                      self.plugin_rpc.process_prefix_update,
                                      self.create_pd_router_update,
                                      self.conf)

        # Consume network updates to trigger router resync
        consumers = [[topics.NETWORK, topics.UPDATE]]
        agent_rpc.create_consumers([self], topics.AGENT, consumers)

        self._check_ha_router_process_status()
开发者ID:igordcard,项目名称:neutron,代码行数:67,代码来源:agent.py

示例13: test_load_ivs_interface_driver_success

 def test_load_ivs_interface_driver_success(self):
     self.conf.set_override("interface_driver", "ivs")
     self.assertIsInstance(utils.load_interface_driver(self.conf), interface.IVSInterfaceDriver)
开发者ID:davidcusatis,项目名称:neutron,代码行数:3,代码来源:test_utils.py

示例14: __init__

    def __init__(self, host, conf=None):
        if conf:
            self.conf = conf
        else:
            self.conf = cfg.CONF
        self.router_info = {}

        self._check_config_params()

        self.process_monitor = external_process.ProcessMonitor(
            config=self.conf,
            resource_type='router')

        self.driver = common_utils.load_interface_driver(self.conf)

        self._context = n_context.get_admin_context_without_session()
        self.plugin_rpc = L3PluginApi(topics.L3PLUGIN, host)
        self.fullsync = True
        self.sync_routers_chunk_size = SYNC_ROUTERS_MAX_CHUNK_SIZE

        # Get the list of service plugins from Neutron Server
        # This is the first place where we contact neutron-server on startup
        # so retry in case its not ready to respond.
        while True:
            try:
                self.neutron_service_plugins = (
                    self.plugin_rpc.get_service_plugin_list(self.context))
            except oslo_messaging.MessagingTimeout as e:
                LOG.warning('l3-agent cannot contact neutron server '
                            'to retrieve service plugins enabled. '
                            'Check connectivity to neutron server. '
                            'Retrying... '
                            'Detailed message: %(msg)s.', {'msg': e})
                continue
            break

        self.init_extension_manager(self.plugin_rpc)

        self.metadata_driver = None
        if self.conf.enable_metadata_proxy:
            self.metadata_driver = metadata_driver.MetadataDriver(self)

        self.namespaces_manager = namespace_manager.NamespaceManager(
            self.conf,
            self.driver,
            self.metadata_driver)

        self._queue = queue.ResourceProcessingQueue()
        super(L3NATAgent, self).__init__(host=self.conf.host)

        self.target_ex_net_id = None
        self.use_ipv6 = ipv6_utils.is_enabled_and_bind_by_default()

        self.pd = pd.PrefixDelegation(self.context, self.process_monitor,
                                      self.driver,
                                      self.plugin_rpc.process_prefix_update,
                                      self.create_pd_router_update,
                                      self.conf)

        # Consume network updates to trigger router resync
        consumers = [[topics.NETWORK, topics.UPDATE]]
        agent_rpc.create_consumers([self], topics.AGENT, consumers)

        # We set HA network port status to DOWN to let l2 agent update it
        # to ACTIVE after wiring. This allows us to spawn keepalived only
        # when l2 agent finished wiring the port.
        try:
            self.plugin_rpc.update_all_ha_network_port_statuses(self.context)
        except Exception:
            LOG.exception('update_all_ha_network_port_statuses failed')
开发者ID:noironetworks,项目名称:neutron,代码行数:70,代码来源:agent.py

示例15: test_load_interface_driver_wrong_driver

 def test_load_interface_driver_wrong_driver(self):
     self.conf.set_override('interface_driver', 'neutron.NonExistentDriver')
     with testlib_api.ExpectedException(SystemExit):
         utils.load_interface_driver(self.conf)
开发者ID:cubeek,项目名称:neutron,代码行数:4,代码来源:test_utils.py


注:本文中的neutron.agent.common.utils.load_interface_driver函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。