diff options
author | 2016-11-09 08:55:04 +0100 | |
---|---|---|
committer | 2016-11-09 08:55:04 +0100 | |
commit | ddb7683677ef0bcc291f686dbed9c95d50c4046b (patch) | |
tree | 3315c21c9e4cba0bb6c25c7c5ec0048bb51458e5 /lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory | |
parent | 64d4c13102024ab8f1e0215c6a6a4894c3306c56 (diff) |
HONEYCOMB-254 - Adjacencies dump support
Added mapping context between adjacency id(HC side)
and combination of remote and local eids(vpp side)
Change-Id: Icbba9130a82b7af51b23e6d6d68fcfbf49e66c99
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory')
2 files changed, 23 insertions, 7 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java index 6fb0149ce..055aa72b9 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/LispWriterFactory.java @@ -18,6 +18,7 @@ package io.fd.honeycomb.lisp.translate.write.factory; import static com.google.common.base.Preconditions.checkNotNull; +import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.ADJACENCIES_IDENTIFICATION_CONTEXT; import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.INTERFACE_CONTEXT; import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCAL_MAPPING_CONTEXT; import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.LOCATOR_SET_CONTEXT; @@ -25,6 +26,7 @@ import static io.fd.honeycomb.lisp.cfgattrs.LispConfiguration.REMOTE_MAPPING_CON import com.google.inject.Inject; import com.google.inject.name.Named; +import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext; import io.fd.honeycomb.lisp.context.util.EidMappingContext; import io.fd.honeycomb.lisp.translate.write.LispCustomizer; import io.fd.honeycomb.lisp.translate.write.PitrCfgCustomizer; @@ -46,6 +48,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; public final class LispWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory { private final NamingContext bridgeDomainContext; + private final AdjacenciesMappingContext adjacenciesMappingContext; @Inject public LispWriterFactory(final FutureJVppCore vppApi, @@ -53,10 +56,13 @@ public final class LispWriterFactory extends AbstractLispWriterFactoryBase imple @Named(LOCATOR_SET_CONTEXT) final NamingContext locatorSetContext, @Named("bridge-domain-context") final NamingContext bridgeDomainContext, @Named(LOCAL_MAPPING_CONTEXT) final EidMappingContext localMappingContext, - @Named(REMOTE_MAPPING_CONTEXT) final EidMappingContext remoteMappingContext) { + @Named(REMOTE_MAPPING_CONTEXT) final EidMappingContext remoteMappingContext, + @Named(ADJACENCIES_IDENTIFICATION_CONTEXT) final AdjacenciesMappingContext adjacenciesMappingContext) { super(InstanceIdentifier.create(Lisp.class), vppApi, interfaceContext, locatorSetContext, localMappingContext, remoteMappingContext); this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null"); + this.adjacenciesMappingContext = + checkNotNull(adjacenciesMappingContext, "Adjacencies mapping context cannot be null"); } @Override @@ -64,7 +70,7 @@ public final class LispWriterFactory extends AbstractLispWriterFactoryBase imple registry.add(new GenericWriter<>(lispInstanceIdentifier, new LispCustomizer(vppApi))); VniTableWriterFactory.newInstance(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext, - bridgeDomainContext) + bridgeDomainContext, adjacenciesMappingContext) .init(registry); LocatorSetsWriterFactory.newInstance(lispInstanceIdentifier, vppApi, interfaceContext, locatorSetContext) .init(registry); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java index f13b01c97..9e9152ce0 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/honeycomb/lisp/translate/write/factory/VniTableWriterFactory.java @@ -19,6 +19,7 @@ package io.fd.honeycomb.lisp.translate.write.factory; import static com.google.common.base.Preconditions.checkNotNull; import com.google.common.collect.ImmutableSet; +import io.fd.honeycomb.lisp.context.util.AdjacenciesMappingContext; import io.fd.honeycomb.lisp.context.util.EidMappingContext; import io.fd.honeycomb.lisp.translate.write.AdjacencyCustomizer; import io.fd.honeycomb.lisp.translate.write.BridgeDomainSubtableCustomizer; @@ -53,20 +54,26 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +//TODO - HONEYCOMB-282 - refactor this and other factories for better readability + /** * Factory for producing writers for {@code EidTable} */ final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implements WriterFactory { private final NamingContext bridgeDomainContext; + private final AdjacenciesMappingContext adjacenciesMappingContext; private VniTableWriterFactory(final InstanceIdentifier<Lisp> lispInstanceIdentifier, final FutureJVppCore vppApi, final EidMappingContext localMappingContext, final EidMappingContext remoteMappingContext, - final NamingContext bridgeDomainContext) { + final NamingContext bridgeDomainContext, + final AdjacenciesMappingContext adjacenciesMappingContext) { super(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext); this.bridgeDomainContext = checkNotNull(bridgeDomainContext, "Bridge domain context cannot be null"); + this.adjacenciesMappingContext = + checkNotNull(adjacenciesMappingContext, "Adjacencies mapping context cannot be null"); } public static VniTableWriterFactory newInstance( @@ -74,9 +81,10 @@ final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implemen @Nonnull final FutureJVppCore vppApi, @Nonnull final EidMappingContext localMappingContext, @Nonnull final EidMappingContext remoteMappingContext, - @Nonnull final NamingContext bridgeDomainContext) { + @Nonnull final NamingContext bridgeDomainContext, + @Nonnull final AdjacenciesMappingContext adjacenciesMappingContext) { return new VniTableWriterFactory(lispInstanceIdentifier, vppApi, localMappingContext, remoteMappingContext, - bridgeDomainContext); + bridgeDomainContext, adjacenciesMappingContext); } @Override @@ -135,7 +143,8 @@ final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implemen new GenericListWriter<>( vrfSubtableId.child(RemoteMappings.class).child(RemoteMapping.class) .child(Adjacencies.class).child(Adjacency.class), - new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext))); + new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext, + adjacenciesMappingContext))); //VniTable - > BridgeDomainSubtable -> RemoteMappings - > RemoteMapping - > Adjacencies - > Adjacency registry.subtreeAdd(ImmutableSet.of(adjacencySubtreeId .child(LocalEid.class), adjacencySubtreeId.child(RemoteEid.class)), @@ -143,6 +152,7 @@ final class VniTableWriterFactory extends AbstractLispWriterFactoryBase implemen bridgeDomainSubtableId.child(RemoteMappings.class) .child(RemoteMapping.class) .child(Adjacencies.class).child(Adjacency.class), - new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext))); + new AdjacencyCustomizer(vppApi, localMappingContext, remoteMappingContext, + adjacenciesMappingContext))); } } |