@Override public Optional<MatchBuilder> process(@Nonnull Icmpv6TypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) { final MatchBuilder matchBuilder = data.getMatchBuilder(); final Icmpv6MatchBuilder icmpv6MatchBuilder = data.getIcmpv6MatchBuilder(); Icmpv6Type icmpv6Type = source.getIcmpv6Type(); Short v6type = icmpv6Type.getIcmpv6Type(); if (v6type != null) { icmpv6MatchBuilder.setIcmpv6Type(v6type); matchBuilder.setIcmpv6Match(icmpv6MatchBuilder.build()); } return Optional.of(matchBuilder); } }
@Override public Optional<MatchBuilder> process(@Nonnull Icmpv6CodeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) { final MatchBuilder matchBuilder = data.getMatchBuilder(); final Icmpv6MatchBuilder icmpv6MatchBuilder = data.getIcmpv6MatchBuilder(); Icmpv6Code icmpv6Code = source.getIcmpv6Code(); Short v6code = icmpv6Code.getIcmpv6Code(); if (v6code != null) { icmpv6MatchBuilder.setIcmpv6Code(v6code); matchBuilder.setIcmpv6Match(icmpv6MatchBuilder.build()); } return Optional.of(matchBuilder); } }
/** * Match ICMPv6 code and type * * @param matchBuilder MatchBuilder Object * @param type short representing an ICMP type * @param code short representing an ICMP code * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createICMPv6Match(MatchBuilder matchBuilder, short type, short code) { // Build the IPv6 Match required per OVS Syntax IpMatchBuilder ipmatch = new IpMatchBuilder(); ipmatch.setIpProtocol((short) 58); matchBuilder.setIpMatch(ipmatch.build()); // Build the ICMPv6 Match Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); if (type != ALL_ICMP || code != ALL_ICMP) { icmpv6match.setIcmpv6Type(type); icmpv6match.setIcmpv6Code(code); } matchBuilder.setIcmpv6Match(icmpv6match.build()); return matchBuilder; }
/** * @return */ private static MatchBuilder createICMPv6Match() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder eth = new EthernetMatchBuilder(); final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x86ddL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); final IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version ipmatch.setIpProtocol((short) 58); match.setIpMatch(ipmatch.build()); final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6 // match icmpv6match.setIcmpv6Type((short) 135); icmpv6match.setIcmpv6Code((short) 1); match.setIcmpv6Match(icmpv6match.build()); return match; }
/** * @return */ private static MatchBuilder createICMPv6Match() { MatchBuilder match = new MatchBuilder(); EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x86ddL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version ipmatch.setIpProtocol((short) 58); match.setIpMatch(ipmatch.build()); Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6 // match icmpv6match.setIcmpv6Type((short) 135); icmpv6match.setIcmpv6Code((short) 1); match.setIcmpv6Match(icmpv6match.build()); return match; }
/** * @return */ private static MatchBuilder createICMPv6Match1() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder eth = new EthernetMatchBuilder(); final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x86ddL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); // ipv4 version final IpMatchBuilder ipmatch = new IpMatchBuilder(); ipmatch.setIpProtocol((short) 256); match.setIpMatch(ipmatch.build()); // icmpv6 final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // match icmpv6match.setIcmpv6Type((short) 135); icmpv6match.setIcmpv6Code((short) 1); match.setIcmpv6Match(icmpv6match.build()); return match; }
match.setIcmpv6Match(icmpv6match.build());
match.setIcmpv6Match(icmpv6match.build());