diff options
author | 2017-09-28 13:31:17 +0200 | |
---|---|---|
committer | 2017-09-28 13:31:17 +0200 | |
commit | 8c31963654d126fa1b670c3d10c0ee81f445166a (patch) | |
tree | 1492d8e3dddf11364d8844571a4579895cb34705 /routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java | |
parent | 1ccfb17154bf025ac320ffea3433cd62bedc221c (diff) |
HC2VPP-232 - Secondary table lookup support
Ietf models now contains case table-lookup to be able to define
lookup to secondary table. It must be separated to dedicated case
as combining secondary-vrf and other next hop types(simple,multi,special)
does not make sense, its either you define lookup to table,
or you specify next hop of some kind.
This patch works properly only for write,
as read is affected by VPP-994/VPP-995.
Read at this state can detect that route is using table lookup,
but can't detect table that is used for that lookup.
Also, HC2VPP-237 must be done in future
Change-Id: Ia6976b35c6c1712d8add60beea7b0edbc4536974
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java')
-rw-r--r-- | routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java index deabdacee..68f245b26 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java @@ -19,9 +19,12 @@ package io.fd.hc2vpp.routing.trait; import io.fd.hc2vpp.common.translate.util.AddressTranslator; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.vpp.jvpp.core.types.FibPath; -import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping; +import javax.annotation.Nonnull; +import java.util.Arrays; +import java.util.stream.IntStream; + public interface RouteMapper extends AddressTranslator, ByteDataTranslator { int DEFAULT_INTERFACE_INDEX = -1; @@ -75,6 +78,11 @@ public interface RouteMapper extends AddressTranslator, ByteDataTranslator { byteToBoolean(path.isUnreach); } + default boolean isTableLookup(@Nonnull final FibPath path) { + // TODO - remove isDrop condition https://jira.fd.io/browse/VPP-995 + return path.isDrop == 1 && isArrayZeroed(path.nextHop); + } + default SpecialNextHopGrouping.SpecialNextHop specialHopType(final FibPath singlePath) { if (flagEnabled(singlePath.isDrop)) { return SpecialNextHopGrouping.SpecialNextHop.Blackhole; |