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.rev130925.PeerId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.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
48 MapEntryNode createValue(PathArgument routeId, BestPath path);
51 * Indicates whether best has changed
53 * @param localAs The local autonomous system number
54 * @return return true if it has changed
56 boolean selectBest(long localAs);
59 * @param routerId router ID in unsigned integer format from an Ipv4Address
60 * @param remotePathId remote path Id received
61 * @param attrII route Attributes Identifier
62 * @param data route Data change
63 * @return returns the offset
65 int addRoute(UnsignedInteger routerId, Long remotePathId, NodeIdentifier attrII, NormalizedNode<?, ?> data);
68 * Update LocRibOut and AdjRibsOut by removing stale best path and writing new best
70 * @param localTK local Table Key
71 * @param peerPT peer export policy
72 * @param locRibTarget YII local rib
73 * @param ribSupport rib support
74 * @param tx DOM transaction
75 * @param routeIdPA router ID pathArgument
77 void updateRoute(TablesKey localTK, ExportPolicyPeerTracker peerPT, YangInstanceIdentifier locRibTarget, RIBSupport ribSupport,
78 DOMDataWriteTransaction tx, PathArgument routeIdPA);
81 * Write Route on LocRibOut and AdjRibsOut
82 * @param peerId destination peerId
83 * @param routeId router ID path Argument
84 * @param rootPath YII root path
85 * @param peerGroup PeerExportGroup
86 * @param localTK local Table Key
87 * @param ribSupport rib support
88 * @param tx DOM transaction
90 void writeRoute(PeerId peerId, PathArgument routeId, YangInstanceIdentifier rootPath, PeerExportGroup peerGroup, TablesKey localTK,
91 ExportPolicyPeerTracker peerPT, RIBSupport ribSupport, DOMDataWriteTransaction tx);