BUG-5685: Register BGP Rib to Cluster Singleton Service Provider
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / BgpDeployer.java
index 7bfd76f2861a8723fbb200160522e5f177fa9664..b14615bda502da7eb9ff25437ff58bcb4cf7f297 100644 (file)
@@ -8,21 +8,49 @@
 
 package org.opendaylight.protocol.bgp.rib.impl.spi;
 
+import com.google.common.util.concurrent.ListenableFuture;
+import org.opendaylight.protocol.bgp.openconfig.spi.BGPOpenConfigMappingService;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.Bgp;
+import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global;
 import org.opendaylight.yang.gen.v1.http.openconfig.net.yang.network.instance.rev151018.network.instance.top.network.instances.NetworkInstance;
+import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
  * The BgpDeployer service is managing RIB, Peer, Application Peer instances based on the OpenConfig BGP
  * configuration status.
  * BGP configuration is held under the specific OpenConfig's NetworkInstance subtree.
- *
  */
 public interface BgpDeployer {
 
+    interface WriteConfiguration {
+        void apply();
+    }
+
     /**
      * Get pointer to NetworkInstance instance where this particular BGP deployer is binded.
+     *
      * @return InstanceIdentifier
      */
     InstanceIdentifier<NetworkInstance> getInstanceIdentifier();
 
+    BGPOpenConfigMappingService getMappingService();
+
+    <T extends DataObject> ListenableFuture<Void> writeConfiguration(T data, InstanceIdentifier<T> identifier);
+
+    <T extends DataObject> ListenableFuture<Void> removeConfiguration(InstanceIdentifier<T> identifier);
+
+    /**
+     * Create, start and register rib instance
+     * @param rootIdentifier
+     * @param global
+     * @param configurationWriter
+     */
+    void onGlobalCreated(InstanceIdentifier<Bgp> rootIdentifier, Global global, WriteConfiguration configurationWriter);
+
+    /**
+     * Destroy rib instance
+     * @param rootIdentifier
+     */
+    void onGlobalRemoved(InstanceIdentifier<Bgp> rootIdentifier);
 }