Example #1
0
    def _run(self, *args, **kwargs):
        from ryu.services.protocols.bgp.processor import BgpProcessor
        # Initialize bgp processor.
        self._bgp_processor = BgpProcessor(self)
        # Start BgpProcessor in a separate thread.
        processor_thread = self._spawn_activity(self._bgp_processor)

        # Pro-actively try to establish bgp-session with peers.
        for peer in self._peer_manager.iterpeers:
            self._spawn_activity(peer, self)

        # Reactively establish bgp-session with peer by listening on
        # server port for connection requests.
        server_addr = (CORE_IP, self._common_config.bgp_server_port)
        waiter = kwargs.pop('waiter')
        waiter.set()
        server_thread = self._listen_tcp(server_addr, self.start_protocol)

        server_thread.wait()
        processor_thread.wait()
Example #2
0
    def _run(self, *args, **kwargs):
        from ryu.services.protocols.bgp.processor import BgpProcessor
        # Initialize bgp processor.
        self._bgp_processor = BgpProcessor(self)
        # Start BgpProcessor in a separate thread.
        processor_thread = self._spawn_activity(self._bgp_processor)

        # Pro-actively try to establish bgp-session with peers.
        for peer in self._peer_manager.iterpeers:
            self._spawn_activity(peer, self.start_protocol)

        # Reactively establish bgp-session with peer by listening on
        # the given server hosts and port for connection requests.
        waiter = kwargs.pop('waiter')
        waiter.set()
        self.listen_sockets = {}
        if self._common_config.bgp_server_port != 0:
            for host in self._common_config.bgp_server_hosts:
                server_thread, sockets = self._listen_tcp(
                    (host, self._common_config.bgp_server_port),
                    self.start_protocol)
                self.listen_sockets.update(sockets)
                server_thread.wait()
        processor_thread.wait()