diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-10-18 09:48:01 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-10-18 10:52:04 +0200 |
commit | d5b62161bc45e5885de332f554eaa235d6bce347 (patch) | |
tree | 73a13233b5be2dfa87daf39706c1137bca993424 /v3po/v3po2vpp/src/main | |
parent | ae735b4aacfc7008b0c12425367a419b47646350 (diff) |
Make ip-version mandatory for all ACEs
- ip-version was mandatory only when mixing l2/l3 rules in one ACE
(vpp api limitation). It needs to be provided also in case of
ACEs that define l3 only rules (we allow mixing ip4/ip6 ACEs
in one list).
- updates postman collestion with example of L4 only acl
Change-Id: Ifb863208c21a504cd61843f7540341bc35a6174a
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main')
-rw-r--r-- | v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclWriter.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclWriter.java index 58a72ab30..c74845ce7 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclWriter.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/ingress/IetfAclWriter.java @@ -152,13 +152,14 @@ public final class IetfAclWriter implements JvppReplyConsumer, AclTranslator { private static boolean appliesToIp4Path(final Ace ace) { final AceType aceType = ace.getMatches().getAceType(); - if (aceType instanceof AceIp && ((AceIp) aceType).getAceIpVersion() instanceof AceIpv4) { + final AclType aclType = AclType.fromAce(ace); + if (aclType == AclType.IP4) { return true; } - if (aceType instanceof AceEth) { + if (aclType == AclType.ETH) { return true; // L2 only rules are possible for IP4 traffic } - if (aceType instanceof AceIpAndEth && ((AceIpAndEth) aceType) + if (aclType == AclType.ETH_AND_IP && ((AceIpAndEth) aceType) .getAceIpVersion() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv4) { return true; } @@ -167,13 +168,14 @@ public final class IetfAclWriter implements JvppReplyConsumer, AclTranslator { private static boolean appliesToIp6Path(final Ace ace) { final AceType aceType = ace.getMatches().getAceType(); - if (aceType instanceof AceIp && ((AceIp) aceType).getAceIpVersion() instanceof AceIpv6) { + final AclType aclType = AclType.fromAce(ace); + if (aclType == AclType.IP6) { return true; } - if (aceType instanceof AceEth) { - return true; // L2 only rules are possible for IP6 traffic + if (aclType == AclType.ETH) { + return true; // L2 only rules are possible for IP6 traffic } - if (aceType instanceof AceIpAndEth && ((AceIpAndEth) aceType) + if (aclType == AclType.ETH_AND_IP && ((AceIpAndEth) aceType) .getAceIpVersion() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev161214.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.and.eth.ace.ip.version.AceIpv6) { return true; } @@ -291,9 +293,12 @@ public final class IetfAclWriter implements JvppReplyConsumer, AclTranslator { result = ETH; } else if (aceType instanceof AceIp) { final AceIpVersion aceIpVersion = ((AceIp) aceType).getAceIpVersion(); + if (aceIpVersion == null) { + throw new IllegalArgumentException("Incomplete ACE (ip-version was not provided): " + ace); + } if (aceIpVersion instanceof AceIpv4) { result = IP4; - } else { + } else if (aceIpVersion instanceof AceIpv6) { result = IP6; } } else if (aceType instanceof AceIpAndEth) { |