2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.protocol.bgp.mode.api;
11 import com.google.common.primitives.UnsignedInteger;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
14 import org.opendaylight.protocol.bgp.rib.spi.entry.RouteEntryDependenciesContainer;
15 import org.opendaylight.protocol.bgp.rib.spi.entry.RouteEntryInfo;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
19 * A single route entry inside a route table. Maintains the attributes of
20 * from all contributing peers. The information is stored in arrays with a
21 * shared map of offsets for peers to allow lookups. This is needed to
22 * maintain low memory overhead in face of large number of routes and peers,
23 * where individual object overhead becomes the dominating factor.
25 public interface RouteEntry {
29 * @param routerId router ID in unsigned integer format from an Ipv4Address
30 * @param remotePathId remote path Id received
31 * @return return true if it was the last route on entry
33 boolean removeRoute(@Nonnull UnsignedInteger routerId, long remotePathId);
36 * Indicates whether best has changed.
38 * @param localAs The local autonomous system number
39 * @return return true if it has changed
41 boolean selectBest(long localAs);
46 * @param routerId router ID in unsigned integer format from an Ipv4Address
47 * @param remotePathId remote path Id received
48 * @param route route Data change
49 * @return returns the offset
51 int addRoute(@Nonnull UnsignedInteger routerId, long remotePathId, @Nonnull Route route);
54 * Update LocRibOut and AdjRibsOut by removing stale best path and writing new best.
56 * @param entryDependencies entry Dependencies container
57 * @param routeKey route key
58 * @param tx DOM transaction
61 @Nonnull RouteEntryDependenciesContainer entryDependencies,
62 @Nonnull String routeKey,
63 @Nonnull WriteTransaction tx);
66 * Initialize LocRibOut and AdjRibsOut for new peers with already present best paths.
68 * @param entryDependencies Route Entry Dependencies wrapper
69 * @param entryInfo Route Entry Info wrapper
70 * @param tx transaction
72 void initializeBestPaths(
73 @Nonnull RouteEntryDependenciesContainer entryDependencies,
74 @Nonnull RouteEntryInfo entryInfo,
75 @Nonnull WriteTransaction tx);