def __init__(self, bgpManager, name, peerAddress, config):
        BGPPeerWorker.__init__(self, bgpManager, name, peerAddress)
        self.config = config
        self.localAddress = self.config['local_address']
        self.peerAddress = peerAddress

        self.connection = None

        self.rtc_active = False
        self._activeFamilies = []
    def __init__(self, bgpManager, name, peerAddress, config):
        BGPPeerWorker.__init__(self, bgpManager, name, peerAddress)
        self.config = config
        self.localAddress = self.config['local_address']
        self.peerAddress = peerAddress

        self.connection = None

        self.rtc_active = False
        self._activeFamilies = []
    def _toEstablished(self):
        BGPPeerWorker._toEstablished(self)

        if self.rtc_active:
            # subscribe to RTC routes, to be able to propagate them from
            # internal workers to this peer
            self._subscribe(AFI(AFI.ipv4), SAFI(SAFI.rtc))
        else:
            # if we don't use RTC with our peer, then we need to see events for
            # all routes of all active families, to be able to send them to him
            for (afi, safi) in self._activeFamilies:
                self._subscribe(afi, safi)
    def _toEstablished(self):
        BGPPeerWorker._toEstablished(self)

        if self.rtc_active:
            # subscribe to RTC routes, to be able to propagate them from
            # internal workers to this peer
            self._subscribe(AFI(AFI.ipv4), SAFI(SAFI.rtc))
        else:
            # if we don't use RTC with our peer, then we need to see events for
            # all routes of all active families, to be able to send them to him
            for (afi, safi) in self._activeFamilies:
                self._subscribe(afi, safi)
 def stop(self):
     if self.connection is not None:
         self.connection.close()
     BGPPeerWorker.stop(self)
 def stop(self):
     if self.connection is not None:
         self.connection.close()
     BGPPeerWorker.stop(self)