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 javax.annotation.Nullable;
14 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
15 import org.opendaylight.protocol.bgp.rib.spi.PeerExportGroup;
16 import org.opendaylight.protocol.bgp.rib.spi.entry.RouteEntryDependenciesContainer;
17 import org.opendaylight.protocol.bgp.rib.spi.entry.RouteEntryInfo;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
20 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
23 * A single route entry inside a route table. Maintains the attributes of
24 * from all contributing peers. The information is stored in arrays with a
25 * shared map of offsets for peers to allow lookups. This is needed to
26 * maintain low memory overhead in face of large number of routes and peers,
27 * where individual object overhead becomes the dominating factor.
29 public interface RouteEntry {
33 * @param routerId router ID in unsigned integer format from an Ipv4Address
34 * @param remotePathId remote path Id received
35 * @return return true if it was the last route on entry
37 boolean removeRoute(UnsignedInteger routerId, Long remotePathId);
40 * Indicates whether best has changed.
42 * @param localAs The local autonomous system number
43 * @return return true if it has changed
45 boolean selectBest(long localAs);
50 * @param routerId router ID in unsigned integer format from an Ipv4Address
51 * @param remotePathId remote path Id received
52 * @param attrII route Attributes Identifier
53 * @param data route Data change
54 * @return returns the offset
56 int addRoute(UnsignedInteger routerId, Long remotePathId, NodeIdentifier attrII, NormalizedNode<?, ?> data);
59 * Update LocRibOut and AdjRibsOut by removing stale best path and writing new best.
61 * @param entryDependencies entry Dependencies container
62 * @param routeIdPA router ID pathArgument
63 * @param tx DOM transaction
66 @Nonnull RouteEntryDependenciesContainer entryDependencies,
67 @Nonnull NodeIdentifierWithPredicates routeIdPA,
68 @Nonnull DOMDataWriteTransaction tx);
71 * Initialize LocRibOut and AdjRibsOut for new peers with already present best paths.
73 * @param entryDependencies Route Entry Dependencies wrapper
74 * @param entryInfo Route Entry Info wrapper
75 * @param tx transaction
77 void initializeBestPaths(
78 @Nonnull RouteEntryDependenciesContainer entryDependencies,
79 @Nonnull RouteEntryInfo entryInfo,
80 @Nullable PeerExportGroup peerGroup,
81 @Nonnull DOMDataWriteTransaction tx);