Use only our advertized tables to send routes 75/80875/3
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 15 Mar 2019 06:11:49 +0000 (07:11 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 19 Mar 2019 14:36:02 +0000 (15:36 +0100)
Previous fix used intersection of advertizements, which is not
accurate: if the peer accepts our proposal, we should be sending
all advertizements, allowing asymmetric setups to work correctly.

JIRA: BGPCEP862
Change-Id: Ie01f2905d76989093b8914fcd08c7a628fa4686a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/PeerTrackerInformation.java

index 182e3ce656d78c7937a09faf1f9447b7819452fd..4ff97310f4f8d90db5e8c7e16682343034d20df6 100644 (file)
@@ -113,7 +113,6 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
         UnicastSubsequentAddressFamily.class);
 
     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<>();
@@ -340,7 +339,7 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
                 createEffRibInWriter();
                 this.effRibInWriter.init();
                 registerPrefixesCounters(this.effRibInWriter, this.effRibInWriter);
-                for (final TablesKey key : this.advertizedTables) {
+                for (final TablesKey key : getAfiSafisAdvertized()) {
                     createAdjRibOutListener(key, true);
                 }
                 setLocalRestartingState(false);
@@ -373,7 +372,6 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
         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();
@@ -452,7 +450,7 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
 
         if (!restartingLocally) {
             addBgp4Support();
-            for (final TablesKey key : this.advertizedTables) {
+            for (final TablesKey key : getAfiSafisAdvertized()) {
                 createAdjRibOutListener(key, true);
             }
         }
@@ -641,7 +639,7 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
 
     @Override
     public boolean supportsTable(final TablesKey tableKey) {
-        return this.advertizedTables.contains(tableKey) && this.sessionUp;
+        return this.sessionUp && getAfiSafisAdvertized().contains(tableKey);
     }
 
     @Override
index bfdf4485bf01c05f070e1d1583bbb72247506ade..b4afa4e9dd898e41cacb730f1a7e35fa129a6dd2 100644 (file)
@@ -53,11 +53,11 @@ public interface PeerTrackerInformation {
     SendReceive getSupportedAddPathTables(@Nonnull TablesKey tableKey);
 
     /**
-     * Returns true if peer supports table and we have advertized support for it, i.e. any prefix from this table should
+     * Returns true if we have advertized support for a table, i.e. any prefix from this table should
      * be subject to export towards the peer.
      *
      * @param tableKey table
-     * @return true if the table is supported by the peer and we have advertized support for it.
+     * @return true if the table is being advertized to the peer.
      */
     boolean supportsTable(@Nonnull TablesKey tableKey);