summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-10-04 13:08:51 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-10-05 11:54:27 +0000
commitcf15cfe3593ec4c02cdb1121649bf95d19814e0c (patch)
tree5f1efd684679d725eaee116746540262d43536f1 /v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java
parent5d1054b26f144948be321f30204b4b2a7cbbc03e (diff)
HONEYCOMB-238: provide interface mode as a part of ietf-acl configuration
- L2 only rules for L3 interfaces are not allowed by vpp - describes other limitations of ietf-acl model implementation Change-Id: If7e79e4bbfe3113b82e3411d9a951c409799a29f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java
index 167196e21..38ac53699 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/AceEthWriter.java
@@ -16,16 +16,20 @@
package io.fd.honeycomb.translate.v3po.interfaces.acl.ingress;
+import static com.google.common.base.Preconditions.checkArgument;
+
import com.google.common.annotations.VisibleForTesting;
import io.fd.honeycomb.translate.vpp.util.MacTranslator;
import java.util.List;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.actions.PacketHandling;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160708.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEth;
import io.fd.vpp.jvpp.core.dto.ClassifyAddDelSession;
import io.fd.vpp.jvpp.core.dto.ClassifyAddDelTable;
import io.fd.vpp.jvpp.core.dto.InputAclSetInterface;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.InterfaceMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,11 +43,18 @@ final class AceEthWriter extends AbstractAceWriter<AceEth> implements MacTransla
super(futureJVppCore);
}
+ private static void checkInterfaceMode(@Nullable final InterfaceMode mode) {
+ checkArgument(InterfaceMode.L2.equals(mode), "L2 rules are not allowed for interface in L3 mode");
+ }
+
@Override
public ClassifyAddDelTable createClassifyTable(@Nonnull final PacketHandling action,
@Nonnull final AceEth aceEth,
- @Nonnull final int nextTableIndex,
+ @Nullable final InterfaceMode mode,
+ final int nextTableIndex,
final int vlanTags) {
+ checkInterfaceMode(mode);
+
final ClassifyAddDelTable request = createClassifyTable(action, nextTableIndex);
request.mask = new byte[16];
@@ -98,8 +109,11 @@ final class AceEthWriter extends AbstractAceWriter<AceEth> implements MacTransla
@Override
public ClassifyAddDelSession createClassifySession(@Nonnull final PacketHandling action,
@Nonnull final AceEth aceEth,
- @Nonnull final int tableIndex,
+ @Nullable final InterfaceMode mode,
+ final int tableIndex,
final int vlanTags) {
+ checkInterfaceMode(mode);
+
final ClassifyAddDelSession request = createClassifySession(action, tableIndex);
request.match = new byte[16];