* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.mode.api;
import com.google.common.primitives.UnsignedInteger;
* @return pathId
*/
long getPathId();
-}
\ No newline at end of file
+
+ /**
+ * Return true if this path is depreferenced.
+ *
+ * @return True if this path is depreferenced.
+ */
+ boolean isDepreferenced();
+}
// FIXME: can we use identity check here?
final boolean isFirstBestPath = firstBestPath != null && firstBestPath.equals(path);
final AdvertizedRoute<C, S, R, I> adv = new AdvertizedRoute<>(ribSupport, isFirstBestPath,
- routeAddPath, path.getAttributes(), path.getPeerId());
+ routeAddPath, path.getAttributes(), path.getPeerId(), path.isDepreferenced());
advertized.add(adv);
}
this.newBestPathToBeAdvertised = null;
for (final AddPathBestPath path : this.bestPath) {
final R route = createRoute(ribSupport, entryInfo.getRouteKey(), path.getPathId(), path);
final ActualBestPathRoutes<C, S, R, I> adv = new ActualBestPathRoutes<>(ribSupport, route, path.getPeerId(),
- path.getAttributes());
+ path.getAttributes(), path.isDepreferenced());
preexistentRoutes.add(adv);
}
return preexistentRoutes;
return this.offsets.isEmpty();
}
- private R createRoute(final RIBSupport<C, S, R, I> ribSup, String routeKey, final long pathId,
+ private R createRoute(final RIBSupport<C, S, R, I> ribSup, final String routeKey, final long pathId,
final BaseBestPath path) {
final R route = this.offsets.getValue(this.values, this.offsets.offsetOf(path.getRouterId()));
return ribSup.createRoute(route, routeKey, pathId, path.getAttributes());
}
final R route = createRoute(ribSupport, routeKey, this.bestPath.getPathId(), this.bestPath);
final AdvertizedRoute<C, S, R, I> adv = new AdvertizedRoute<>(ribSupport, route, this.bestPath.getAttributes(),
- this.bestPath.getPeerId());
+ this.bestPath.getPeerId(), this.bestPath.isDepreferenced());
LOG.trace("Selected best route {}", route);
return Collections.singletonList(adv);
}
}
final R route = createRoute(ribSupport, entryInfo.getRouteKey(), this.bestPath.getPathId(), this.bestPath);
return Collections.singletonList(new ActualBestPathRoutes<>(ribSupport, route, this.bestPath.getPeerId(),
- this.bestPath.getAttributes()));
+ this.bestPath.getAttributes(), this.bestPath.isDepreferenced()));
}
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.mode.spi;
import static java.util.Objects.requireNonNull;
return this.state.getAttributes();
}
+ @Override
+ public final boolean isDepreferenced() {
+ return this.state.isDepreferenced();
+ }
+
@Override
public final String toString() {
return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
private final Attributes attributes;
private final I nonAddPathRouteKeyIdentifier;
private final I addPathRouteKeyIdentifier;
+ private final boolean depreferenced;
AbstractAdvertizedRoute(final RIBSupport<C, S, R, I> ribSupport, final R route, final PeerId fromPeerId,
- final Attributes attributes) {
+ final Attributes attributes, final boolean depreferenced) {
this.fromPeerId = fromPeerId;
this.route = route;
this.attributes = attributes;
+ this.depreferenced = depreferenced;
final @NonNull String routeKey = verifyNotNull(route.getRouteKey());
this.nonAddPathRouteKeyIdentifier = ribSupport.createRouteListKey(NON_PATH_ID_VALUE, routeKey);
return attributes;
}
+ public final boolean isDepreferenced() {
+ return depreferenced;
+ }
+
@Override
public final I getNonAddPathRouteKeyIdentifier() {
return this.nonAddPathRouteKeyIdentifier;
I extends Identifier<R>> extends AbstractAdvertizedRoute<C, S, R, I> {
public ActualBestPathRoutes(final RIBSupport<C, S, R, I> ribSupport, final R route, final PeerId fromPeerId,
- final Attributes attributes) {
- super(ribSupport, route, fromPeerId, attributes);
+ final Attributes attributes, final boolean depreferenced) {
+ super(ribSupport, route, fromPeerId, attributes, depreferenced);
}
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.bgp.rib.spi.entry;
import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
private final boolean isFirstBestPath;
public AdvertizedRoute(final RIBSupport<C, S, R, I> ribSupport, final R route, final Attributes attributes,
- final PeerId fromPeerId) {
- this(ribSupport, true, route, attributes, fromPeerId);
+ final PeerId fromPeerId, final boolean depreferenced) {
+ this(ribSupport, true, route, attributes, fromPeerId, depreferenced);
}
public AdvertizedRoute(final RIBSupport<C, S, R, I> ribSupport, final boolean isFirstBestPath,
- final R route, final Attributes attributes, final PeerId fromPeerId) {
- super(ribSupport, route, fromPeerId, attributes);
+ final R route, final Attributes attributes, final PeerId fromPeerId, final boolean depreferenced) {
+ super(ribSupport, route, fromPeerId, attributes, depreferenced);
this.isFirstBestPath = isFirstBestPath;
}