diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-07-02 07:09:14 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-07-02 09:18:07 +0200 |
commit | 8366e77f1751abdae92284a9cbc0d26c126eb4dd (patch) | |
tree | 28eca5f261490b8326291534387214aecccb4182 /fib-management/fib-management-impl/src/main/java/io | |
parent | 15c5248916bd07564552e27ccea0e0a03592f49b (diff) |
Add initializer for FIB tables
Default FIB tables (ID=0) are created in VPP during startup
for both ipv4 and ipv6.
In order to prevent oper and cfg mismatch,
HC needs to update its cfg during startup.
This patch adds initializer for FIB tables which handles that task.
Change-Id: Iadae8d545985a07fdb32000d3ca498cf3f9b40ed
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'fib-management/fib-management-impl/src/main/java/io')
2 files changed, 13 insertions, 4 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); + } } |