Fix findbug and checkstyle issues
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / ExportPolicyPeerTracker.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.protocol.bgp.rib.spi;
10
11 import java.util.Optional;
12 import javax.annotation.Nonnull;
13 import javax.annotation.Nullable;
14 import org.opendaylight.protocol.concepts.AbstractRegistration;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.SendReceive;
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.PeerRole;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.SimpleRoutingPolicy;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20
21 /**
22  * Tracks peers for adj-rib-out writeout.
23  */
24 public interface ExportPolicyPeerTracker {
25     /**
26      * Register Peer.
27      *
28      * @param peerId              Peer Id
29      * @param sendReceive         send receive add ath configuration of the peer
30      * @param peerPath            Yii of the peer
31      * @param peerRole            Role of the peer
32      * @param simpleRoutingPolicy optional
33      */
34     @Nonnull
35     AbstractRegistration registerPeer(@Nonnull PeerId peerId, @Nullable SendReceive sendReceive,
36             @Nonnull YangInstanceIdentifier peerPath, @Nonnull PeerRole peerRole,
37             @Nonnull Optional<SimpleRoutingPolicy> simpleRoutingPolicy);
38
39     /**
40      * Returns PeerExportGroup per role.
41      *
42      * @param role of desired PeerExportGroup
43      * @return PeerExportGroup
44      */
45     @Nullable
46     PeerExportGroup getPeerGroup(@Nonnull PeerRole role);
47
48     /**
49      * Check whether the peer supports the table.
50      *
51      * @param peerId of peer
52      * @return true if peer supports table
53      */
54     boolean isTableSupported(@Nonnull PeerId peerId);
55
56     /**
57      * Returns roles per PeerID.
58      *
59      * @param peerId of peer
60      * @return Role of peer
61      */
62     @Nonnull
63     PeerRole getRole(@Nonnull YangInstanceIdentifier peerId);
64
65     /**
66      * Check whether Peer supports Add Path.
67      *
68      * @param peerId of peer
69      * @return true if add-path is supported
70      */
71     boolean isAddPathSupportedByPeer(@Nonnull PeerId peerId);
72
73     /**
74      * Flags peers once empty structure has been created, then changes under it can
75      * be applied.
76      *
77      * @param peerId of peer
78      */
79     void registerPeerAsInitialized(@Nonnull PeerId peerId);
80
81     /**
82      * Check whether the peer supports the table.
83      *
84      * @param peerId of peer
85      * @return true if peer supports table
86      */
87     boolean isTableStructureInitialized(@Nonnull PeerId peerId);
88 }