def start_rpc_listeners(self, host, conf):
        self.endpoints = [self]

        self.conn = n_rpc.Connection()
        self.conn.create_consumer(
            fwaas_constants.FW_AGENT, self.endpoints, fanout=False)
        return self.conn.consume_in_threads()
Ejemplo n.º 2
0
 def start_rpc_listeners(self):
     # RPC support
     self.topic = topics.L3PLUGIN
     self.conn = n_rpc.Connection()
     self.endpoints = [l3_rpc.L3RpcCallback()]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 3
0
def create_consumers(endpoints, prefix, topic_details, start_listening=True):
    """Create agent RPC consumers.

    :param endpoints: The list of endpoints 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.
    :param start_listening: if True, it starts the processing loop

    :returns: A common Connection.
    """

    connection = lib_rpc.Connection()
    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, endpoints, fanout=True)
        if node_name:
            node_topic_name = '%s.%s' % (topic_name, node_name)
            connection.create_consumer(node_topic_name,
                                       endpoints,
                                       fanout=False)
    if start_listening:
        connection.consume_in_threads()
    return connection
Ejemplo n.º 4
0
 def start_rpc_listeners(self):
     """Start the RPC loop to let the plugin communicate with agents."""
     self.conn = rpc.Connection()
     self.conn.create_consumer(nsxv3_constants.NSXV3_SERVER_RPC_TOPIC,
                               [nsxv3_rpc.NSXv3ServerRpcCallback()],
                               fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 5
0
 def __init__(self):
     # Used to provide trunk lookups for the agent.
     registry.provide(trunk_by_port_provider, resources.TRUNK)
     self._connection = n_rpc.Connection()
     self._connection.create_consumer(constants.TRUNK_BASE_TOPIC, [self],
                                      fanout=False)
     self._connection.consume_in_threads()
Ejemplo n.º 6
0
 def start_rpc_listeners(self):
     self.endpoints = [metering_rpc.MeteringRpcCallbacks(self)]
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(topics.METERING_PLUGIN,
                               self.endpoints,
                               fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 7
0
 def start_rpc_listener(self):
     self.endpoints = [FirewallAgentCallbacks(self.firewall_db)]
     self.rpc_connection = n_rpc.Connection()
     self.rpc_connection.create_consumer(constants.FIREWALL_PLUGIN,
                                         self.endpoints,
                                         fanout=False)
     return self.rpc_connection.consume_in_threads()
Ejemplo n.º 8
0
 def _register_rpc_consumers(self):
     registry.register(self._handle_notification, resources.NDPPROXY)
     self._connection = n_rpc.Connection()
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     topic = resources_rpc.resource_type_versioned_topic(
         resources.NDPPROXY)
     self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Ejemplo n.º 9
0
 def start_rpc_listeners(self):
     self.topic = topics.L3PLUGIN
     self.conn = n_rpc.Connection()
     self.agent_notifiers.update(
         {const.AGENT_TYPE_L3: l3_rpc_agent_api.L3AgentNotifyAPI()})
     self.endpoints = [l3_rpc.L3RpcCallback()]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 10
0
 def _init_rpc_listeners(self):
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     self._connection = n_rpc.Connection()
     for rtype in self.rcache.resource_types:
         registry_rpc.register(self.resource_change_handler, rtype)
         topic = resources_rpc.resource_type_versioned_topic(rtype)
         self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Ejemplo n.º 11
0
    def start_rpc_listeners(self):
        self.endpoints = [FirewallCallbacks(self)]

        self.conn = n_rpc.Connection()
        self.conn.create_consumer(f_const.FIREWALL_PLUGIN,
                                  self.endpoints,
                                  fanout=False)
        return self.conn.consume_in_threads()
Ejemplo n.º 12
0
 def start_rpc_listeners(self):
     LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
              log_utils.get_fname(2))
     # RPC support
     self.topic = topics.L3PLUGIN
     self.conn = n_rpc.Connection()
     self.endpoints = [l3_rpc.L3RpcCallback()]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 13
0
 def create_rpc_conn(self):
     self.endpoints = [base_ipsec.IPsecVpnDriverCallBack(self)]
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(topics.IPSEC_DRIVER_TOPIC,
                               self.endpoints,
                               fanout=False)
     self.conn.consume_in_threads()
     self.agent_rpc = base_ipsec.IPsecVpnAgentApi(topics.IPSEC_AGENT_TOPIC,
                                                  BASE_IPSEC_VERSION, self)
Ejemplo n.º 14
0
    def _taas_rpc_setup(self):
        # setup RPC to msg taas plugin
        self.taas_plugin_rpc = TaasPluginApi(topics.TAAS_PLUGIN,
                                             self.conf.host)

        endpoints = [self]
        conn = n_rpc.Connection()
        conn.create_consumer(topics.TAAS_AGENT, endpoints, fanout=False)
        conn.consume_in_threads()
 def _setup_rpc(self):
     self.topic = bgp_consts.BGP_PLUGIN
     self.conn = n_rpc.Connection()
     self.agent_notifiers[bgp_consts.AGENT_TYPE_BGP_ROUTING] = (
         bgp_dr_rpc_agent_api.BgpDrAgentNotifyApi())
     self._bgp_rpc = self.agent_notifiers[bgp_consts.AGENT_TYPE_BGP_ROUTING]
     self.endpoints = [bs_rpc.BgpSpeakerRpcCallback()]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     self.conn.consume_in_threads()
Ejemplo n.º 16
0
 def create_rpc_conn(self):
     self.endpoints = [base_ipsec.IPsecVpnDriverCallBack(self)]
     self.conn = n_rpc.Connection()
     self.conn.create_consumer('dummy_ipsec_driver',
                               self.endpoints,
                               fanout=False)
     self.conn.consume_in_threads()
     self.agent_rpc = base_ipsec.IPsecVpnAgentApi('dummy_ipsec_agent',
                                                  BASE_IPSEC_VERSION, self)
Ejemplo n.º 17
0
    def _register_rpc_consumers(self):
        LOG.info('%s(): caller(): %s', log_utils.get_fname(1), log_utils.get_fname(2))
        registry.register(self._handle_notification, resources.QOS_POLICY)

        self._connection = n_rpc.Connection()
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic = resources_rpc.resource_type_versioned_topic(
            resources.QOS_POLICY)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        self._connection.consume_in_threads()
Ejemplo n.º 18
0
    def start_rpc_listeners(self):
        # other agent based plugin driver might already set callbacks on plugin
        if hasattr(self.plugin, 'agent_callbacks'):
            return

        self.conn = n_rpc.Connection()
        self.conn.create_consumer(lb_const.LOADBALANCER_PLUGINV2,
                                  self.agent_endpoints,
                                  fanout=False)
        return self.conn.consume_in_threads()
Ejemplo n.º 19
0
 def _init_rpc_listeners(self):
     LOG.info('%s(): caller(): %s', log_utils.get_fname(1),
              log_utils.get_fname(2))
     endpoints = [resources_rpc.ResourcesPushRpcCallback()]
     self._connection = n_rpc.Connection()
     for rtype in self.rcache.resource_types:
         registry_rpc.register(self.resource_change_handler, rtype)
         topic = resources_rpc.resource_type_versioned_topic(rtype)
         self._connection.create_consumer(topic, endpoints, fanout=True)
     self._connection.consume_in_threads()
Ejemplo n.º 20
0
    def __init__(self):
        registry.register(self.handle_trunks, resources.TRUNK)
        registry.register(self.handle_subports, resources.SUBPORT)

        self._connection = n_rpc.Connection()
        endpoints = [resources_rpc.ResourcesPushRpcCallback()]
        topic = resources_rpc.resource_type_versioned_topic(resources.SUBPORT)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        topic = resources_rpc.resource_type_versioned_topic(resources.TRUNK)
        self._connection.create_consumer(topic, endpoints, fanout=True)
        self._connection.consume_in_threads()
 def _start_rpc_listeners(self):
     self.notifier = ovsvapp_rpc.OVSvAppAgentNotifyAPI(topics.AGENT)
     self.ovsvapp_sg_server_rpc = (
         ovsvapp_rpc.OVSvAppSecurityGroupServerRpcMixin())
     self.endpoints = [
         ovsvapp_rpc.OVSvAppServerRpcCallback(self.notifier,
                                              self.ovsvapp_sg_server_rpc),
         ovsvapp_rpc.OVSvAppSecurityGroupServerRpcCallback(
             self.ovsvapp_sg_server_rpc)
     ]
     self.topic = ovsvapp_const.OVSVAPP
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 22
0
    def __init__(self, service_plugin):
        LOG.debug("Loading TaasRpcDriver.")
        super(TaasRpcDriver, self).__init__(service_plugin)
        self.endpoints = [TaasCallbacks(self, service_plugin)]
        self.conn = n_rpc.Connection()
        self.conn.create_consumer(topics.TAAS_PLUGIN,
                                  self.endpoints, fanout=False)

        self.conn.consume_in_threads()

        self.agent_rpc = taas_agent_api.TaasAgentApi(
            topics.TAAS_AGENT,
            cfg.CONF.host
        )

        return
Ejemplo n.º 23
0
 def _setup_rpc_dhcp_metadata(self, notifier=None):
     self.topic = topics.PLUGIN
     self.conn = n_rpc.Connection()
     self.endpoints = [SynchronizedDhcpRpcCallback(),
                       agents_db.AgentExtRpcCallback(),
                       metadata_rpc.MetadataRpcCallback()]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     self.conn.create_consumer(topics.REPORTS,
                               [agents_db.AgentExtRpcCallback()],
                               fanout=False)
     self.agent_notifiers[const.AGENT_TYPE_DHCP] = (
         notifier or dhcp_rpc_agent_api.DhcpAgentNotifyAPI())
     self.conn.consume_in_threads()
     self.network_scheduler = importutils.import_object(
         cfg.CONF.network_scheduler_driver
     )
     self.supported_extension_aliases.extend(
         ['agent', 'dhcp_agent_scheduler'])
Ejemplo n.º 24
0
    def __init__(self, vpn_service, host):
        # TODO(pc_m) Replace vpn_service with config arg, once all driver
        # implementations no longer need vpn_service.
        self.conf = vpn_service.conf
        self.host = host
        self.conn = n_rpc.Connection()
        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.routers = {}
        self.process_status_cache = {}

        self.endpoints = [self]
        self.conn.create_consumer(node_topic, self.endpoints, fanout=False)
        self.conn.consume_in_threads()
        self.agent_rpc = IPsecVpnDriverApi(topics.IPSEC_DRIVER_TOPIC)
        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)
Ejemplo n.º 25
0
 def start_rpc_listeners(self):
     self.conn = n_rpc.Connection()
     endpoints = [self]
     self.conn.create_consumer(consts.FW_AGENT, endpoints, fanout=False)
     return self.conn.consume_in_threads()
Ejemplo n.º 26
0
 def setUp(self):
     super(TestConnection, self).setUp()
     self.conn = rpc.Connection()
Ejemplo n.º 27
0
 def __init__(self):
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(log_const.LOGGING_PLUGIN, [self],
                               fanout=False)