diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-06-01 07:57:49 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-06-08 06:22:41 +0000 |
commit | 1cbfa68433e3207bcc13f93f0af358ac3957636f (patch) | |
tree | c40a5de26fc1001b7e6f4033fc1d4e71a239899f /v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java | |
parent | d0fe32e6acaab61b9d21406eaaa8b92db2b86b9e (diff) |
HC2VPP-164 - Interface/SubInterface filtrationstable/1704
Filtration cannot be done by subId ,because 0 is allowed value
Change-Id: Ic89e30cb74943b6a4c9c995f032bd22567c5ad1e
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
(cherry picked from commit c9052815f89fff314d8f6b67fcd62b707d827611)
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java')
-rw-r--r-- | v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java index cbffdd37c..f951d8fc2 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/InterfaceDataTranslator.java @@ -19,11 +19,11 @@ package io.fd.hc2vpp.v3po.interfacesstate; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; +import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; +import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.honeycomb.translate.ModificationCache; import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.util.RWUtils; -import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; -import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails; import io.fd.vpp.jvpp.core.dto.SwInterfaceDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.SwInterfaceDump; @@ -50,6 +50,9 @@ import org.slf4j.Logger; public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyConsumer { + InterfaceDataTranslator INSTANCE = new InterfaceDataTranslator() { + }; + Gauge64 vppLinkSpeed0 = new Gauge64(BigInteger.ZERO); Gauge64 vppLinkSpeed1 = new Gauge64(BigInteger.valueOf(10L * 1000000)); Gauge64 vppLinkSpeed2 = new Gauge64(BigInteger.valueOf(100L * 1000000)); @@ -259,4 +262,31 @@ public interface InterfaceDataTranslator extends ByteDataTranslator, JvppReplyCo final SwInterfaceDetails cachedDetails) { return ifcType.equals(getInterfaceType(toString(cachedDetails.interfaceName))); } + + /** + * Checks whether provided {@link SwInterfaceDetails} is detail of sub-interface<br> + * <li>subId == unique number of sub-interface within set of sub-interfaces of single interface + * <li>swIfIndex == unique index of interface/sub-interface within all interfaces + * <li>supSwIfIndex == unique index of parent interface + * <li>in case of interface , swIfIndex value equals supSwIfIndex + * <li>in case of subinterface, supSwIfIndex equals index of parent interface, + * swIfIndex is index of subinterface itselt + */ + default boolean isSubInterface(@Nonnull final SwInterfaceDetails elt) { + //cant check by subId != 0, because you can pick 0 as value + return elt.supSwIfIndex != elt.swIfIndex; + } + + /** + * Checks whether provided {@link SwInterfaceDetails} is detail of interface<br> + * <li>subId == unique number of subinterface within set of subinterfaces of single interface + * <li>swIfIndex == unique index of interface/subinterface within all interfaces + * <li>supSwIfIndex == unique index of parent interface + * <li>in case of interface , swIfIndex value equals supSwIfIndex + * <li>in case of subinterface, supSwIfIndex equals index of parent interface, + * swIfIndex is index of subinterface itselt + */ + default boolean isRegularInterface(@Nonnull final SwInterfaceDetails elt) { + return !isSubInterface(elt); + } } |