summaryrefslogtreecommitdiffstats
path: root/fib-management/fib-management-impl/src
diff options
context:
space:
mode:
Diffstat (limited to 'fib-management/fib-management-impl/src')
-rw-r--r--fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibManagementReaderFactory.java4
-rw-r--r--fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizer.java13
-rw-r--r--fib-management/fib-management-impl/src/test/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizerTest.java12
3 files changed, 22 insertions, 7 deletions
diff --git a/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibManagementReaderFactory.java b/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibManagementReaderFactory.java
index d3adc91f7..4c1de905f 100644
--- a/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibManagementReaderFactory.java
+++ b/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibManagementReaderFactory.java
@@ -19,7 +19,7 @@ package io.fd.hc2vpp.fib.management.read;
import com.google.inject.Inject;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.fib.management.FibManagementIIds;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
+import io.fd.honeycomb.translate.impl.read.GenericInitListReader;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
@@ -47,7 +47,7 @@ public final class FibManagementReaderFactory implements ReaderFactory, JvppRepl
registry.addStructuralReader(FibManagementIIds.FIB_MNGMNT, FibTableManagementBuilder.class);
registry.addStructuralReader(FibManagementIIds.FM_FIB_TABLES, FibTablesBuilder.class);
- registry.add(new GenericListReader<>(FibManagementIIds.FM_FTBLS_TABLE,
+ registry.add(new GenericInitListReader<>(FibManagementIIds.FM_FTBLS_TABLE,
new FibTableCustomizer(ipv4DumpManager, ipv6DumpManager)));
}
diff --git a/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizer.java b/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizer.java
index 0151a1548..08c8328e4 100644
--- a/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizer.java
+++ b/fib-management/fib-management-impl/src/main/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizer.java
@@ -20,7 +20,8 @@ package io.fd.hc2vpp.fib.management.read;
import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
+import io.fd.honeycomb.translate.spi.read.Initialized;
+import io.fd.honeycomb.translate.spi.read.InitializingListReaderCustomizer;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.vpp.jvpp.core.dto.Ip6FibDetailsReplyDump;
import io.fd.vpp.jvpp.core.dto.IpFibDetailsReplyDump;
@@ -40,7 +41,7 @@ import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-class FibTableCustomizer implements ListReaderCustomizer<Table, TableKey, TableBuilder>, ByteDataTranslator {
+class FibTableCustomizer implements InitializingListReaderCustomizer<Table, TableKey, TableBuilder>, ByteDataTranslator {
private final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4DumpManager;
private final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6DumpManager;
@@ -116,4 +117,12 @@ class FibTableCustomizer implements ListReaderCustomizer<Table, TableKey, TableB
builder.setName(toString(tableName));
}
}
+
+ @Nonnull
+ @Override
+ public Initialized<Table> init(@Nonnull final InstanceIdentifier<Table> id,
+ @Nonnull final Table readValue,
+ @Nonnull final ReadContext ctx) {
+ return Initialized.create(id, readValue);
+ }
}
diff --git a/fib-management/fib-management-impl/src/test/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizerTest.java b/fib-management/fib-management-impl/src/test/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizerTest.java
index 6b2d8c4d7..081553e47 100644
--- a/fib-management/fib-management-impl/src/test/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizerTest.java
+++ b/fib-management/fib-management-impl/src/test/java/io/fd/hc2vpp/fib/management/read/FibTableCustomizerTest.java
@@ -22,7 +22,7 @@ import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
-import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
+import io.fd.hc2vpp.common.test.read.InitializingListReaderCustomizerTest;
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.fib.management.FibManagementIIds;
import io.fd.honeycomb.translate.ModificationCache;
@@ -52,8 +52,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.vpp.fib.table.management.fib.tables.TableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class FibTableCustomizerTest extends ListReaderCustomizerTest<Table, TableKey, TableBuilder> implements
- AddressTranslator {
+public class FibTableCustomizerTest extends InitializingListReaderCustomizerTest<Table, TableKey, TableBuilder>
+ implements AddressTranslator {
private static final String IPV4_VRF_1 = "IPV4_VRF_1";
private static final IpAddress NEXT_HOP_1 = new IpAddress(new Ipv6Address("a::1"));
@@ -165,6 +165,12 @@ public class FibTableCustomizerTest extends ListReaderCustomizerTest<Table, Tabl
Assert.assertEquals(IPV4_VRF_1, builder.getName());
}
+ @Test
+ public void testInit() {
+ final Table data = new TableBuilder().build();
+ invokeInitTest(TABLE_V4_ID, data, TABLE_V4_ID, data);
+ }
+
@Override
protected ReaderCustomizer<Table, TableBuilder> initCustomizer() {
return new FibTableCustomizer(manager_v4, manager_v6);