summaryrefslogtreecommitdiffstats
path: root/v3po/impl/src/main/java/io/fd
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-04-12 10:13:31 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-04-12 10:13:31 +0200
commit695eead109ef26d26277675210275a423a5dad50 (patch)
tree80c8567917026154a3b6f199bc0544267adf3bbe /v3po/impl/src/main/java/io/fd
parent5f82161cddaf35acbb6197139deaf604cdc4aca0 (diff)
HONEYCOMB-9: Add configuration and wiring for readers and writers
Remove config module Wrap vpp-japi in a config module Change-Id: Iee1e0c653309bd3c1019323ce689dacf3ed995cd Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/impl/src/main/java/io/fd')
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java30
-rw-r--r--v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java6
2 files changed, 15 insertions, 21 deletions
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java
index a97909190..973d34585 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/V3poProvider.java
@@ -20,9 +20,8 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
-import io.fd.honeycomb.v3po.config.ReaderRegistry;
-import io.fd.honeycomb.v3po.config.WriterRegistry;
-import java.io.IOException;
+import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -72,11 +71,18 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
private VppIetfInterfaceListener vppInterfaceListener;
private VppBridgeDomainListener vppBridgeDomainListener;
private vppApi api;
+ private ReaderRegistry readerRegistry;
+ private WriterRegistry writerRegistry;
private DataBroker db;
VppPollOperDataImpl vppPollOperData;
private VppDataBrokerInitializationProvider vppDataBrokerInitializationProvider;
- public V3poProvider(@Nonnull final Broker domBroker) {
+ public V3poProvider(@Nonnull final Broker domBroker, final vppApi vppJapiDependency,
+ final ReaderRegistry readerRegistry,
+ final WriterRegistry writerRegistry) {
+ api = vppJapiDependency;
+ this.readerRegistry = readerRegistry;
+ this.writerRegistry = writerRegistry;
this.domBroker = Preconditions.checkNotNull(domBroker, "domBroker should not be null");
}
@@ -98,6 +104,7 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
transaction = db.newWriteOnlyTransaction();
// FIXME this is minimal and we need to sync the entire configuration
+ // FIXME remove from here and make this specific for interface customizers
syncInterfaces(transaction, api);
future = transaction.submit();
@@ -177,15 +184,6 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
public void onSessionInitiated(final ProviderContext session) {
LOG.info("VPP-INFO: V3poProvider Session Initiated");
- try {
- api = new vppApi("v3poODL");
- } catch (IOException e) {
- LOG.error("VPP-ERROR: VPP api client connection failed", e);
- return;
- }
-
- LOG.info("VPP-INFO: VPP api client connection established");
-
db = session.getSALService(DataBroker.class);
initializeVppConfig();
initVppOperational();
@@ -195,9 +193,6 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
vppPollOperData);
startOperationalUpdateTimer();
- final ReaderRegistry readerRegistry = ReaderRegistry.getInstance(api);
- final WriterRegistry writerRegistry = WriterRegistry.getInstance(api);
-
// TODO make configurable:
vppDataBrokerInitializationProvider = new VppDataBrokerInitializationProvider(db, readerRegistry, writerRegistry);
// TODO pull the registration into Module
@@ -210,9 +205,6 @@ public class V3poProvider implements BindingAwareProvider, AutoCloseable, Broker
if (v3poService != null) {
v3poService.close();
}
- if (api != null) {
- api.close();
- }
if (vppDataBrokerInitializationProvider != null) {
vppDataBrokerInitializationProvider.close();
}
diff --git a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java
index 0939fe239..58195ba3f 100644
--- a/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java
+++ b/v3po/impl/src/main/java/io/fd/honeycomb/v3po/impl/VppDataBrokerInitializationProvider.java
@@ -23,13 +23,13 @@ import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
-import io.fd.honeycomb.v3po.config.WriterRegistry;
import io.fd.honeycomb.v3po.data.ModifiableDataTree;
import io.fd.honeycomb.v3po.data.ReadableDataTree;
import io.fd.honeycomb.v3po.data.impl.ConfigDataTree;
import io.fd.honeycomb.v3po.data.impl.OperationalDataTree;
import io.fd.honeycomb.v3po.data.impl.DataBroker;
import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collection;
import java.util.Collections;
import javassist.ClassPool;
@@ -136,7 +136,8 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
createMountPointPlaceholder();
- initialVppConfigSynchronization(broker);
+ // TODO initial sync has to go out of here
+// initialVppConfigSynchronization(broker);
}
@Override
@@ -272,6 +273,7 @@ public final class VppDataBrokerInitializationProvider implements Provider, Auto
final WriteTransaction rwTx = bindingBroker.newWriteOnlyTransaction();
// does not fail if data is not present:
rwTx.delete(LogicalDatastoreType.CONFIGURATION, mountPointPath);
+ rwTx.delete(LogicalDatastoreType.OPERATIONAL, mountPointPath);
try {
rwTx.submit().checkedGet();
} catch (TransactionCommitFailedException e) {