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()
    def __init__(self, vpn_service, host):
        super(VyattaIPSecDriver, self).__init__(vpn_service, host)
        self.vpn_service = vpn_service
        self.host = host

        # register RPC endpoint
        conn = n_rpc.Connection()
        node_topic = '%s.%s' % (topics.BROCADE_IPSEC_AGENT_TOPIC, self.host)

        endpoints = [self.rpc_endpoint_factory(self)]
        conn.create_consumer(node_topic, endpoints, fanout=False)
        conn.consume_in_threads()

        # initialize agent to server RPC link
        self.server_api = NeutronServerAPI(topics.BROCADE_IPSEC_DRIVER_TOPIC)

        # initialize VPN service cache (to keep service state)
        self._svc_cache = list()
        self._router_resources_cache = dict()

        # setup periodic task. All periodic task require fully configured
        # device driver. It will be called asynchronously, and soon, so it
        # should be last, when all configuration is done.
        self._periodic_tasks = periodic = _VyattaPeriodicTasks(self)
        loop = loopingcall.DynamicLoopingCall(periodic)
        loop.start(initial_delay=5)
    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()
Exemple #4
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 = n_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
Exemple #5
0
 def start_rpc_listener(self):
     self.endpoints = [FirewallAgentCallbacks(self.firewall_db)]
     self.rpc_connection = neutron_rpc.Connection()
     self.rpc_connection.create_consumer(constants.FIREWALL_PLUGIN,
                                         self.endpoints,
                                         fanout=False)
     return self.rpc_connection.consume_in_threads()
Exemple #6
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()
Exemple #7
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()
Exemple #8
0
 def create_rpc_conn(self):
     self.endpoints = [CiscoCsrIPsecVpnDriverCallBack(self)]
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(
         topics.CISCO_IPSEC_DRIVER_TOPIC, self.endpoints, fanout=False)
     self.conn.consume_in_threads()
     self.agent_rpc = CiscoCsrIPsecVpnAgentApi(
         topics.CISCO_IPSEC_AGENT_TOPIC, BASE_IPSEC_VERSION, self)
Exemple #9
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()
Exemple #10
0
    def start_rpc_listeners(self, 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()
Exemple #11
0
 def setup_rpc(self):
     self.topic = topics.L3PLUGIN
     self.conn = n_rpc.Connection()
     self.agent_notifiers.update(
         {q_const.AGENT_TYPE_L3: l3_rpc_agent_api.L3AgentNotifyAPI()})
     self.endpoints = [l3_rpc.L3RpcCallback()]
     self.conn.create_consumer(self.topic, self.endpoints, fanout=False)
     self.conn.consume_in_threads()
Exemple #12
0
    def _register_rpc_consumers(self):
        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()
    def _taas_rpc_setup(self):
        # setup RPC to msg taas plugin
        self.taas_plugin_rpc = TaasOvsPluginApi(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 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()
Exemple #15
0
 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()
Exemple #16
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()
Exemple #17
0
    def __init__(self, service_plugin):
        LOG.debug("Loading TaasRpcDriver.")
        super(TaasRpcDriver, self).__init__(service_plugin)
        self.endpoints = [taas_agent_api.TaasCallbacks(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
Exemple #18
0
    def _start_rpc_listeners(self):
        conn = n_rpc.Connection()

        # Opflex RPC handler.
        self._opflex_endpoint = o_rpc.GBPServerRpcCallback(self, self.notifier)
        conn.create_consumer(o_rpc.TOPIC_OPFLEX, [self._opflex_endpoint],
                             fanout=False)

        # Topology RPC hander.
        self._topology_endpoint = TopologyRpcEndpoint(self)
        conn.create_consumer(oa_rpc.TOPIC_APIC_SERVICE,
                             [self._topology_endpoint],
                             fanout=False)

        # Start listeners and return list of servers.
        return conn.consume_in_threads()
Exemple #19
0
 def __init__(self, service_plugin, validator=None):
     super(L2gwRpcDriver, self).__init__(service_plugin, validator)
     self.ovsdb_callback = importutils.import_object(L2GW_CALLBACK, self)
     self.endpoints = ([
         self.ovsdb_callback,
         agents_db.AgentExtRpcCallback()
     ])
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(topics.L2GATEWAY_PLUGIN,
                               self.endpoints,
                               fanout=False)
     self.conn.consume_in_threads()
     self.create_rpc_conn()
     LOG.debug("starting l2gateway agent scheduler")
     self.start_l2gateway_agent_scheduler()
     self.gateway_resource = constants.GATEWAY_RESOURCE_NAME
     self.l2gateway_db = l2_gw_db.L2GatewayMixin()
     self.type_manager = managers.TypeManager()
     self.port_dict_before_update = []
Exemple #20
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'])
Exemple #21
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)
Exemple #22
0
 def setUp(self):
     super(TestConnection, self).setUp()
     self.conn = rpc.Connection()
Exemple #23
0
 def __init__(self):
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(log_const.LOGGING_PLUGIN, [self],
                               fanout=False)
 def start_rpc_listeners(self, conf):
     self.endpoints = [self]
     self.conn = n_rpc.Connection()
     self.conn.create_consumer('ecmp_agent', self.endpoints, fanout=False)
     return self.conn.consume_in_threads()
 def start_rpc_listeners(self):
     self.endpoints = [self]
     self.conn = n_rpc.Connection()
     self.conn.create_consumer(ECMP_PLUGIN, self.endpoints, fanout=False)
     return self.conn.consume_in_threads()
Exemple #26
0
 def _start_rpc_listeners(self):
     conn = n_rpc.Connection()
     conn.create_consumer('q-test-topic', [])
     return conn.consume_in_threads()