Application peer doesnt announce routes.
Fix by add Internal Role group to Exporgroup.
Also filter routes by peer destination role, to
avoid unnecessary do remove to a non-existing
route.
Change-Id: I3619b93d6d511bd6b4ef353b8a2f62a9b4a9b661
Signed-off-by: Claudio D. Gasparini <cgaspari@cisco.com>
final DOMDataWriteTransaction tx) {
final boolean destPeerSupAddPath = peerPT.isAddPathSupportedByPeer(destPeer);
if(this.bestPath != null) {
- this.bestPath.stream().filter(path -> filterRoutes(path.getPeerId(), destPeer, peerPT, localTK, discPeers) &&
+ final PeerRole destPeerRole = getRoutePeerIdRole(peerPT, destPeer);
+ this.bestPath.stream().filter(path -> filterRoutes(path.getPeerId(), destPeer, peerPT, localTK, discPeers, destPeerRole) &&
peersSupportsAddPathOrIsFirstBestPath(destPeerSupAddPath, isFirstBestPath(this.bestPath.indexOf(path))))
.forEach(path -> writeRoutePath(destPeer, routeId, peerPT, peerGroup, destPeerSupAddPath, path, rootPath, localTK, ribSup, tx));
}
for (final PeerRole role : PeerRole.values()) {
final PeerExportGroup peerGroup = peerPT.getPeerGroup(role);
if (peerGroup != null) {
- final ContainerNode effectiveAttributes = peerGroup.effectiveAttributes(getRoutePeerIdRole(peerPT, routePeerId), attributes);
+ final PeerRole destPeerRole = getRoutePeerIdRole(peerPT, routePeerId);
+ final ContainerNode effectiveAttributes = peerGroup.effectiveAttributes(destPeerRole, attributes);
for (final Map.Entry<PeerId, PeerExporTuple> pid : peerGroup.getPeers()) {
final PeerId destPeer = pid.getKey();
final boolean destPeerSupAddPath = peerPT.isAddPathSupportedByPeer(destPeer);
- if (filterRoutes(routePeerId, destPeer, peerPT, localTK, discPeers) && peersSupportsAddPathOrIsFirstBestPath(destPeerSupAddPath, isFirstBestPath)) {
+ if (filterRoutes(routePeerId, destPeer, peerPT, localTK, discPeers, destPeerRole) && peersSupportsAddPathOrIsFirstBestPath(destPeerSupAddPath, isFirstBestPath)) {
if (destPeerSupAddPath) {
update(destPeer, getAdjRibOutYII(ribSup, pid.getValue().getYii(), routeIdAddPath, localTK), effectiveAttributes,
addPathValue,
import com.google.common.annotations.VisibleForTesting;
import com.google.common.primitives.UnsignedInteger;
-import java.util.Optional;
import javax.annotation.concurrent.NotThreadSafe;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
final DOMDataWriteTransaction tx) {
if (this.bestPath != null) {
final BaseBestPath path = this.bestPath;
- if (filterRoutes(path.getPeerId(), destPeer, peerPT, localTK, discPeers)) {
+ final PeerRole destPeerRole = getRoutePeerIdRole(peerPT, destPeer);
+ if (filterRoutes(path.getPeerId(), destPeer, peerPT, localTK, discPeers, destPeerRole)) {
final ContainerNode effAttrib = peerGroup.effectiveAttributes(getRoutePeerIdRole(peerPT,path.getPeerId()), path.getAttributes());
writeRoute(destPeer, getAdjRibOutYII(ribSup, rootPath, routeId, localTK), effAttrib, createValue(routeId, path), ribSup, tx);
}
for (final PeerRole role : PeerRole.values()) {
final PeerExportGroup peerGroup = peerPT.getPeerGroup(role);
if (peerGroup != null) {
- final ContainerNode effAttrib = peerGroup.effectiveAttributes(getRoutePeerIdRole(peerPT,routePeerId), attributes);
+ final PeerRole destPeerRole = getRoutePeerIdRole(peerPT, routePeerId);
+ final ContainerNode effAttrib = peerGroup.effectiveAttributes(destPeerRole, attributes);
peerGroup.getPeers().stream()
- .filter(pid -> filterRoutes(routePeerId, pid.getKey(), peerPT, localTK, discPeers))
+ .filter(pid -> filterRoutes(routePeerId, pid.getKey(), peerPT, localTK, discPeers, destPeerRole))
.forEach(pid -> update(pid.getKey(), getAdjRibOutYII(ribSup, pid.getValue().getYii(), routeId, localTK), effAttrib, value, ribSup, tx));
}
}
}
protected final boolean filterRoutes(final PeerId rootPeer, final PeerId destPeer, final ExportPolicyPeerTracker peerPT,
- final TablesKey localTK, final CacheDisconnectedPeers discPeers) {
- return !rootPeer.equals(destPeer) && isTableSupported(destPeer, peerPT, localTK) && !discPeers.isPeerDisconnected(destPeer);
+ final TablesKey localTK, final CacheDisconnectedPeers discPeers, final PeerRole destPeerRole) {
+ return !rootPeer.equals(destPeer) && isTableSupported(destPeer, peerPT, localTK) && !discPeers.isPeerDisconnected(destPeer) &&
+ !PeerRole.Internal.equals(destPeerRole);
}
private boolean isTableSupported(final PeerId destPeer, final ExportPolicyPeerTracker peerPT, final TablesKey localTK) {
.collect(Collectors.groupingBy(Map.Entry::getValue, toMap(peer -> IdentifierUtils.peerKeyToPeerId(peer
.getKey()), peer -> new PeerExporTuple(peer.getKey(), peer.getValue()))));
- final Map<PeerRole, PeerExportGroup> ret = peerPathRoles.values().stream().collect(Collectors.toSet()).stream().filter(role -> role != PeerRole.Internal)
+ final Map<PeerRole, PeerExportGroup> ret = peerPathRoles.values().stream().collect(Collectors.toSet()).stream()
.collect(toMap(identity(), role -> new PeerExportGroupImpl(ImmutableMap.copyOf(immutablePeers.get(role)),
this.policyDatabase.exportPolicyForRole(role)), (oldKey, newKey) -> oldKey, () -> new EnumMap<>(PeerRole.class)));