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

Python rpc.create_consumers函数代码示例

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

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



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

示例1: _test_create_consumers

 def _test_create_consumers(
     self, endpoints, method, expected, topics, listen):
     call_to_patch = 'neutron.common.rpc.Connection'
     with mock.patch(call_to_patch) as create_connection:
         rpc.create_consumers(
             endpoints, method, topics, start_listening=listen)
         create_connection.assert_has_calls(expected)
开发者ID:mmalchuk,项目名称:openstack-neutron,代码行数:7,代码来源:test_rpc.py


示例2: test_create_consumers_with_node_name

    def test_create_consumers_with_node_name(self):
        endpoints = [mock.Mock()]
        expected = [
            mock.call(),
            mock.call().create_consumer("foo-topic-op", endpoints, fanout=True),
            mock.call().create_consumer("foo-topic-op.node1", endpoints, fanout=False),
            mock.call().consume_in_threads(),
        ]

        call_to_patch = "neutron.common.rpc.create_connection"
        with mock.patch(call_to_patch) as create_connection:
            rpc.create_consumers(endpoints, "foo", [("topic", "op", "node1")])
            create_connection.assert_has_calls(expected)
开发者ID:sebrandon1,项目名称:neutron,代码行数:13,代码来源:test_rpc.py


示例3: test_create_consumers

    def test_create_consumers(self):
        dispatcher = mock.Mock()
        expected = [
            mock.call(new=True),
            mock.call().create_consumer('foo-topic-op', dispatcher,
                                        fanout=True),
            mock.call().consume_in_thread()
        ]

        call_to_patch = 'neutron.openstack.common.rpc.create_connection'
        with mock.patch(call_to_patch) as create_connection:
            rpc.create_consumers(dispatcher, 'foo', [('topic', 'op')])
            create_connection.assert_has_calls(expected)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:13,代码来源:test_agent_rpc.py


示例4: test_create_consumers

    def test_create_consumers(self):
        endpoints = [mock.Mock()]
        expected = [
            mock.call(new=True),
            mock.call().create_consumer('foo-topic-op', endpoints,
                                        fanout=True),
            mock.call().consume_in_threads()
        ]

        call_to_patch = 'neutron.common.rpc.create_connection'
        with mock.patch(call_to_patch) as create_connection:
            rpc.create_consumers(endpoints, 'foo', [('topic', 'op')])
            create_connection.assert_has_calls(expected)
开发者ID:AsherBond,项目名称:quantum,代码行数:13,代码来源:test_agent_rpc.py


示例5: test_create_consumers_with_node_name

    def test_create_consumers_with_node_name(self):
        endpoints = [mock.Mock()]
        expected = [
            mock.call(),
            mock.call().create_consumer('foo-topic-op', endpoints,
                                        fanout=True),
            mock.call().create_consumer('foo-topic-op.node1', endpoints,
                                        fanout=False),
            mock.call().consume_in_threads()
        ]

        with mock.patch.object(n_rpc, 'Connection') as create_connection:
            rpc.create_consumers(endpoints, 'foo', [('topic', 'op', 'node1')])
            create_connection.assert_has_calls(expected)
开发者ID:noironetworks,项目名称:neutron,代码行数:14,代码来源:test_rpc.py


示例6: setup_rpc

    def setup_rpc(self, physical_interfaces):
        if physical_interfaces:
            mac = utils.get_interface_mac(physical_interfaces[0])
        else:
            devices = ip_lib.IPWrapper().get_devices(True)
            if devices:
                mac = utils.get_interface_mac(devices[0].name)
            else:
                LOG.error(_LE("Unable to obtain MAC address for unique ID. " "Agent terminated!"))
                exit(1)

        self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context, self.sg_plugin_rpc, defer_refresh_firewall=True)

        self.agent_id = "%s%s" % ("lb", (mac.replace(":", "")))
        LOG.info(_LI("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
        # RPC network init
        # Handle updates from service
        self.endpoints = [LinuxBridgeRpcCallbacks(self.context, self, self.sg_agent)]
        # Define the listening consumers for the agent
        consumers = [
            [topics.PORT, topics.UPDATE],
            [topics.NETWORK, topics.DELETE],
            [topics.NETWORK, topics.UPDATE],
            [topics.SECURITY_GROUP, topics.UPDATE],
        ]

        if cfg.CONF.VXLAN.l2_population:
            consumers.append([topics.L2POPULATION, topics.UPDATE])
        self.connection = agent_rpc.create_consumers(self.endpoints, self.topic, consumers)
开发者ID:rkukura,项目名称:neutron,代码行数:34,代码来源:linuxbridge_neutron_agent.py


示例7: __init__

 def __init__(self, host, conf=None):
     self.state_rpc = agent_rpc.PluginReportStateAPI(n_topics.SVMDEVICE_DRIVER_TOPIC)
     self.agent_state = {
         'binary': 'neutron-servicevm-agent',
         'host': host,
         'topic': topics.SERVICEVM_AGENT,
         'configurations': {},
         'start_flag': True,
         'agent_type': constants.AGENT_TYPE_SERVICEVM}
     report_interval = cfg.CONF.AGENT.report_interval
     self.use_call = True
     self._initialize_rpc(host)
     self.topic = topics.SERVICEVM
     self.endpoints = [self]
     consumers = [[topics.SUBNET, topics.UPDATE],
                  [topics.SUBNET, topics.DELETE],
                  [topics.SUBNET, topics.CREATE]]
     self.connection = agent_rpc.create_consumers(self.endpoints,
                                                  self.topic,
                                                  consumers)
     #self._agent_registration()
     super(ServiceVMAgentWithStateReport, self).__init__(host=host,
                                                        conf=conf)
     if report_interval:
         self.heartbeat = loopingcall.FixedIntervalLoopingCall(
             self._report_state)
         #self.heartbeat.start(interval=report_interval)
         self.heartbeat.start(interval=2)
开发者ID:CingHu,项目名称:neutron-ustack,代码行数:28,代码来源:agent.py


示例8: setup_rpc

    def setup_rpc(self, physical_interfaces):
        if physical_interfaces:
            mac = utils.get_interface_mac(physical_interfaces[0])
        else:
            devices = ip_lib.IPWrapper().get_devices(True)
            if devices:
                mac = utils.get_interface_mac(devices[0].name)
            else:
                LOG.error(_LE("Unable to obtain MAC address for unique ID. "
                              "Agent terminated!"))
                exit(1)
        self.agent_id = '%s%s' % ('lb', (mac.replace(":", "")))
        LOG.info(_LI("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        # RPC network init
        # Handle updates from service
        self.endpoints = [LinuxBridgeRpcCallbacks(self.context, self,
                                                  self.sg_agent)]
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        if cfg.CONF.VXLAN.l2_population:
            consumers.append([topics.L2POPULATION,
                              topics.UPDATE, cfg.CONF.host])
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers)
        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:rajeshmohan,项目名称:neutron,代码行数:35,代码来源:linuxbridge_neutron_agent.py


示例9: setup_rpc

    def setup_rpc(self, host):
        self.agent_id = 'servicechain_agent_%s' % platform.node()
        self.plugin_rpc = ServiceChainPluginApi(sc_constants.SERVICECHAIN_TOPIC, host) 


        self.topic = sc_constants.SERVICECHAIN_AGENT_TOPIC
   
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        self.context = context.get_admin_context_without_session()
        self.dispatcher = [self]
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     ['port_flows','add',cfg.CONF.host],
                     ['port_flows','delete',cfg.CONF.host],
                     ['port_type','set',cfg.CONF.host],
                     ['port_type','clear',cfg.CONF.host]]
        
        
        self.connection = agent_rpc.create_consumers(self.dispatcher,
                                                     self.topic,
                                                     consumers)
        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:27,代码来源:servicechain_agent.py


示例10: _set_l2_rpc_consumers

 def _set_l2_rpc_consumers(self):
     self.endpoints = [L2populationRpcCallback(self)]
     # Define the listening consumers for the agent
     consumers = [[topics.L2POPULATION, topics.UPDATE, self.conf.host]]
     self.connection = agent_rpc.create_consumers(self.endpoints,
                                                  topics.AGENT,
                                                  consumers)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:7,代码来源:l3_highperformance_agent.py


示例11: setup_rpc

    def setup_rpc(self):

        self.host = socket.gethostname()
        self.agent_id = 'nvsd-q-agent.%s' % self.host
        LOG.info(_LI("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.context = n_context.get_admin_context_without_session()
        self.sg_plugin_rpc = sg_rpc.SecurityGroupServerRpcApi(topics.PLUGIN)
        self.sg_agent = sg_rpc.SecurityGroupAgentRpc(self.context,
                                                     self.sg_plugin_rpc)

        # RPC network init
        # Handle updates from service
        self.callback_oc = NVSDAgentRpcCallback(self.context,
                                                self, self.sg_agent)
        self.callback_sg = SecurityGroupAgentRpcCallback(self.context,
                                                         self.sg_agent)
        self.endpoints = [self.callback_oc, self.callback_sg]
        # Define the listening consumer for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers)
开发者ID:Akanksha08,项目名称:neutron,代码行数:25,代码来源:nvsd_neutron_agent.py


示例12: setup_rpc

    def setup_rpc(self):
        mac = self.int_br.get_local_port_mac()
        self.agent_id = "%s%s" % ("ovs", (mac.replace(":", "")))
        self.topic = topics.AGENT
        self.plugin_rpc = OVSPluginApi(topics.PLUGIN)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        # RPC network init
        self.context = context.get_admin_context_without_session()
        # Handle updates from service
        self.dispatcher = self.create_rpc_dispatcher()
        # Define the listening consumers for the agent
        consumers = [
            [topics.PORT, topics.UPDATE],
            [topics.NETWORK, topics.DELETE],
            [constants.TUNNEL, topics.UPDATE],
            [topics.SECURITY_GROUP, topics.UPDATE],
        ]
        if self.l2_pop:
            consumers.append([topics.L2POPULATION, topics.UPDATE, cfg.CONF.host])
        self.connection = agent_rpc.create_consumers(self.dispatcher, self.topic, consumers)
        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:vnaum,项目名称:neutron,代码行数:25,代码来源:ovs_neutron_agent.py


示例13: setup_rpc

    def setup_rpc(self):

        self.host = socket.gethostname()
        self.agent_id = 'nvsd-q-agent.%s' % self.host
        LOG.info(_("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.context = n_context.get_admin_context_without_session()
        self.sg_agent = SecurityGroupAgentRpc(self.context,
                                              self.root_helper)

        # RPC network init
        # Handle updates from service
        self.callback_oc = NVSDAgentRpcCallback(self.context,
                                                self, self.sg_agent)
        self.callback_sg = SecurityGroupAgentRpcCallback(self.context,
                                                         self.sg_agent)
        self.dispatcher = dispatcher.RpcDispatcher([self.callback_oc,
                                                    self.callback_sg])
        # Define the listening consumer for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.dispatcher,
                                                     self.topic,
                                                     consumers)
开发者ID:NKSG,项目名称:neutron,代码行数:25,代码来源:nvsd_neutron_agent.py


示例14: _setup_rpc

    def _setup_rpc(self):
        self.agent_id = 'nic-switch-agent.%s' % socket.gethostname()
        LOG.info(_LI("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS)
        # RPC network init
        # Handle updates from service
        self.endpoints = [SriovNicSwitchRpcCallbacks(self.context, self,
                                                     self.sg_agent)]
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.NETWORK, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers,
                                                     start_listening=False)

        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:Taoanshan,项目名称:neutron,代码行数:25,代码来源:sriov_nic_agent.py


示例15: _setup_rpc

    def _setup_rpc(self):
        self.agent_id = 'hyperv_%s' % platform.node()
        self.topic = topics.AGENT
        self.plugin_rpc = HyperVPluginApi(topics.PLUGIN)

        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)

        # RPC network init
        self.context = context.get_admin_context_without_session()
        # Handle updates from service
        self.endpoints = [self]
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.PORT, topics.DELETE],
                     [constants.TUNNEL, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers)

        self.sec_groups_agent = HyperVSecurityAgent(
            self.context, self.plugin_rpc)
        report_interval = CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:PFZheng,项目名称:neutron,代码行数:27,代码来源:hyperv_neutron_agent.py


示例16: _setup_rpc

 def _setup_rpc(self):
     self.topic = topics.AGENT
     self.plugin_rpc = RyuPluginApi(topics.PLUGIN)
     self.context = q_context.get_admin_context_without_session()
     self.endpoints = [self]
     consumers = [[topics.PORT, topics.UPDATE], [topics.SECURITY_GROUP, topics.UPDATE]]
     self.connection = agent_rpc.create_consumers(self.endpoints, self.topic, consumers)
开发者ID:armando-migliaccio,项目名称:neutron-1,代码行数:7,代码来源:ryu_neutron_agent.py


示例17: _setup_rpc

    def _setup_rpc(self):
        self.agent_id = 'mlnx-agent.%s' % socket.gethostname()
        LOG.info(_("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.plugin_rpc = MlnxEswitchPluginApi(topics.PLUGIN)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        # RPC network init
        self.context = context.get_admin_context_without_session()
        # Handle updates from service
        self.callbacks = MlnxEswitchRpcCallbacks(self.context,
                                                 self)
        self.dispatcher = self.callbacks.create_rpc_dispatcher()
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.dispatcher,
                                                     self.topic,
                                                     consumers)

        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.LoopingCall(self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:ChengZuo,项目名称:neutron,代码行数:25,代码来源:eswitch_neutron_agent.py


示例18: setup_rpc

    def setup_rpc(self, physical_interfaces):
        if physical_interfaces:
            mac = utils.get_interface_mac(physical_interfaces[0])
        else:
            devices = ip_lib.IPWrapper(self.root_helper).get_devices(True)
            if devices:
                mac = utils.get_interface_mac(devices[0].name)
            else:
                LOG.error(_("Unable to obtain MAC address for unique ID. "
                          "Agent terminated!"))
                exit(1)
        self.agent_id = '%s%s' % ('lb', (mac.replace(":", "")))
        LOG.info(_("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.plugin_rpc = LinuxBridgePluginApi(topics.PLUGIN)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        # RPC network init
        self.context = context.get_admin_context_without_session()
        # Handle updates from service
        self.callbacks = LinuxBridgeRpcCallbacks(self.context,
                                                 self)
        self.dispatcher = self.callbacks.create_rpc_dispatcher()
        # Define the listening consumers for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.NETWORK, topics.DELETE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.dispatcher,
                                                     self.topic,
                                                     consumers)
        report_interval = cfg.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:fyafighter,项目名称:neutron,代码行数:35,代码来源:linuxbridge_neutron_agent.py


示例19: setup_rpc

    def setup_rpc(self):
        self.host = socket.gethostname()
        self.agent_id = 'nec-q-agent.%s' % self.host
        LOG.info(_("RPC agent_id: %s"), self.agent_id)

        self.topic = topics.AGENT
        self.context = q_context.get_admin_context_without_session()

        self.plugin_rpc = NECPluginApi(topics.PLUGIN)
        self.state_rpc = agent_rpc.PluginReportStateAPI(topics.PLUGIN)
        self.sg_agent = SecurityGroupAgentRpc(self.context)

        # RPC network init
        # Handle updates from service
        self.callback_nec = NECAgentRpcCallback(self.context,
                                                self, self.sg_agent)
        self.callback_sg = SecurityGroupAgentRpcCallback(self.context,
                                                         self.sg_agent)
        self.endpoints = [self.callback_nec, self.callback_sg]
        # Define the listening consumer for the agent
        consumers = [[topics.PORT, topics.UPDATE],
                     [topics.SECURITY_GROUP, topics.UPDATE]]
        self.connection = agent_rpc.create_consumers(self.endpoints,
                                                     self.topic,
                                                     consumers)

        report_interval = config.CONF.AGENT.report_interval
        if report_interval:
            heartbeat = loopingcall.FixedIntervalLoopingCall(
                self._report_state)
            heartbeat.start(interval=report_interval)
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:31,代码来源:nec_neutron_agent.py


示例20: __init__

 def __init__(self):
     self.connection = agent_rpc.create_consumers(
         [self],
         topics.AGENT,
         [topics.L2POPULATION, topics.UPDATE],
         start_listening=False
     )
     self.connection.consume_in_threads()
开发者ID:lionelz,项目名称:networking-bambuk,代码行数:8,代码来源:bambuk_l2pop.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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