summaryrefslogtreecommitdiffstats
path: root/v3po/impl/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/impl/src/main/java')
-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
-rw-r--r--v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java7
3 files changed, 21 insertions, 22 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) {
diff --git a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java
index 390545563..3b77418ad 100644
--- a/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java
+++ b/v3po/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/impl/rev141210/V3poModule.java
@@ -17,6 +17,8 @@
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.impl.rev141210;
import io.fd.honeycomb.v3po.impl.V3poProvider;
+import io.fd.honeycomb.v3po.translate.read.ReaderRegistry;
+import io.fd.honeycomb.v3po.translate.write.WriterRegistry;
import java.util.Collection;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -54,9 +56,12 @@ public class V3poModule extends
@Override
public java.lang.AutoCloseable createInstance() {
+ final ReaderRegistry readerRegistry = getReaderRegistryDependency();
+ final WriterRegistry writerRegistry = getWriterRegistryDependency();
+
final Broker domBroker = getDomBrokerDependency();
domBroker.registerProvider(new InitializationProvider());
- final V3poProvider provider = new V3poProvider(domBroker);
+ final V3poProvider provider = new V3poProvider(domBroker, getVppJapiDependency(), readerRegistry, writerRegistry);
getBrokerDependency().registerProvider(provider);
return provider;
}