private static final TablesKey IPV4_UCAST_TABLE_KEY = new TablesKey(Ipv4AddressFamily.class,
UnicastSubsequentAddressFamily.class);
- private Set<TablesKey> tables = Collections.emptySet();
+ private ImmutableSet<TablesKey> tables = ImmutableSet.of();
+ private ImmutableSet<TablesKey> advertizedTables = ImmutableSet.of();
private final RIB rib;
private final Map<TablesKey, AdjRibOutListener> adjRibOutListenerSet = new HashMap<>();
private final List<RouteTarget> rtMemberships = new ArrayList<>();
createEffRibInWriter();
this.effRibInWriter.init();
registerPrefixesCounters(this.effRibInWriter, this.effRibInWriter);
- for (final TablesKey key : this.tables) {
+ for (final TablesKey key : this.advertizedTables) {
createAdjRibOutListener(key, true);
}
setLocalRestartingState(false);
final Set<TablesKey> setTables = advertizedTableTypes.stream().map(t -> new TablesKey(t.getAfi(), t.getSafi()))
.collect(Collectors.toSet());
this.tables = ImmutableSet.copyOf(setTables);
+ this.advertizedTables = ImmutableSet.copyOf(Sets.intersection(tables, getAfiSafisAdvertized()));
+
this.addPathTableMaps = mapTableTypesFamilies(addPathTablesType);
final boolean restartingLocally = isLocalRestarting();
if (!restartingLocally) {
addBgp4Support();
- for (final TablesKey key : this.tables) {
+ for (final TablesKey key : this.advertizedTables) {
createAdjRibOutListener(key, true);
}
}
if (this.effRibInWriter != null) {
this.effRibInWriter.close();
}
- this.tables = Collections.emptySet();
+ this.tables = ImmutableSet.of();
this.addPathTableMaps = Collections.emptyMap();
future = removePeer(this.peerPath);
resetState();
@Override
public boolean supportsTable(final TablesKey tableKey) {
- return this.tables.contains(tableKey) && this.sessionUp;
+ return this.advertizedTables.contains(tableKey) && this.sessionUp;
}
@Override
SendReceive getSupportedAddPathTables(@Nonnull TablesKey tableKey);
/**
- * Returns true if peer supports table.
+ * Returns true if peer supports table and we have advertized support for it, i.e. any prefix from this table should
+ * be subject to export towards the peer.
*
* @param tableKey table
- * @return true if Additional Path is supported for defined table
+ * @return true if the table is supported by the peer and we have advertized support for it.
*/
boolean supportsTable(@Nonnull TablesKey tableKey);