def __init__(self, socket, signal_bus, is_reactive_conn=False): # Validate input. if socket is None: raise ValueError('Invalid arguments passed.') self._remotename = self.get_remotename(socket) self._localname = self.get_localname(socket) activity_name = ('BgpProtocol %s, %s, %s' % (is_reactive_conn, self._remotename, self._localname)) Activity.__init__(self, name=activity_name) # Intialize instance variables. self._peer = None self._recv_buff = '' self._socket = socket self._socket.setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) self._sendlock = semaphore.Semaphore() self._signal_bus = signal_bus self._holdtime = None self._keepalive = None self._expiry = None # Add socket to Activity's socket container for managing it. if is_reactive_conn: self._asso_socket_map['passive_conn'] = self._socket else: self._asso_socket_map['active_conn'] = self._socket self._open_msg = None self.state = BGP_FSM_CONNECT self._is_reactive = is_reactive_conn self.sent_open_msg = None self.recv_open_msg = None self._is_bound = False
def __init__(self): FlexinetPeer.__init__(self) Activity.__init__(self, name='NETWORK_CONTROLLER') # Outstanding requests, i.e. requests for which we are yet to receive # response from peer. We currently do not have any requests going out. self._outstanding_reqs = {} self._rpc_session = None
def __init__(self, socket, signal_bus, is_reactive_conn=False): # Validate input. if socket is None: raise ValueError("Invalid arguments passed.") activity_name = "BgpProtocol %s, %s, %s" % (is_reactive_conn, socket.getpeername(), socket.getsockname()) Activity.__init__(self, name=activity_name) # Intialize instance variables. self._peer = None self._recv_buff = "" self._socket = socket self._signal_bus = signal_bus self._holdtime = None self._keepalive = None self._expiry = None # Add socket to Activity's socket container for managing it. if is_reactive_conn: self._asso_socket_map["passive_conn"] = self._socket else: self._asso_socket_map["active_conn"] = self._socket self._open_msg = None self.state = BGP_FSM_CONNECT self._is_reactive = is_reactive_conn self.sent_open_msg = None self.recv_open_msg = None self._is_bound = False
def __init__(self, core_service, work_units_per_cycle=None): Activity.__init__(self) # Back pointer to core service instance that created this processor. self._core_service = core_service self._dest_queue = BgpProcessor._DestQueue() self._rtdest_queue = BgpProcessor._DestQueue() self.dest_que_evt = EventletIOFactory.create_custom_event() self.work_units_per_cycle = work_units_per_cycle or BgpProcessor.MAX_DEST_PROCESSED_PER_CYCLE
def __init__(self, core_service, work_units_per_cycle=None): Activity.__init__(self) # Back pointer to core service instance that created this processor. self._core_service = core_service self._dest_queue = BgpProcessor._DestQueue() self._rtdest_queue = BgpProcessor._DestQueue() self.dest_que_evt = EventletIOFactory.create_custom_event() self.work_units_per_cycle =\ work_units_per_cycle or BgpProcessor.MAX_DEST_PROCESSED_PER_CYCLE
def __init__(self, common_conf, neighbors_conf, vrfs_conf): self._common_config = common_conf self._neighbors_conf = neighbors_conf self._vrfs_conf = vrfs_conf Activity.__init__(self, name='core_service') self._signal_bus = BgpSignalBus() self._init_signal_listeners() self._rt_mgr = RouteTargetManager(self, neighbors_conf, vrfs_conf) self._table_manager = core_managers.TableCoreManager( self, common_conf ) self._importmap_manager = core_managers.ImportMapManager() # Autonomous system number of this BGP speaker. self._asn = self._common_config.local_as self._peer_manager = core_managers.PeerManager( self, self._neighbors_conf, ) # Initialize sink for flexinet-peers self._sinks = set() self._conf_manager = core_managers.ConfigurationManager( self, common_conf, vrfs_conf, neighbors_conf ) # Register Flexinet peer sink from ryu.services.protocols.bgp.net_ctrl import NET_CONTROLLER self.register_flexinet_sink(NET_CONTROLLER) # State per route family # Key: RouteFamily # Value: BgpInstanceRf self.rf_state = {} # Protocol factories for pro-active and re-active bgp-sessions. self.client_factory = None self.server_factory = None # Key: RD:Next_Hop # Value: label self._next_hop_label = {} # BgpProcessor instance (initialized during start) self._bgp_processor = None # BMP clients key: (host, port) value: BMPClient instance self.bmpclients = {}
def stop(self): Activity.stop(self)