• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python rpc.create_connection函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

    def __init__(self, agent, host):
        # TODO(ihrachys): we can't use RpcCallback here due to
        # inheritance issues
        self.agent = agent
        self.conf = self.agent.conf
        self.root_helper = self.agent.root_helper
        self.host = host
        self.conn = rpc.create_connection(new=True)
        self.context = context.get_admin_context_without_session()
        self.topic = topics.IPSEC_AGENT_TOPIC
        node_topic = '%s.%s' % (self.topic, self.host)

        self.processes = {}
        self.process_status_cache = {}

        self.conn.create_consumer(
            node_topic,
            self.create_rpc_dispatcher(),
            fanout=False)
        self.conn.consume_in_thread()
        self.agent_rpc = IPsecVpnDriverApi(topics.IPSEC_DRIVER_TOPIC, '1.0')
        self.process_status_cache_check = loopingcall.FixedIntervalLoopingCall(
            self.report_status, self.context)
        self.process_status_cache_check.start(
            interval=self.conf.ipsec.ipsec_status_check_interval)
开发者ID:vbannai,项目名称:neutron,代码行数:25,代码来源:ipsec.py


示例2: __init__

    def __init__(self, server_timeout=None):
        super(NeutronRestProxyV2, self).__init__()
        LOG.info(_('NeutronRestProxy: Starting plugin. Version=%s'),
                 version_string_with_vcs())
        pl_config.register_config()

        # Include the BigSwitch Extensions path in the api_extensions
        neutron_extensions.append_api_extensions_path(extensions.__path__)

        self.add_meta_server_route = cfg.CONF.RESTPROXY.add_meta_server_route

        # init network ctrl connections
        self.servers = servermanager.ServerPool(server_timeout)

        # init dhcp support
        self.topic = topics.PLUGIN
        self.network_scheduler = importutils.import_object(
            cfg.CONF.network_scheduler_driver
        )
        self._dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
        self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
            self._dhcp_agent_notifier
        )
        self.conn = rpc.create_connection(new=True)
        self.callbacks = RpcProxy()
        self.dispatcher = self.callbacks.create_rpc_dispatcher()
        self.conn.create_consumer(self.topic, self.dispatcher,
                                  fanout=False)
        # Consume from all consumers in a thread
        self.conn.consume_in_thread()
        if cfg.CONF.RESTPROXY.sync_data:
            self._send_all_data()

        LOG.debug(_("NeutronRestProxyV2: initialization done"))
开发者ID:yuhui7red,项目名称:neutron,代码行数:34,代码来源:plugin.py


示例3: __init__

    def __init__(self, agent, host):
        self.host = host
        self.conn = rpc.create_connection(new=True)
        context = ctx.get_admin_context_without_session()
        node_topic = '%s.%s' % (topics.CISCO_IPSEC_AGENT_TOPIC, self.host)

        self.service_state = {}

        self.conn.create_consumer(
            node_topic,
            self.create_rpc_dispatcher(),
            fanout=False)
        self.conn.consume_in_thread()
        self.agent_rpc = (
            CiscoCsrIPsecVpnDriverApi(topics.CISCO_IPSEC_DRIVER_TOPIC, '1.0'))
        self.periodic_report = loopingcall.FixedIntervalLoopingCall(
            self.report_status, context)
        self.periodic_report.start(
            interval=agent.conf.cisco_csr_ipsec.status_check_interval)

        csrs_found = find_available_csrs_from_config(cfg.CONF.config_file)
        if csrs_found:
            LOG.info(_("Loaded %(num)d Cisco CSR configuration%(plural)s"),
                     {'num': len(csrs_found),
                      'plural': 's'[len(csrs_found) == 1:]})
        else:
            raise SystemExit(_('No Cisco CSR configurations found in: %s') %
                             cfg.CONF.config_file)
        self.csrs = dict([(k, csr_client.CsrRestClient(v['rest_mgmt'],
                                                       v['tunnel_ip'],
                                                       v['username'],
                                                       v['password'],
                                                       v['timeout']))
                          for k, v in csrs_found.items()])
开发者ID:Simplit-openapps,项目名称:neutron,代码行数:34,代码来源:cisco_ipsec.py


示例4: start

    def start(self):
        super(Service, self).start()

        self.conn = rpc.create_connection(new=True)
        LOG.debug("Creating Consumer connection for Service %s" %
                  self.topic)

        dispatcher = rpc_dispatcher.RpcDispatcher([self.manager],
                                                  self.serializer)

        # Share this same connection for these Consumers
        self.conn.create_consumer(self.topic, dispatcher, fanout=False)

        node_topic = '%s.%s' % (self.topic, self.host)
        self.conn.create_consumer(node_topic, dispatcher, fanout=False)

        self.conn.create_consumer(self.topic, dispatcher, fanout=True)

        # Hook to allow the manager to do other initializations after
        # the rpc connection is created.
        if callable(getattr(self.manager, 'initialize_service_hook', None)):
            self.manager.initialize_service_hook(self)

        # Consume from all consumers in a thread
        self.conn.consume_in_thread()
