BUG-5685: Register BGP Peer Cluster Singleton Service
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / BgpDeployer.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.impl.spi;
10
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.protocol.bgp.openconfig.spi.BGPOpenConfigMappingService;
13 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbors.Neighbor;
14 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
15 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
16 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
17 import org.opendaylight.yangtools.yang.binding.DataObject;
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19
20 /**
21  * The BgpDeployer service is managing RIB, Peer, Application Peer instances based on the OpenConfig BGP
22  * configuration status.
23  * BGP configuration is held under the specific OpenConfig's NetworkInstance subtree.
24  */
25 public interface BgpDeployer {
26
27     interface WriteConfiguration {
28         void apply();
29     }
30
31     /**
32      * Get pointer to NetworkInstance instance where this particular BGP deployer is binded.
33      *
34      * @return InstanceIdentifier
35      */
36     InstanceIdentifier<NetworkInstance> getInstanceIdentifier();
37
38     BGPOpenConfigMappingService getMappingService();
39
40     <T extends DataObject> ListenableFuture<Void> writeConfiguration(T data, InstanceIdentifier<T> identifier);
41
42     <T extends DataObject> ListenableFuture<Void> removeConfiguration(InstanceIdentifier<T> identifier);
43
44     /**
45      * Create, start and register rib instance
46      * @param rootIdentifier
47      * @param global
48      * @param configurationWriter
49      */
50     void onGlobalModified(InstanceIdentifier<Bgp> rootIdentifier, Global global, WriteConfiguration configurationWriter);
51
52     /**
53      * Destroy rib instance
54      * @param rootIdentifier
55      */
56     void onGlobalRemoved(InstanceIdentifier<Bgp> rootIdentifier);
57
58     /**
59      * Create, start and register peer instance
60      * @param rootIdentifier
61      * @param neighbor
62      */
63     void onNeighborModified(InstanceIdentifier<Bgp> rootIdentifier, Neighbor neighbor, WriteConfiguration configurationWriter);
64
65     /**
66      * Destroy peer instance
67      * @param rootIdentifier
68      * @param neighbor
69      */
70     void onNeighborRemoved(InstanceIdentifier<Bgp> rootIdentifier, Neighbor neighbor);
71 }