summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/VppStateHoneycombReaderFactory.java12
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java8
-rw-r--r--v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json3
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java14
-rw-r--r--v3po/v3po2vpp/src/test/resources/v3po.json3
5 files changed, 33 insertions, 7 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/VppStateHoneycombReaderFactory.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/VppStateHoneycombReaderFactory.java
index 03da2c755..8fcad8f49 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/VppStateHoneycombReaderFactory.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/VppStateHoneycombReaderFactory.java
@@ -18,6 +18,10 @@ package io.fd.hc2vpp.v3po;
import com.google.inject.Inject;
import com.google.inject.name.Named;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.common.translate.util.ReadTimeoutException;
+import io.fd.hc2vpp.common.translate.util.VppStatusListener;
+import io.fd.hc2vpp.v3po.cfgattrs.V3poConfiguration;
import io.fd.hc2vpp.v3po.vppstate.BridgeDomainCustomizer;
import io.fd.hc2vpp.v3po.vppstate.L2FibEntryCustomizer;
import io.fd.hc2vpp.v3po.vppstate.VersionCustomizer;
@@ -26,9 +30,6 @@ import io.fd.honeycomb.translate.impl.read.GenericReader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.util.read.KeepaliveReaderWrapper;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.common.translate.util.ReadTimeoutException;
-import io.fd.hc2vpp.common.translate.util.VppStatusListener;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.ScheduledExecutorService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppState;
@@ -51,6 +52,9 @@ public final class VppStateHoneycombReaderFactory implements ReaderFactory {
private final VppStatusListener vppStatusListener;
@Inject
+ private V3poConfiguration v3poConfiguration;
+
+ @Inject
public VppStateHoneycombReaderFactory(final FutureJVppCore jVpp,
@Named("interface-context") final NamingContext ifcCtx,
@Named("bridge-domain-context") final NamingContext bdCtx,
@@ -73,7 +77,7 @@ public final class VppStateHoneycombReaderFactory implements ReaderFactory {
// Relying on VersionCustomizer to provide a "timing out read"
registry.add(new KeepaliveReaderWrapper<>(
new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)),
- keepaliveExecutor, ReadTimeoutException.class, 30, vppStatusListener));
+ keepaliveExecutor, ReadTimeoutException.class, v3poConfiguration.getKeepaliveDelay(), vppStatusListener));
// BridgeDomains(Structural)
final InstanceIdentifier<BridgeDomains> bridgeDomainsId = vppStateId.child(BridgeDomains.class);
registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class);
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java
index 6676956d8..f7b52accd 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/cfgattrs/V3poConfiguration.java
@@ -17,8 +17,16 @@
package io.fd.hc2vpp.v3po.cfgattrs;
import net.jmob.guice.conf.core.BindConfig;
+import net.jmob.guice.conf.core.InjectConfig;
import net.jmob.guice.conf.core.Syntax;
@BindConfig(value = "v3po", syntax = Syntax.JSON)
public class V3poConfiguration {
+
+ @InjectConfig("keepalive-delay")
+ private String keepaliveDelay;
+
+ public int getKeepaliveDelay() {
+ return Integer.valueOf(this.keepaliveDelay);
+ }
}
diff --git a/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json b/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json
index 7a73a41bf..9ea66efe8 100644
--- a/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json
+++ b/v3po/v3po2vpp/src/main/resources/honeycomb-minimal-resources/config/v3po.json
@@ -1,2 +1,3 @@
{
-} \ No newline at end of file
+ "keepalive-delay": "30"
+}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java
index 3366af64f..66231b2ff 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java
@@ -19,6 +19,7 @@ package io.fd.hc2vpp.v3po;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.Matchers.empty;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.mockito.MockitoAnnotations.initMocks;
@@ -28,18 +29,19 @@ import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
+import io.fd.hc2vpp.v3po.cfgattrs.V3poConfiguration;
import io.fd.honeycomb.translate.MappingContext;
-import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
+import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.write.WriterFactory;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.HashSet;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
public class V3poModuleTest {
@@ -68,6 +70,9 @@ public class V3poModuleTest {
@Inject
private Set<WriterFactory> writerFactories = new HashSet<>();
+ @Inject
+ private V3poConfiguration configuration;
+
@Before
public void setUp() {
initMocks(this);
@@ -93,4 +98,9 @@ public class V3poModuleTest {
writerFactories.stream().forEach(factory -> factory.init(registryBuilder));
assertNotNull(registryBuilder.build());
}
+
+ @Test
+ public void testConfiguration() {
+ assertEquals(30, configuration.getKeepaliveDelay());
+ }
} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/resources/v3po.json b/v3po/v3po2vpp/src/test/resources/v3po.json
new file mode 100644
index 000000000..9ea66efe8
--- /dev/null
+++ b/v3po/v3po2vpp/src/test/resources/v3po.json
@@ -0,0 +1,3 @@
+{
+ "keepalive-delay": "30"
+}