Fixed SupportedTables map. 23/24623/1
authorDana Kutenicsova <dkutenic@cisco.com>
Thu, 30 Jul 2015 10:39:44 +0000 (12:39 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Thu, 30 Jul 2015 10:39:44 +0000 (12:39 +0200)
We were putting a different NodeIdentifierWithPredicates
to supported tables map, than we were getting.

Change-Id: I4b5264448a833620af9e019c4f49561e6b34d1f1
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ExportPolicyPeerTracker.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/LocRibWriter.java

index 15aa8a77dce804b6b4410e0b763a5455958b15f0..f23eb20f4c62b2f3291a7ecbe3c483b53e4e1611 100644 (file)
@@ -22,8 +22,10 @@ import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import org.opendaylight.protocol.bgp.rib.spi.RibSupportUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.PeerRole;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.bgp.rib.rib.peer.SupportedTables;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -119,6 +121,6 @@ final class ExportPolicyPeerTracker extends AbstractPeerRoleTracker {
     }
 
     boolean isTableSupported(final PeerId peerId, final TablesKey tablesKey) {
-        return this.peerTables.get(peerId).contains(tablesKey);
+        return this.peerTables.get(peerId).contains(RibSupportUtils.toYangKey(SupportedTables.QNAME, tablesKey));
     }
 }
\ No newline at end of file
index be209349e7fad367be4e201831717b662afa15a0..0c208f3b1ba45cbd4facc4155600693a9459bf15 100644 (file)
@@ -258,12 +258,12 @@ final class LocRibWriter implements AutoCloseable, DOMDataTreeChangeListener {
             if (peerGroup != null) {
                 final ContainerNode attributes = entry == null ? null : entry.attributes();
                 final PeerId peerId = key.getPeerId();
-                if (!this.peerPolicyTracker.isTableSupported(peerId, this.localTablesKey)) {
-                    LOG.trace("Route rejected, peer {} does not support this table type {}", peerId, this.tableKey);
-                    continue;
-                }
                 final ContainerNode effectiveAttributes = peerGroup.effectiveAttributes(peerId, attributes);
                 for (final Entry<PeerId, YangInstanceIdentifier> pid : peerGroup.getPeers()) {
+                    if (!this.peerPolicyTracker.isTableSupported(pid.getKey(), this.localTablesKey)) {
+                        LOG.trace("Route rejected, peer {} does not support this table type {}", pid.getKey(), this.localTablesKey);
+                        continue;
+                    }
                     final YangInstanceIdentifier routeTarget = this.ribSupport.routePath(pid.getValue().node(AdjRibOut.QNAME).node(Tables.QNAME).node(this.tableKey).node(ROUTES_IDENTIFIER), key.getRouteId());
                     if (effectiveAttributes != null && value != null && !peerId.equals(pid.getKey())) {
                         LOG.debug("Write route {} to peers AdjRibsOut {}", value, pid.getKey());