<groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
<artifactId>rfc6991-ietf-inet-types</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>concepts</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>yang-binding</artifactId>
* @param remotePathId remote path Id received
* @return return true if it was the last route on entry
*/
- boolean removeRoute(@Nonnull UnsignedInteger routerId, long remotePathId);
+ boolean removeRoute(@Nonnull UnsignedInteger routerId, Long remotePathId);
/**
* Indicates whether best has changed.
* @param route route Data change
* @return returns the offset
*/
- int addRoute(@Nonnull UnsignedInteger routerId, long remotePathId, @Nonnull R route);
-
+ int addRoute(@Nonnull UnsignedInteger routerId, Long remotePathId, @Nonnull R route);
/**
* Returns collections of present selected best path.
@Nonnull RIBSupport<C, S, R, I> ribSupport,
@Nonnull RouteEntryInfo entryInfo);
-
/**
* Returns list of stale best path.
*
}
@Override
- public final int addRoute(final UnsignedInteger routerId, final long remotePathId, final R route) {
+ public final int addRoute(final UnsignedInteger routerId, final Long remotePathId, final R route) {
final RouteKey key = new RouteKey(routerId, remotePathId);
int offset = this.offsets.offsetOf(key);
if (offset < 0) {
}
@Override
- public final boolean removeRoute(final UnsignedInteger routerId, final long remotePathId) {
+ public final boolean removeRoute(final UnsignedInteger routerId, final Long remotePathId) {
final RouteKey key = new RouteKey(routerId, remotePathId);
final int offset = getOffsets().offsetOf(key);
final Long pathId = this.offsets.getValue(this.pathsId, offset);
import com.google.common.primitives.UnsignedInteger;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.yangtools.concepts.Immutable;
@NonNullByDefault
-public final class RouteKey implements Comparable<RouteKey> {
+public final class RouteKey implements Comparable<RouteKey>, Immutable {
private final UnsignedInteger routerId;
private final long remotePathId;
- public RouteKey(final UnsignedInteger routerId, final long remotePathId) {
+ RouteKey(final UnsignedInteger routerId, final Long remotePathId) {
this.routerId = requireNonNull(routerId);
- this.remotePathId = remotePathId;
+ this.remotePathId = remotePathId.longValue();
}
- public UnsignedInteger getRouterId() {
+ UnsignedInteger getRouterId() {
return routerId;
}
}
@Override
- public boolean removeRoute(final UnsignedInteger routerId, final long remotePathId) {
+ public boolean removeRoute(final UnsignedInteger routerId, final Long remotePathId) {
final int offset = this.offsets.offsetOf(routerId);
this.values = this.offsets.removeValue(this.values, offset, (R[]) EMPTY_VALUES);
this.offsets = this.offsets.without(routerId);
}
@Override
- public int addRoute(final UnsignedInteger routerId, final long remotePathId, final R route) {
+ public int addRoute(final UnsignedInteger routerId, final Long remotePathId, final R route) {
int offset = this.offsets.offsetOf(routerId);
if (offset < 0) {
final OffsetMap newOffsets = this.offsets.with(routerId);
private void updateRoutesEntries(
final Collection<? extends DataObjectModification<? extends DataObject>> collection,
final UnsignedInteger routerId,
- final Map<RouteUpdateKey, RouteEntry<C,S,R,I>> routes
- ) {
+ final Map<RouteUpdateKey, RouteEntry<C,S,R,I>> routes) {
for (final DataObjectModification<? extends DataObject> route : collection) {
final R newRoute = (R) route.getDataAfter();
final R oldRoute = (R) route.getDataBefore();
String routeKey;
- RouteEntry<C,S,R,I> entry;
+ RouteEntry<C, S, R, I> entry;
if (newRoute != null) {
routeKey = newRoute.getRouteKey();
entry = this.routeEntries.get(routeKey);
entry = createEntry(routeKey);
}
- final long pathId = newRoute.getPathId().getValue();
- entry.addRoute(routerId, pathId, newRoute);
+ entry.addRoute(routerId, newRoute.getPathId().getValue(), newRoute);
this.totalPathsCounter.increment();
} else {
routeKey = oldRoute.getRouteKey();
entry = this.routeEntries.get(routeKey);
if(entry != null) {
this.totalPathsCounter.decrement();
- final long pathId = oldRoute.getPathId().getValue();
- if (entry.removeRoute(routerId, pathId)) {
+ if (entry.removeRoute(routerId, oldRoute.getPathId().getValue())) {
this.routeEntries.remove(routeKey);
this.totalPrefixesCounter.decrement();
LOG.trace("Removed route from {}", routerId);