def _stop(self): # cleanup BGP subscriptions for rt in self.importRTs: self._unsubscribe(self.afi, self.safi, rt) self.dataplane.cleanup() self.labelAllocator.release(self.instanceLabel) # this makes sure that the thread will be stopped, and any remaining # routes/subscriptions are released: TrackerWorker.stop(self)