diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2018-11-19 14:59:14 +0100 |
---|---|---|
committer | Michal Cmarada <mcmarada@cisco.com> | 2018-11-19 14:59:14 +0100 |
commit | 718e9a3c7cac01860f3e3fe6174fcc1bd33fb4eb (patch) | |
tree | 34fae7680450e166e845f0c2db84ed8c3215930f /acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java | |
parent | f9acfac8b701f9903a28edc98db127c36d73384f (diff) |
HC2VPP-291: ACL model bump
- bump ACL yang models
- fix ACL module implementation and validation
- fix ACL Unit tests
- update postman collection
Change-Id: Iaab64e6d92d17babc3ccef7921b41070c3716516
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java')
-rw-r--r-- | acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java | 285 |
1 files changed, 151 insertions, 134 deletions
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java index 582da0357..3ca18d6e6 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/util/protocol/ProtoPreBindRuleProducer.java @@ -16,31 +16,27 @@ package io.fd.hc2vpp.acl.util.protocol; -import static com.google.common.base.Preconditions.checkArgument; -import static io.fd.hc2vpp.acl.util.protocol.ProtoPreBindRuleProducer.ProtocolPair.pair; - -import com.google.common.collect.ImmutableSet; +import com.google.common.base.Preconditions; import io.fd.vpp.jvpp.acl.types.AclRule; -import java.util.Optional; -import java.util.Set; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.acl.rev181022.ValueRange; +import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.acl.rev181022.VppIcmpAceAugmentation; +import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.acl.rev181022.VppTcpAceAugmentation; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.Ace; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.L4; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l3.Ipv6; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.icmp.Icmp; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.tcp.Tcp; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.tcp.tcp.destination.port.DestinationPort; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.tcp.tcp.source.port.SourcePort; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.tcp.tcp.source.port.source.port.RangeOrOperator; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.Udp; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.DestinationPortRange; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev160708.acl.transport.header.fields.SourcePortRange; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.ValueRange; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.access.lists.acl.access.list.entries.ace.matches.ace.type.VppAce; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.access.lists.acl.access.list.entries.ace.matches.ace.type.vpp.ace.VppAceNodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.IpProtocol; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.Icmp; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.IcmpV6; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.Other; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.Tcp; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.Udp; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.icmp.IcmpNodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.icmp.v6.IcmpV6Nodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.tcp.TcpNodes; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.acl.rev170615.acl.ip.protocol.header.fields.ip.protocol.udp.UdpNodes; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev181001.AclTcpHeaderFields; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev181001.port.range.or.operator.PortRangeOrOperator; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev181001.port.range.or.operator.port.range.or.operator.Range; +import org.opendaylight.yangtools.yang.binding.DataContainer; /** * Creates ACL rules pre-bind with protocol-related fields.<br> @@ -53,89 +49,41 @@ public interface ProtoPreBindRuleProducer { int TCP_INDEX = 6; int UDP_INDEX = 17; int ICMPV6_INDEX = 58; - short MAX_PORT_NUMBER = (short)65535; - - Set<ProtocolPair> PROTOCOL_PAIRS = ImmutableSet.of(pair(Icmp.class, ICMP_INDEX), pair(Tcp.class, TCP_INDEX), - pair(Udp.class, UDP_INDEX), pair(IcmpV6.class, ICMPV6_INDEX)); - - class ProtocolPair { - private final Class<? extends IpProtocol> protocolClass; - private final int index; + short MAX_PORT_NUMBER = (short) 65535; - private ProtocolPair(final Class<? extends IpProtocol> protocolClass, final int index) { - this.protocolClass = protocolClass; - this.index = index; - } - - static ProtocolPair pair(@Nonnull final Class<? extends IpProtocol> protocolClass, @Nonnull final int index) { - return new ProtocolPair(protocolClass, index); - } + static AclRule bindIcmpVppFields(AclRule rule, Icmp icmp) { + VppIcmpAceAugmentation vppIcmp = icmp.augmentation(VppIcmpAceAugmentation.class); + Preconditions.checkNotNull(vppIcmp.getVppIcmpAce(), "Cannot determine VPP ICMP attributes!"); + final ValueRange typesRange = vppIcmp.getVppIcmpAce().getIcmpTypeRange(); + final ValueRange codesRange = vppIcmp.getVppIcmpAce().getIcmpCodeRange(); - boolean match(@Nonnull final Class<? extends IpProtocol> protocolClass) { - return this.protocolClass.isAssignableFrom(protocolClass); + if (typesRange != null) { + rule.srcportOrIcmptypeFirst = Preconditions.checkNotNull(typesRange.getFirst()); + rule.srcportOrIcmptypeLast = Preconditions.checkNotNull(typesRange.getLast()); } - int getIndex() { - return this.index; + if (codesRange != null) { + rule.dstportOrIcmpcodeFirst = Preconditions.checkNotNull(codesRange.getFirst()); + rule.dstportOrIcmpcodeLast = Preconditions.checkNotNull(codesRange.getLast()); } - } - - static byte protocol(final IpProtocol ipProtocol) { - final Optional<ProtocolPair> optPair = PROTOCOL_PAIRS.stream() - .filter(protocolPair -> protocolPair.match(ipProtocol.getClass())) - .findAny(); - - if (!optPair.isPresent()) { - if (Other.class.isAssignableFrom(ipProtocol.getClass())) { - return Other.class.cast(ipProtocol).getOtherNodes().getProtocol().byteValue(); - } - - throw new IllegalArgumentException(String.format("Unsupported Protocol Type %s", ipProtocol.getClass())); - } - return (byte) optPair.get().getIndex(); - } - - static AclRule bindIcmpNodes(AclRule rule, VppAce ace) { - final VppAceNodes vppAceNodes = ace.getVppAceNodes(); - checkArgument(vppAceNodes.getIpProtocol() instanceof Icmp); - final IcmpNodes icmp = Icmp.class.cast(vppAceNodes.getIpProtocol()).getIcmpNodes(); - final ValueRange typesRange = icmp.getIcmpTypeRange(); - final ValueRange codesRange = icmp.getIcmpCodeRange(); - - rule.srcportOrIcmptypeFirst = typesRange.getFirst(); - rule.srcportOrIcmptypeLast = typesRange.getLast(); - rule.dstportOrIcmpcodeFirst = codesRange.getFirst(); - rule.dstportOrIcmpcodeLast = codesRange.getLast(); return rule; } - static AclRule bindIcmpv6Nodes(AclRule rule, VppAce ace) { - final VppAceNodes vppAceNodes = ace.getVppAceNodes(); - checkArgument(vppAceNodes.getIpProtocol() instanceof IcmpV6); - final IcmpV6Nodes icmpV6 = IcmpV6.class.cast(vppAceNodes.getIpProtocol()).getIcmpV6Nodes(); - final ValueRange typesRange = icmpV6.getIcmpTypeRange(); - final ValueRange codesRange = icmpV6.getIcmpCodeRange(); - - rule.srcportOrIcmptypeFirst = typesRange.getFirst(); - rule.srcportOrIcmptypeLast = typesRange.getLast(); - rule.dstportOrIcmpcodeFirst = codesRange.getFirst(); - rule.dstportOrIcmpcodeLast = codesRange.getLast(); - - return rule; - } - - static void bindSourcePortRange(@Nonnull final AclRule rule, @Nullable final SourcePortRange sourcePortRange) { + static void bindSourcePortRange(@Nonnull final AclRule rule, @Nullable final PortRangeOrOperator sourcePortRange) { // allow all ports by default: rule.srcportOrIcmptypeFirst = 0; rule.srcportOrIcmptypeLast = MAX_PORT_NUMBER; - if(sourcePortRange != null) { + if (sourcePortRange != null) { // lower port is mandatory - rule.srcportOrIcmptypeFirst = portNumber(sourcePortRange.getLowerPort()); + Preconditions.checkArgument(sourcePortRange instanceof Range); + Range portRange = (Range) sourcePortRange; + Preconditions.checkNotNull(portRange.getLowerPort(), "Lower port is mandatory!"); + rule.srcportOrIcmptypeFirst = portNumber(portRange.getLowerPort()); - if (sourcePortRange.getUpperPort() != null) { - rule.srcportOrIcmptypeLast = portNumber(sourcePortRange.getUpperPort()); + if (portRange.getUpperPort() != null) { + rule.srcportOrIcmptypeLast = portNumber(portRange.getUpperPort()); } else { // if upper port is missing, set lower port value as end of checked range: rule.srcportOrIcmptypeLast = rule.srcportOrIcmptypeFirst; @@ -143,17 +91,21 @@ public interface ProtoPreBindRuleProducer { } } - static void bindDestinationPortRange(@Nonnull final AclRule rule, @Nullable final DestinationPortRange destinationPortRange) { + static void bindDestinationPortRange(@Nonnull final AclRule rule, + @Nullable final PortRangeOrOperator destinationPortRange) { // allow all ports by default: rule.dstportOrIcmpcodeFirst = 0; rule.dstportOrIcmpcodeLast = MAX_PORT_NUMBER; - if(destinationPortRange != null) { + if (destinationPortRange != null) { // lower port is mandatory - rule.dstportOrIcmpcodeFirst = portNumber(destinationPortRange.getLowerPort()); + Preconditions.checkArgument(destinationPortRange instanceof Range); + Range portRange = (Range) destinationPortRange; + Preconditions.checkNotNull(portRange.getLowerPort(), "Lower port is mandatory!"); + rule.dstportOrIcmpcodeFirst = portNumber(portRange.getLowerPort()); - if (destinationPortRange.getUpperPort() != null) { - rule.dstportOrIcmpcodeLast = portNumber(destinationPortRange.getUpperPort()); + if (portRange.getUpperPort() != null) { + rule.dstportOrIcmpcodeLast = portNumber(portRange.getUpperPort()); } else { // if upper port is missing, set lower port value as end of checked range: rule.dstportOrIcmpcodeLast = rule.dstportOrIcmpcodeFirst; @@ -161,30 +113,78 @@ public interface ProtoPreBindRuleProducer { } } - static AclRule bindTcpNodes(AclRule rule, VppAce ace) { - final VppAceNodes vppAceNodes = ace.getVppAceNodes(); - checkArgument(vppAceNodes.getIpProtocol() instanceof Tcp); + static AclRule bindTcpAttributes(AclRule rule, Tcp tcp) { + SourcePort srcPort = Preconditions.checkNotNull(tcp.getSourcePort()).getSourcePort(); + if (srcPort instanceof RangeOrOperator) { + bindSourcePortRange(rule, ((RangeOrOperator) srcPort).getPortRangeOrOperator()); + } - final TcpNodes tcp = Tcp.class.cast(vppAceNodes.getIpProtocol()).getTcpNodes(); - bindSourcePortRange(rule, tcp.getSourcePortRange()); - bindDestinationPortRange(rule, tcp.getDestinationPortRange()); + DestinationPort dstPort = Preconditions.checkNotNull(tcp.getDestinationPort()).getDestinationPort(); + if (dstPort instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.tcp.tcp.destination.port.destination.port.RangeOrOperator) { + bindDestinationPortRange(rule, + ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.tcp.tcp.destination.port.destination.port.RangeOrOperator) dstPort) + .getPortRangeOrOperator()); + } + AclTcpHeaderFields.Flags flags = tcp.getFlags(); - if(tcp.getTcpFlagsMask() != null) { - rule.tcpFlagsMask = tcp.getTcpFlagsMask().byteValue(); + if (flags != null) { + rule.tcpFlagsValue = parseTcpFlagsValue(flags); } - if(tcp.getTcpFlagsValue() != null) { - rule.tcpFlagsValue = tcp.getTcpFlagsValue().byteValue(); + + VppTcpAceAugmentation vppTcpAceAugmentation = tcp.augmentation(VppTcpAceAugmentation.class); + if (vppTcpAceAugmentation != null && vppTcpAceAugmentation.getVppTcpAce() != null && + vppTcpAceAugmentation.getVppTcpAce().getFlagsMask() != null) { + rule.tcpFlagsMask = parseTcpFlagsMask(vppTcpAceAugmentation.getVppTcpAce().getFlagsMask()); } + return rule; } - static AclRule bindUdpNodes(AclRule rule, VppAce ace) { - final VppAceNodes vppAceNodes = ace.getVppAceNodes(); - checkArgument(vppAceNodes.getIpProtocol() instanceof Udp); + static byte parseTcpFlagsValue(AclTcpHeaderFields.Flags flags) { + int fin = flags.isFin() ? 1 : 0; + int syn = flags.isSyn() ? 1 : 0; + int rst = flags.isRst() ? 1 : 0; + int psh = flags.isPsh() ? 1 : 0; + int ack = flags.isAck() ? 1 : 0; + int urg = flags.isUrg() ? 1 : 0; + int ece = flags.isEce() ? 1 : 0; + int cwr = flags.isCwr() ? 1 : 0; + String strFlags = String.format("%d%d%d%d%d%d%d%d", fin, syn, rst, psh, ack, urg, ece, cwr); + return Byte.parseByte(strFlags, 2); + } + + static byte parseTcpFlagsMask( + org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.vpp.acl.rev181022.AclTcpHeaderFields.FlagsMask flags) { + int fin = flags.isFin() ? 1 : 0; + int syn = flags.isSyn() ? 1 : 0; + int rst = flags.isRst() ? 1 : 0; + int psh = flags.isPsh() ? 1 : 0; + int ack = flags.isAck() ? 1 : 0; + int urg = flags.isUrg() ? 1 : 0; + int ece = flags.isEce() ? 1 : 0; + int cwr = flags.isCwr() ? 1 : 0; + String strFlags = String.format("%d%d%d%d%d%d%d%d", fin, syn, rst, psh, ack, urg, ece, cwr); + return Byte.parseByte(strFlags, 2); + } + + static AclRule bindUdpAttributes(AclRule rule, Udp udp) { + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.udp.source.port.SourcePort + srcPort = Preconditions.checkNotNull(udp.getSourcePort()).getSourcePort(); + + if (srcPort instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.udp.source.port.source.port.RangeOrOperator) { + bindSourcePortRange(rule, + ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.udp.source.port.source.port.RangeOrOperator) srcPort) + .getPortRangeOrOperator()); + } + + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.udp.destination.port.DestinationPort + dstPort = Preconditions.checkNotNull(udp.getDestinationPort()).getDestinationPort(); - final UdpNodes udp = Udp.class.cast(vppAceNodes.getIpProtocol()).getUdpNodes(); - bindSourcePortRange(rule, udp.getSourcePortRange()); - bindDestinationPortRange(rule, udp.getDestinationPortRange()); + if (dstPort instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.udp.destination.port.destination.port.RangeOrOperator) { + bindDestinationPortRange(rule, + ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.udp.udp.destination.port.destination.port.RangeOrOperator) dstPort) + .getPortRangeOrOperator()); + } return rule; } @@ -208,39 +208,56 @@ public interface ProtoPreBindRuleProducer { * @param vppAce rule to be processed * @return AclRule with protocol filled protocol fields */ - default AclRule createPreBindRule(@Nonnull final VppAce vppAce) { + default AclRule createPreBindRule(@Nonnull final Ace vppAce) { AclRule rule = new AclRule(); - - final IpProtocol ipProtocol = vppAce.getVppAceNodes().getIpProtocol(); - if (ipProtocol == null) { + L4 l4 = Preconditions.checkNotNull(vppAce.getMatches(), "Matches are not defined for ACE: {}!", vppAce).getL4(); + if (l4 == null) { // returns AclRule with rule.proto set to 0 (protocol fields will be ignored by vpp) return rule; } - rule.proto = protocol(ipProtocol); - - switch (rule.proto) { - case ICMP_INDEX: { - return bindIcmpNodes(rule, vppAce); - } - - case TCP_INDEX: { - return bindTcpNodes(rule, vppAce); - } - - case UDP_INDEX: { - return bindUdpNodes(rule, vppAce); - } + if (l4.getImplementedInterface() + .equals(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Icmp.class)) { + return getIcmpAclRule(vppAce, rule, + (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Icmp) l4); + } else if (l4.getImplementedInterface() + .equals(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Tcp.class)) { + return getTcpAclRule(rule, + (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Tcp) l4); + } else if (l4.getImplementedInterface() + .equals(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Udp.class)) { + return getUdpAclRule(rule, + (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Udp) l4); + } else { + return bindDefaultNodes(rule); + } + } - case ICMPV6_INDEX: { - return bindIcmpv6Nodes(rule, vppAce); - } - default: { - return bindDefaultNodes(rule); - } + default AclRule getIcmpAclRule(@Nonnull final Ace vppAce, final AclRule rule, + final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Icmp l4) { + if (vppAce.getMatches().getL3() == null) { + rule.proto = ICMP_INDEX; + } else { + Class<? extends DataContainer> ipVersion = vppAce.getMatches().getL3().getImplementedInterface(); + rule.proto = (byte) (ipVersion.equals(Ipv6.class) ? ICMPV6_INDEX : ICMP_INDEX); } + Icmp icmp = l4.getIcmp(); + return icmp != null ? bindIcmpVppFields(rule, icmp) : bindDefaultNodes(rule); } + default AclRule getUdpAclRule(final AclRule rule, + final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Udp l4) { + rule.proto = UDP_INDEX; + Udp udp = l4.getUdp(); + return udp != null ? bindUdpAttributes(rule, udp) : bindDefaultNodes(rule); + } + + default AclRule getTcpAclRule(final AclRule rule, + final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev181001.acls.acl.aces.ace.matches.l4.Tcp l4) { + rule.proto = TCP_INDEX; + Tcp tcp = l4.getTcp(); + return tcp != null ? bindTcpAttributes(rule, tcp) : bindDefaultNodes(rule); + } } |