def _setup_rpc(self): self.conn = rpc.create_connection(new=True) self.notifier = AgentNotifierApi(topics.AGENT) self.callbacks = RyuRpcCallbacks(self.ofp_api_host) self.dispatcher = self.callbacks.create_rpc_dispatcher() self.conn.create_consumer(topics.PLUGIN, self.dispatcher, fanout=False) self.conn.consume_in_thread()
def setup_rpc(self): # RPC support for dhcp self.topic = topics.PLUGIN self.conn = rpc.create_connection(new=True) self.dispatcher = NVPRpcCallbacks().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()
def setup_rpc(self): self.topic = topics.PLUGIN self.conn = rpc.create_connection(new=True) self.callbacks = NECPluginV2RPCCallbacks(self) 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()
def setup_rpc(self): # RPC support self.rpc_context = context.RequestContext("quantum", "quantum", is_admin=False) self.conn = rpc.create_connection(new=True) self.dispatcher = dispatcher.RpcDispatcher([self]) self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
def __init__(self): # Set the Queue size to 1 so that messages stay on server rather than # being buffered in the process. self.queue = eventlet.queue.Queue(1) self.connection = rpc.create_connection(new=True) topic = "%s.%s" % (rpc_notifier.CONF.notification_topics[0], api.CONF.default_notification_level.lower()) queue_name = "notification_listener_%s" % uuidutils.generate_uuid() self.connection.declare_topic_consumer(topic=topic, queue_name=queue_name, callback=self._add_to_queue) self.connection.consume_in_thread()
def _setup_rpc(self): # RPC support self.topic = topics.PLUGIN 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() self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
def __init__(self): # Set the Queue size to 1 so that messages stay on server rather than # being buffered in the process. self.queue = eventlet.queue.Queue(1) self.connection = rpc.create_connection(new=True) topic = '%s.%s' % (rabbit_notifier.CONF.notification_topics[0], api.CONF.default_notification_level.lower()) self.connection.declare_topic_consumer(topic=topic, callback=self._add_to_queue) self.connection.consume_in_thread()
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)
def __init__(self, plugin): self.agent_rpc = LoadBalancerAgentApi(TOPIC_LOADBALANCER_AGENT, cfg.CONF.host) 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
def _setup_rpc(self): self.notifier = rpc.AgentNotifierApi(topics.AGENT) self.dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI() self.l3_agent_notifier = l3_rpc_agent_api.L3AgentNotify self.callbacks = rpc.RpcCallbacks(self.notifier) 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()
def setup_rpc(self): # RPC support self.topic = topics.PLUGIN self.rpc_context = context.RequestContext("quantum", "quantum", is_admin=False) self.conn = rpc.create_connection(new=True) self.notifier = AgentNotifierApi(topics.AGENT) self.callbacks = RgosRpcCallbacks(self.rpc_context, 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()
def setup_rpc(self): # RPC support for dhcp self.topic = topics.PLUGIN self.rpc_context = context.RequestContext('quantum', 'quantum', is_admin=False) self.conn = rpc.create_connection(new=True) self.callbacks = NVPRpcCallbacks(self.rpc_context) 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()
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.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()
def setup_rpc(self): # RPC support self.topic = topics.PLUGIN self.rpc_context = context.RequestContext('quantum', 'quantum', is_admin=False) self.conn = rpc.create_connection(new=True) self.notifier = AgentNotifierApi(topics.AGENT) self.callbacks = OVSRpcCallbacks(self.rpc_context, 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()
def __init__(self): """Do the initialization for the loadbalancer service plugin here.""" qdbapi.register_models() self.callbacks = LoadBalancerCallbacks(self) self.conn = rpc.create_connection(new=True) self.conn.create_consumer(topics.LOADBALANCER_PLUGIN, self.callbacks.create_rpc_dispatcher(), fanout=False) self.conn.consume_in_thread() self.agent_rpc = LoadBalancerAgentApi(topics.LOADBALANCER_AGENT, cfg.CONF.host)
def __init__(self, plugin): self.agent_rpc = LoadBalancerAgentApi( TOPIC_LOADBALANCER_AGENT, cfg.CONF.host ) 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
def setup_rpc(self): self.host = get_hostname() self.topic = '%s.%s' % (topics.RELAY_AGENT,self.host) # RPC network init self.context = context.RequestContext('quantum', 'quantum', is_admin=False) # Handle updates from service self.dispatcher = self.create_rpc_dispatcher() # Define the listening consumers for the agent self.conn = rpc.create_connection(new=True) LOG.debug(_('connection is created......creating consumer with topic %s....\n'),self.topic) self.conn.create_consumer(self.topic, self.dispatcher,fanout=False) self.conn.consume_in_thread()
def _setup_rpc(self): # RPC support self.topic = topics.PLUGIN self.rpc_context = context.RequestContext('quantum', 'quantum', is_admin=False) self.conn = rpc.create_connection(new=True) self.callbacks = BridgeRpcCallbacks() 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.dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI() self.l3_agent_notifier = l3_rpc_agent_api.L3AgentNotify
def setup_rpc(self): self.topic = topics.PLUGIN self.conn = rpc.create_connection(new=True) self.notifier = NECPluginV2AgentNotifierApi(topics.AGENT) self.callback_nec = NECPluginV2RPCCallbacks(self) self.callback_dhcp = DhcpRpcCallback() self.callback_l3 = L3RpcCallback() self.callback_sg = SecurityGroupServerRpcCallback() callbacks = [self.callback_nec, self.callback_dhcp, self.callback_l3, self.callback_sg] self.dispatcher = q_rpc.PluginRpcDispatcher(callbacks) self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
def __init__(self): LOG.info(_('QuantumRestProxy: Starting plugin. Version=%s'), version_string_with_vcs()) # init DB, proxy's persistent store defaults to in-memory sql-lite DB options = {"sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection, "sql_max_retries": cfg.CONF.DATABASE.sql_max_retries, "reconnect_interval": cfg.CONF.DATABASE.reconnect_interval, "base": models_v2.model_base.BASEV2, "sql_min_pool_size": cfg.CONF.DATABASE.sql_min_pool_size, "sql_max_pool_size": cfg.CONF.DATABASE.sql_max_pool_size, "sql_idle_timeout": cfg.CONF.DATABASE.sql_idle_timeout, "sql_dbpool_enable": cfg.CONF.DATABASE.sql_dbpool_enable} db.configure_db(options) # 'servers' is the list of network controller REST end-points # (used in order specified till one suceeds, and it is sticky # till next failure). Use 'serverauth' to encode api-key servers = cfg.CONF.RESTPROXY.servers serverauth = cfg.CONF.RESTPROXY.serverauth serverssl = cfg.CONF.RESTPROXY.serverssl syncdata = cfg.CONF.RESTPROXY.syncdata timeout = cfg.CONF.RESTPROXY.servertimeout # validate config assert servers is not None, 'Servers not defined. Aborting plugin' servers = tuple(s.rsplit(':', 1) for s in servers.split(',')) servers = tuple((server, int(port)) for server, port in servers) assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE # init network ctrl connections self.servers = ServerPool(servers, serverssl, serverauth, timeout) # init dhcp support self.topic = topics.PLUGIN 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 syncdata: self._send_all_data() LOG.debug(_("QuantumRestProxyV2: initialization done"))
def __init__(self): LOG.info('QuantumRestProxy: Starting plugin. Version=%s' % version_string_with_vcs()) # init DB, proxy's persistent store defaults to in-memory sql-lite DB options = { "sql_connection": "%s" % cfg.CONF.DATABASE.sql_connection, "sql_max_retries": cfg.CONF.DATABASE.sql_max_retries, "reconnect_interval": cfg.CONF.DATABASE.reconnect_interval, "base": models_v2.model_base.BASEV2 } db.configure_db(options) # 'servers' is the list of network controller REST end-points # (used in order specified till one suceeds, and it is sticky # till next failure). Use 'serverauth' to encode api-key servers = cfg.CONF.RESTPROXY.servers serverauth = cfg.CONF.RESTPROXY.serverauth serverssl = cfg.CONF.RESTPROXY.serverssl syncdata = cfg.CONF.RESTPROXY.syncdata timeout = cfg.CONF.RESTPROXY.servertimeout # validate config assert servers is not None, 'Servers not defined. Aborting plugin' servers = tuple(s.rsplit(':', 1) for s in servers.split(',')) servers = tuple((server, int(port)) for server, port in servers) assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE # init network ctrl connections self.servers = ServerPool(servers, serverssl, serverauth, timeout) # init dhcp support self.topic = topics.PLUGIN self.rpc_context = glbcontext.RequestContext('quantum', 'quantum', is_admin=False) self.conn = rpc.create_connection(new=True) self.callbacks = RpcProxy(self.rpc_context) 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 syncdata: self._send_all_data() LOG.debug("QuantumRestProxyV2: initialization done")
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 and a operation. :returns: A common Connection. """ connection = rpc.create_connection(new=True) for topic, operation in topic_details: topic_name = topics.get_topic_name(prefix, topic, operation) connection.create_consumer(topic_name, dispatcher, fanout=True) connection.consume_in_thread() return connection
def __init__(self): """Do the initialization for the loadbalancer service plugin here.""" qdbapi.register_models() self.callbacks = LoadBalancerCallbacks(self) self.conn = rpc.create_connection(new=True) self.conn.create_consumer( topics.LOADBALANCER_PLUGIN, self.callbacks.create_rpc_dispatcher(), fanout=False) self.conn.consume_in_thread() self.agent_rpc = LoadBalancerAgentApi( topics.LOADBALANCER_AGENT, cfg.CONF.host )
def __init__(self, integ_br, root_helper, polling_interval): """Constructor. :param integ_br: name of the integration bridge. :param root_helper: utility to use when running shell cmds. :param polling_interval: interval (secs) to check the bridge. """ self.int_br = ovs_lib.OVSBridge(integ_br, root_helper) self.polling_interval = polling_interval self.host = socket.gethostname() self.agent_id = "nec-q-agent.%s" % self.host self.datapath_id = "0x%s" % self.int_br.get_datapath_id() # RPC network init self.context = context.RequestContext("quantum", "quantum", is_admin=False) self.conn = rpc.create_connection(new=True)
def setup_rpc(self): self.topic = topics.PLUGIN self.conn = rpc.create_connection(new=True) self.notifier = NECPluginV2AgentNotifierApi(topics.AGENT) self.dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI() self.l3_agent_notifier = l3_rpc_agent_api.L3AgentNotify # NOTE: callback_sg is referred to from the sg unit test. self.callback_sg = SecurityGroupServerRpcCallback() callbacks = [NECPluginV2RPCCallbacks(self), DhcpRpcCallback(), L3RpcCallback(), self.callback_sg, agents_db.AgentExtRpcCallback()] self.dispatcher = q_rpc.PluginRpcDispatcher(callbacks) self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
def __init__(self, integ_br, root_helper, polling_interval): '''Constructor. :param integ_br: name of the integration bridge. :param root_helper: utility to use when running shell cmds. :param polling_interval: interval (secs) to check the bridge. ''' self.int_br = ovs_lib.OVSBridge(integ_br, root_helper) self.polling_interval = polling_interval self.host = socket.gethostname() self.agent_id = 'nec-q-agent.%s' % self.host self.datapath_id = "0x%s" % self.int_br.get_datapath_id() # RPC network init self.context = context.RequestContext('quantum', 'quantum', is_admin=False) self.conn = rpc.create_connection(new=True)
def start(self): super(Service, self).start() self.conn = rpc.create_connection(new=True) LOG.debug( _("Creating Consumer connection for Service %s") % self.topic) rpc_dispatcher = rpc.dispatcher.RpcDispatcher([self.manager]) # Share this same connection for these Consumers self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=False) node_topic = '%s.%s' % (self.topic, self.host) self.conn.create_consumer(node_topic, rpc_dispatcher, fanout=False) self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=True) # Consume from all consumers in a thread self.conn.consume_in_thread()
def setup_rpc(self): self.topic = topics.PLUGIN self.conn = rpc.create_connection(new=True) self.notifier = NECPluginV2AgentNotifierApi(topics.AGENT) self.dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI() self.l3_agent_notifier = l3_rpc_agent_api.L3AgentNotify # NOTE: callback_sg is referred to from the sg unit test. self.callback_sg = SecurityGroupServerRpcCallback() callbacks = [ NECPluginV2RPCCallbacks(self), DhcpRpcCallback(), L3RpcCallback(), self.callback_sg, agents_db.AgentExtRpcCallback() ] self.dispatcher = q_rpc.PluginRpcDispatcher(callbacks) self.conn.create_consumer(self.topic, self.dispatcher, fanout=False) # Consume from all consumers in a thread self.conn.consume_in_thread()
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]) # 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) # Consume from all consumers in a thread self.conn.consume_in_thread()
def __init__(self): """ Do the initialization for the vpn service plugin here. """ #qdbapi.register_models(base=model_base.BASEV2) qdbapi.register_models() self.callbacks = VPNCallbacks(self) self.conn = rpc.create_connection(new=True) self.conn.create_consumer( topics.VPN_PLUGIN, self.callbacks.create_rpc_dispatcher(), fanout=False) self.conn.consume_in_thread() self.agent_rpc = VPNAgentApi( topics.VPN_AGENT, cfg.CONF.host )
def __init__(self): LOG.info(_("QuantumRestProxy: Starting plugin. Version=%s"), version_string_with_vcs()) # init DB, proxy's persistent store defaults to in-memory sql-lite DB db.configure_db() # 'servers' is the list of network controller REST end-points # (used in order specified till one suceeds, and it is sticky # till next failure). Use 'server_auth' to encode api-key servers = cfg.CONF.RESTPROXY.servers server_auth = cfg.CONF.RESTPROXY.server_auth server_ssl = cfg.CONF.RESTPROXY.server_ssl sync_data = cfg.CONF.RESTPROXY.sync_data timeout = cfg.CONF.RESTPROXY.server_timeout quantum_id = cfg.CONF.RESTPROXY.quantum_id self.add_meta_server_route = cfg.CONF.RESTPROXY.add_meta_server_route # validate config assert servers is not None, "Servers not defined. Aborting plugin" servers = tuple(s.rsplit(":", 1) for s in servers.split(",")) servers = tuple((server, int(port)) for server, port in servers) assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE # init network ctrl connections self.servers = ServerPool(servers, server_ssl, server_auth, quantum_id, timeout, BASE_URI) # init dhcp support self.topic = topics.PLUGIN 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 sync_data: self._send_all_data() self._dhcp_agent_notifier = dhcp_rpc_agent_api.DhcpAgentNotifyAPI() LOG.debug(_("QuantumRestProxyV2: initialization done"))
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]) # 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()
def _setup_rpc(self): self.conn = rpc.create_connection(new=True) self.callback = DhcpRpcCallbackMixin() self.dispatcher = dispatcher.RpcDispatcher([self.callback]) self.conn.create_consumer(topics.PLUGIN, self.dispatcher, fanout=False) self.conn.consume_in_thread()
def _setup_rpc(self): topic = topics.LOADBALANCER_PLUGIN self.conn = rpc.create_connection(new=True) self.dispatcher = q_rpc.PluginRpcDispatcher([self]) self.conn.create_consumer(topic, self.dispatcher, fanout=False) self.conn.consume_in_thread()
def _setup_rpc(self): self.conn = rpc.create_connection(new=True) self.callbacks = RyuRpcCallbacks() self.dispatcher = self.callbacks.create_rpc_dispatcher() self.conn.create_consumer(topics.PLUGIN, self.dispatcher, fanout=False) self.conn.consume_in_thread()