def update_rtfilters(self):
        """Updates RT filters for each peer.

        Should be called if a new RT Nlri's have changed based on the setting.
        Currently only used by `Processor` to update the RT filters after it
        has processed a RT destination. If RT filter has changed for a peer we
        call RT filter change handler.
        """
        # Update RT filter for all peers
        # TODO(PH): Check if getting this map can be optimized (if expensive)
        new_peer_to_rtfilter_map = self._compute_rtfilter_map()

        # If we have new best path for RT NLRI, we have to update peer RT
        # filters and take appropriate action of sending them NLRIs for other
        # address-families as per new RT filter if necessary.
        for peer in self._peer_manager.iterpeers:
            pre_rt_filter = self._rt_mgr.peer_to_rtfilter_map.get(peer, set())
            curr_rt_filter = new_peer_to_rtfilter_map.get(peer, set())

            old_rts = pre_rt_filter - curr_rt_filter
            new_rts = curr_rt_filter - pre_rt_filter
            # If interested RTs for a peer changes
            if new_rts or old_rts:
                LOG.debug('RT Filter for peer %s updated: '
                          'Added RTs %s, Removed Rts %s',
                          peer.ip_address, new_rts, old_rts)
                self._on_update_rt_filter(peer, new_rts, old_rts)
                # Update to new RT filters
        self._peer_manager.set_peer_to_rtfilter_map(new_peer_to_rtfilter_map)
        self._rt_mgr.peer_to_rtfilter_map = new_peer_to_rtfilter_map
        LOG.debug('Updated RT filters: %s', self._rt_mgr.peer_to_rtfilter_map)
        # Update interested RTs i.e. RTs on the path that will be installed
        # into global tables
        self._rt_mgr.update_interested_rts()
def update_rtfilters ( self ) : new_peer_to_rtfilter_map = self . _compute_rtfilter_map ( ) for peer in self . _peer_manager . iterpeers : pre_rt_filter = self . _rt_mgr . peer_to_rtfilter_map . get ( peer , set ( ) ) curr_rt_filter = new_peer_to_rtfilter_map . get ( peer , set ( ) ) old_rts = pre_rt_filter - curr_rt_filter new_rts = curr_rt_filter - pre_rt_filter if new_rts or old_rts : LOG . debug ( 'RT Filter for peer %s updated: ' 'Added RTs %s, Removed Rts %s' , peer . ip_address , new_rts , old_rts ) self . _on_update_rt_filter ( peer , new_rts , old_rts ) self . _peer_manager . set_peer_to_rtfilter_map ( new_peer_to_rtfilter_map ) self . _rt_mgr . peer_to_rtfilter_map = new_peer_to_rtfilter_map LOG . debug ( 'Updated RT filters: %s' , self . _rt_mgr . peer_to_rtfilter_map ) self . _rt_mgr . update_interested_rts ( )
Updates RT filters for each peer.

        Should be called if a new RT Nlri's have changed based on the setting.
        Currently only used by `Processor` to update the RT filters after it
        has processed a RT destination. If RT filter has changed for a peer we
        call RT filter change handler.