开发者ID:ArifovicH,项目名称:neutron,代码行数:25,代码来源:service.py


示例5: create_consumers

def create_consumers(dispatcher, prefix, topic_details):
    """Create agent RPC consumers.

    :param dispatcher: The dispatcher to process the incoming messages.
    :param prefix: Common prefix for the plugin/agent message queues.
    :param topic_details: A list of topics. Each topic has a name, an
                          operation, and an optional host param keying the
                          subscription to topic.host for plugin calls.

    :returns: A common Connection.
    """

    connection = rpc.create_connection(new=True)
    for details in topic_details:
        topic, operation, node_name = itertools.islice(
            itertools.chain(details, [None]), 3)

        topic_name = topics.get_topic_name(prefix, topic, operation)
        connection.create_consumer(topic_name, dispatcher, fanout=True)
        if node_name:
            node_topic_name = '%s.%s' % (topic_name, node_name)
            connection.create_consumer(node_topic_name,
                                       dispatcher,
                                       fanout=False)
    connection.consume_in_thread()
    return connection
开发者ID:CampHarmony,项目名称:neutron,代码行数:26,代码来源:rpc.py


示例6: start_rpc_listener

 def start_rpc_listener(self):
     self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager)
     self.topic = topics.PLUGIN
     self.conn = c_rpc.create_connection(new=True)
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher,
                               fanout=False)
     return self.conn.consume_in_thread()
开发者ID:Doude,项目名称:neutron,代码行数:8,代码来源:plugin.py


示例7: setup_rpc

 def setup_rpc(self):
     self.topic = skycloud_constants.PORT_FORWARD_PLUGIN_TOPIC
     self.rpc_api = port_forward_agent_notify_api.AgentNotify
     self.agent_notifiers = {skycloud_constants.PORT_FORWARD_AGENT: self.rpc_api}
     self.conn = rpc.create_connection(new=True)
     self.callbacks = PortForwardPluginRpcCallbacks()
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
     self.conn.consume_in_thread()
开发者ID:swordboy,项目名称:neutron-portforward-service,代码行数:9,代码来源:plugin.py


示例8: _setup_rpc_dhcp_metadata

 def _setup_rpc_dhcp_metadata(self, notifier=None):
     self.topic = topics.PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.dispatcher = nsx_rpc.NSXRpcCallbacks().create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = notifier or dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
     self.conn.consume_in_thread()
     self.network_scheduler = importutils.import_object(cfg.CONF.network_scheduler_driver)
     self.supported_extension_aliases.extend(["agent", "dhcp_agent_scheduler"])
开发者ID:B-Rich,项目名称:neutron,代码行数:9,代码来源:dhcpmeta_modes.py


示例9: _setup_rpc

 def _setup_rpc(self):
     self.notifier = rpc.AgentNotifierApi(topics.AGENT)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
     self.callbacks = rpc.RpcCallbacks(self.notifier, self.type_manager)
     self.topic = topics.PLUGIN
     self.conn = c_rpc.create_connection(new=True)
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
     self.conn.consume_in_thread()
开发者ID:ntt-sic,项目名称:neutron,代码行数:9,代码来源:plugin.py


示例10: setup_rpc

 def setup_rpc(self):
     # RPC support
     self.topic = topics.L3PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.agent_notifiers.update({q_const.AGENT_TYPE_L3: l3_rpc_agent_api.L3AgentNotify})
     self.callbacks = L3RouterPluginRpcCallbacks()
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
     self.conn.consume_in_thread()
开发者ID:B-Rich,项目名称:neutron,代码行数:9,代码来源:l3_router_plugin.py


示例11: setup_rpc

 def setup_rpc(self):
     # RPC support
     self.topic = topics.PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.callbacks = MidoRpcCallbacks()
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher,
                               fanout=False)
     # Consume from all consumers in a thread
     self.conn.consume_in_thread()
开发者ID:noxhana,项目名称:neutron,代码行数:10,代码来源:plugin.py


示例12: _setup_rpc

 def _setup_rpc(self):
     # RPC support
     self.service_topics = {svc_constants.CORE: topics.PLUGIN, svc_constants.L3_ROUTER_NAT: topics.L3PLUGIN}
     self.conn = rpc.create_connection(new=True)
     self.notifier = agent_notifier_api.AgentNotifierApi(topics.AGENT)
     self.callbacks = rpc_callbacks.HyperVRpcCallbacks(self.notifier)
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     for svc_topic in self.service_topics.values():
         self.conn.create_consumer(svc_topic, self.dispatcher, fanout=False)
     # Consume from all consumers in a thread
     self.conn.consume_in_thread()
开发者ID:B-Rich,项目名称:neutron,代码行数:11,代码来源:hyperv_neutron_plugin.py


示例13: setup_rpc

 def setup_rpc(self):
     # RPC support
     self.topic = topics.PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.notifier = AgentNotifierApi(topics.AGENT)
     self.callbacks = SdnveRpcCallbacks(self.notifier)
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher,
                               fanout=False)
     # Consume from all consumers in a thread
     self.conn.consume_in_thread()
