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 org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
13 import org.opendaylight.protocol.bgp.rib.spi.ExportPolicyPeerTracker;
14 import org.opendaylight.protocol.bgp.rib.spi.PeerExportGroup;
15 import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
20 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
21 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
22 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
25 * A single route entry inside a route table. Maintains the attributes of
26 * from all contributing peers. The information is stored in arrays with a
27 * shared map of offsets for peers to allow lookups. This is needed to
28 * maintain low memory overhead in face of large number of routes and peers,
29 * where individual object overhead becomes the dominating factor.
31 public interface RouteEntry {
35 * @param routerId router ID in unsigned integer format from an Ipv4Address
36 * @param remotePathId remote path Id received
37 * @return return true if it was the last route on entry
39 boolean removeRoute(UnsignedInteger routerId, Long remotePathId);
44 * @param routeId router ID pathArgument
45 * @param path BestPath
46 * @return MapEntryNode
49 MapEntryNode createValue(PathArgument routeId, BestPath path);
52 * Indicates whether best has changed.
54 * @param localAs The local autonomous system number
55 * @return return true if it has changed
57 boolean selectBest(long localAs);
62 * @param routerId router ID in unsigned integer format from an Ipv4Address
63 * @param remotePathId remote path Id received
64 * @param attrII route Attributes Identifier
65 * @param data route Data change
66 * @return returns the offset
68 int addRoute(UnsignedInteger routerId, Long remotePathId, NodeIdentifier attrII, NormalizedNode<?, ?> data);
71 * Update LocRibOut and AdjRibsOut by removing stale best path and writing new best.
73 * @param localTK local Table Key
74 * @param peerPT peer export policy
75 * @param locRibTarget YII local rib
76 * @param ribSupport rib support
77 * @param tx DOM transaction
78 * @param routeIdPA router ID pathArgument
80 void updateRoute(TablesKey localTK, ExportPolicyPeerTracker peerPT, YangInstanceIdentifier locRibTarget,
81 RIBSupport ribSupport, DOMDataWriteTransaction tx, PathArgument routeIdPA);
84 * Write Route on LocRibOut and AdjRibsOut.
86 * @param peerId destination peerId
87 * @param routeId router ID path Argument
88 * @param rootPath YII root path
89 * @param peerGroup PeerExportGroup
90 * @param localTK local Table Key
91 * @param ribSupport rib support
92 * @param tx DOM transaction
94 void writeRoute(PeerId peerId, PathArgument routeId, YangInstanceIdentifier rootPath, PeerExportGroup peerGroup,
95 TablesKey localTK, ExportPolicyPeerTracker peerPT, RIBSupport ribSupport, DOMDataWriteTransaction tx);