b14615bda502da7eb9ff25437ff58bcb4cf7f297
[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.top.Bgp;
14 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
15 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18
19 /**
20  * The BgpDeployer service is managing RIB, Peer, Application Peer instances based on the OpenConfig BGP
21  * configuration status.
22  * BGP configuration is held under the specific OpenConfig's NetworkInstance subtree.
23  */
24 public interface BgpDeployer {
25
26     interface WriteConfiguration {
27         void apply();
28     }
29
30     /**
31      * Get pointer to NetworkInstance instance where this particular BGP deployer is binded.
32      *
33      * @return InstanceIdentifier
34      */
35     InstanceIdentifier<NetworkInstance> getInstanceIdentifier();
36
37     BGPOpenConfigMappingService getMappingService();
38
39     <T extends DataObject> ListenableFuture<Void> writeConfiguration(T data, InstanceIdentifier<T> identifier);
40
41     <T extends DataObject> ListenableFuture<Void> removeConfiguration(InstanceIdentifier<T> identifier);
42
43     /**
44      * Create, start and register rib instance
45      * @param rootIdentifier
46      * @param global
47      * @param configurationWriter
48      */
49     void onGlobalCreated(InstanceIdentifier<Bgp> rootIdentifier, Global global, WriteConfiguration configurationWriter);
50
51     /**
52      * Destroy rib instance
53      * @param rootIdentifier
54      */
55     void onGlobalRemoved(InstanceIdentifier<Bgp> rootIdentifier);
56 }