开发者ID:50infivedays,项目名称:neutron,代码行数:11,代码来源:sdnve_neutron_plugin.py


示例14: __init__

    def __init__(self, plugin):
        self.agent_rpc = LoadBalancerAgentApi(TOPIC_LOADBALANCER_AGENT)
        self.callbacks = LoadBalancerCallbacks(plugin)

        self.conn = rpc.create_connection(new=True)
        self.conn.create_consumer(TOPIC_PROCESS_ON_HOST, self.callbacks.create_rpc_dispatcher(), fanout=False)
        self.conn.consume_in_thread()
        self.plugin = plugin
        self.plugin.agent_notifiers.update({q_const.AGENT_TYPE_LOADBALANCER: self.agent_rpc})

        self.pool_scheduler = importutils.import_object(cfg.CONF.loadbalancer_pool_scheduler_driver)
开发者ID:nitinnain,项目名称:neutron,代码行数:11,代码来源:plugin_driver.py


示例15: __init__

 def __init__(self, service_plugin):
     super(CiscoCsrIPsecVPNDriver, self).__init__(service_plugin)
     self.callbacks = CiscoCsrIPsecVpnDriverCallBack(self)
     self.conn = rpc.create_connection(new=True)
     self.conn.create_consumer(
         topics.CISCO_IPSEC_DRIVER_TOPIC,
         self.callbacks.create_rpc_dispatcher(),
         fanout=False)
     self.conn.consume_in_thread()
     self.agent_rpc = CiscoCsrIPsecVpnAgentApi(
         topics.CISCO_IPSEC_AGENT_TOPIC, BASE_IPSEC_VERSION)
开发者ID:ArifovicH,项目名称:neutron,代码行数:11,代码来源:cisco_ipsec.py


示例16: _set_callbacks_on_plugin

    def _set_callbacks_on_plugin(self):
        # other agent based plugin driver might already set callbacks on plugin
        if hasattr(self.plugin, 'agent_callbacks'):
            return

        self.plugin.agent_callbacks = LoadBalancerCallbacks(self.plugin)
        self.plugin.conn = rpc.create_connection(new=True)
        self.plugin.conn.create_consumer(
            topics.LOADBALANCER_PLUGIN,
            self.plugin.agent_callbacks.create_rpc_dispatcher(),
            fanout=False)
        self.plugin.conn.consume_in_thread()
开发者ID:CingHu,项目名称:neutron-1,代码行数:12,代码来源:agent_driver_base.py


示例17: _setup_rpc

 def _setup_rpc(self):
     # RPC support
     self.topic = topics.PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.callbacks = LinuxBridgeRpcCallbacks()
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher, fanout=False)
     # Consume from all consumers in a thread
     self.conn.consume_in_thread()
     self.notifier = AgentNotifierApi(topics.AGENT)
     self.agent_notifiers[q_const.AGENT_TYPE_DHCP] = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
     self.agent_notifiers[q_const.AGENT_TYPE_L3] = l3_rpc_agent_api.L3AgentNotify
开发者ID:sukhdevkapur,项目名称:neutron,代码行数:12,代码来源:lb_neutron_plugin.py


示例18: _setup_rpc_dhcp_metadata

 def _setup_rpc_dhcp_metadata(self):
     self.topic = topics.PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.dispatcher = nvp_rpc.NVPRpcCallbacks().create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher,
                               fanout=False)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
         dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
     self.conn.consume_in_thread()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver
     )
开发者ID:ChengZuo,项目名称:neutron,代码行数:12,代码来源:dhcpmeta_modes.py


示例19: __init__

    def __init__(self):
        super(MeteringPlugin, self).__init__()

        self.callbacks = MeteringCallbacks(self)

        self.conn = rpc.create_connection(new=True)
        self.conn.create_consumer(
            topics.METERING_PLUGIN,
            self.callbacks.create_rpc_dispatcher(),
            fanout=False)
        self.conn.consume_in_thread()

        self.meter_rpc = metering_rpc_agent_api.MeteringAgentNotifyAPI()
开发者ID:50infivedays,项目名称:neutron,代码行数:13,代码来源:metering_plugin.py


示例20: setup_rpc

 def setup_rpc(self):
     # RPC support
     self.topic = topics.PLUGIN
     self.conn = rpc.create_connection(new=True)
     self.notifier = AgentNotifierApi(topics.AGENT)
     self.dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI()
     self.l3_agent_notifier = l3_rpc_agent_api.L3AgentNotify
     self.callbacks = OVSRpcCallbacks(self.notifier, self.tunnel_type)
     self.dispatcher = self.callbacks.create_rpc_dispatcher()
     self.conn.create_consumer(self.topic, self.dispatcher,
                               fanout=False)
     # Consume from all consumers in a thread
     self.conn.consume_in_thread()
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:13,代码来源:ovs_neutron_plugin.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python amqp.get_connection_pool函数代码示例发布时间:2022-05-27
下一篇:
Python policy.set_rules函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap