本文整理汇总了Python中quantum.agent.rpc.create_consumers函数的典型用法代码示例。如果您正苦于以下问题:Python create_consumers函数的具体用法?Python create_consumers怎么用?Python create_consumers使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_consumers函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: 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 = 'quantum.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:DestinyOneSystems,项目名称:quantum,代码行数:13,代码来源:test_agent_rpc.py
示例2: 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.dispatcher = dispatcher.RpcDispatcher([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.dispatcher,
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:NCU-PDCLAB,项目名称:quantum,代码行数:32,代码来源:nec_quantum_agent.py
示例3: 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:NCU-PDCLAB,项目名称:quantum,代码行数:35,代码来源:linuxbridge_quantum_agent.py
示例4: _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.dispatcher = self._create_rpc_dispatcher()
consumers = [[topics.PORT, topics.UPDATE],
[topics.SECURITY_GROUP, topics.UPDATE]]
self.connection = agent_rpc.create_consumers(self.dispatcher,
self.topic,
consumers)
开发者ID:NCU-PDCLAB,项目名称:quantum,代码行数:10,代码来源:ryu_quantum_agent.py
示例5: 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 = "quantum.openstack.common.rpc.create_connection"
with mock.patch(call_to_patch) as create_connection:
conn = rpc.create_consumers(dispatcher, "foo", [("topic", "op")])
create_connection.assert_has_calls(expected)
开发者ID:shaoyexin,项目名称:quantum,代码行数:12,代码来源:test_agent_rpc.py
示例6: setup_rpc
def setup_rpc(self, integ_br):
mac = utils.get_interface_mac(integ_br)
self.agent_id = "%s%s" % ("ovs", (mac.replace(":", "")))
self.topic = topics.AGENT
self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
# RPC network init
self.context = context.RequestContext("quantum", "quantum", is_admin=False)
# Handle updates from service
self.callbacks = OVSRpcCallbacks(self.context, self.int_br, self.local_ip, self.tun_br)
self.dispatcher = self.callbacks.create_rpc_dispatcher()
# Define the listening consumers for the agent
consumers = [[topics.PORT, topics.UPDATE], [topics.NETWORK, topics.DELETE], [config.TUNNEL, topics.UPDATE]]
self.connection = agent_rpc.create_consumers(self.dispatcher, self.topic, consumers)
开发者ID:t-lin,项目名称:quantum,代码行数:14,代码来源:ovs_quantum_agent.py
示例7: _setup_rpc
def _setup_rpc(self):
self.agent_id = 'mlx-agent.%s' % socket.gethostname()
self.topic = topics.AGENT
self.plugin_rpc = agent_rpc.PluginApi(topics.PLUGIN)
# RPC network init
self.context = context.RequestContext('quantum', 'quantum',
is_admin=False)
# Handle updates from service
self.callbacks = MlxEswitchRpcCallbacks(self.context,self.eswitch)
self.dispatcher = self.callbacks.create_rpc_dispatcher()
# Define the listening consumers for the agent
consumers = [[topics.PORT, topics.UPDATE],
[topics.NETWORK, topics.DELETE]]
self.connection = agent_rpc.create_consumers(self.dispatcher,
self.topic,
consumers)
开发者ID:pperezrubio,项目名称:mellanox-quantum-plugin,代码行数:16,代码来源:eswitch_quantum_agent.py
示例8: setup_rpc
def setup_rpc(self, integ_br):
mac = utils.get_interface_mac(integ_br)
self.agent_id = '%s%s' % ('ovs', (mac.replace(":", "")))
self.topic = topics.AGENT
self.plugin_rpc = agent_rpc.PluginApi(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]]
self.connection = agent_rpc.create_consumers(self.dispatcher,
self.topic,
consumers)
开发者ID:ntoll,项目名称:quantum,代码行数:17,代码来源:ovs_quantum_agent.py
示例9: _setup_rpc
def _setup_rpc(self):
self.agent_id = "hyperv_%s" % platform.node()
self.topic = topics.AGENT
self.plugin_rpc = agent_rpc.PluginApi(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],
[topics.PORT, topics.DELETE],
[constants.TUNNEL, topics.UPDATE],
]
self.connection = agent_rpc.create_consumers(self.dispatcher, self.topic, consumers)
开发者ID:bbrahmbhatt,项目名称:quantum,代码行数:17,代码来源:hyperv_quantum_agent.py
示例10: setup_rpc
def setup_rpc(self, physical_interface):
mac = utils.get_interface_mac(physical_interface)
self.agent_id = "%s%s" % ("lb", (mac.replace(":", "")))
self.topic = topics.AGENT
self.plugin_rpc = PluginApi(topics.PLUGIN)
# RPC network init
self.context = context.RequestContext("quantum", "quantum", is_admin=False)
# Handle updates from service
self.callbacks = LinuxBridgeRpcCallbacks(self.context, self.linux_br)
self.dispatcher = self.callbacks.create_rpc_dispatcher()
# Define the listening consumers for the agent
consumers = [[topics.PORT, topics.UPDATE], [topics.NETWORK, topics.DELETE]]
self.connection = create_consumers(self.dispatcher, self.topic, consumers)
self.udev = pyudev.Context()
monitor = pyudev.Monitor.from_netlink(self.udev)
monitor.filter_by("net")
开发者ID:vbannai,项目名称:quantum,代码行数:17,代码来源:linuxbridge_quantum_agent.py
示例11: 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.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.dispatcher = dispatcher.RpcDispatcher([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.dispatcher, self.topic, consumers)
开发者ID:rosstaylor,项目名称:quantum,代码行数:19,代码来源:nec_quantum_agent.py
示例12: _setup_rpc
def _setup_rpc(self):
self.agent_id = 'mlnx-agent.%s' % socket.gethostname()
self.topic = topics.AGENT
self.plugin_rpc = agent_rpc.PluginApi(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.eswitch)
self.dispatcher = self.callbacks.create_rpc_dispatcher()
# Define the listening consumers for the agent
consumers = [[topics.PORT, topics.UPDATE],
[topics.NETWORK, topics.DELETE]]
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:Apsu,项目名称:quantum,代码行数:21,代码来源:eswitch_quantum_agent.py
示例13: setup_rpc
def setup_rpc(self, integ_br):
mac = utils.get_interface_mac(integ_br)
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]]
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:wdec,项目名称:quantum,代码行数:23,代码来源:ovs_quantum_agent.py
注:本文中的quantum.agent.rpc.create_consumers函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论