/** * Creates {@link EthernetMatch} containing ARP ether-type and the given destination MAC address * @return EthernetMatch */ public static EthernetMatch createEthernetMatch() { return new EthernetMatchBuilder().setEthernetType( new EthernetTypeBuilder().setType(new EtherType(Long.valueOf(EtherTypes.ARP.intValue()))).build()) .build(); }
/** * Creates {@link EthernetMatch} containing ARP ether-type */ public static EthernetMatch createEthernetMatch() { return new EthernetMatchBuilder().setEthernetType( new EthernetTypeBuilder().setType(new EtherType(Long.valueOf(EtherTypes.ARP.intValue()))).build()) .build(); }
@Override public Optional<MatchBuilder> process(@Nonnull EthTypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) { final MatchBuilder matchBuilder = data.getMatchBuilder(); final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder(); final EthType ethTypeCase = source.getEthType(); if (ethTypeCase != null) { EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType((long) ethTypeCase.getEthType().getValue())); ethMatchBuilder.setEthernetType(ethTypeBuilder.build()); matchBuilder.setEthernetMatch(ethMatchBuilder.build()); } return Optional.of(matchBuilder); } }
/** * Add an etherType match to an existing MatchBuilder * @param match * @param etherType */ public static void addMatchEtherType(MatchBuilder match, final long etherType) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(etherType)); ethernetMatch.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(mergeEthernetMatch(match, ethernetMatch)); }
/** * Creates {@link EthernetMatch} containing ARP ether-type and the given destination MAC address * * @param destinationMacAddress the destination MAC address * @return {@link EthernetMatch} */ public static EthernetMatch createEthernetMatch(MacAddress destinationMacAddress) { return new EthernetMatchBuilder().setEthernetType( new EthernetTypeBuilder().setType(new EtherType(Long.valueOf(EtherTypes.ARP.intValue()))).build()) .setEthernetDestination(new EthernetDestinationBuilder().setAddress(destinationMacAddress).build()) .build(); }
/** * Create EtherType Match * * @param matchBuilder Map matchBuilder MatchBuilder Object without a match * @param etherType Long EtherType * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createEtherTypeMatch(MatchBuilder matchBuilder, EtherType etherType) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(etherType)); ethernetMatch.setEthernetType(ethTypeBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
/** * Create EtherType Match * * @param matchBuilder Map matchBuilder MatchBuilder Object without a match * @param etherType Long EtherType * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createEtherTypeMatch(MatchBuilder matchBuilder, Long etherType) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(etherType)); ethernetMatch.setEthernetType(ethTypeBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
/** * Create EtherType Match * * @param matchBuilder Map matchBuilder MatchBuilder Object without a match * @param etherType Long EtherType * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createEtherTypeMatch(MatchBuilder matchBuilder, Long etherType) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(etherType)); ethernetMatch.setEthernetType(ethTypeBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
private static MatchBuilder createLLDPMatch() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder eth = new EthernetMatchBuilder(); final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x88ccL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
private static MatchBuilder createLLDPMatch() { MatchBuilder match = new MatchBuilder(); EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x88ccL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
@Override protected List<MatchBuilder> update(List<MatchBuilder> matches, Map<String, ParameterValue> params) { Long type = params.get(EtherTypeClassifierDefinition.ETHERTYPE_PARAM).getIntValue(); for (MatchBuilder match : matches) { EthernetMatchBuilder em; if (match.getEthernetMatch() != null) { equalOrNotSetValidation(match.getEthernetMatch().getEthernetType(), type); continue; } else { em = new EthernetMatchBuilder(); } em.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(type)).build()); match.setEthernetMatch(em.build()); } return matches; }
/** * Creates {@link EthernetMatch} containing ARP ether-type and the given destination MAC address */ public static EthernetMatch createEthernetMatch(MacAddress destinationMacAddress) { return new EthernetMatchBuilder().setEthernetType( new EthernetTypeBuilder().setType(new EtherType((long) EtherTypes.ARP.intValue())).build()) .setEthernetDestination(new EthernetDestinationBuilder().setAddress(destinationMacAddress).build()) .build(); }
public static void addMatchMplsLabel(MatchBuilder match, long label) { EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType((long) ETHERTYPE_MPLS_UCAST)); EthernetMatchBuilder eth = new EthernetMatchBuilder(); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); ProtocolMatchFieldsBuilder protomatch = new ProtocolMatchFieldsBuilder(); protomatch.setMplsLabel(label); match.setProtocolMatchFields(protomatch.build()); }
/** * @param matchBuilder MatchBuilder Object without a match yet * @param dstip String containing an IPv4 prefix * @return matchBuilder Map Object with a match */ public static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) { EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x0800L)); eth.setEthernetType(ethTypeBuilder.build()); matchBuilder.setEthernetMatch(eth.build()); Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder(); ipv4match.setIpv4Destination(dstip); matchBuilder.setLayer3Match(ipv4match.build()); return matchBuilder; }
/** * @param matchBuilder MatchBuilder Object without a match yet * @param srcip String containing an IPv4 prefix * @return matchBuilder Map Object with a match */ public static MatchBuilder createSrcL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix srcip) { EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(IPV4_LONG)); eth.setEthernetType(ethTypeBuilder.build()); matchBuilder.setEthernetMatch(eth.build()); Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder(); ipv4match.setIpv4Source(srcip); matchBuilder.setLayer3Match(ipv4match.build()); return matchBuilder; }
public static EthernetMatch ethernetMatch(MacAddress srcMac, MacAddress dstMac, Long etherType) { EthernetMatchBuilder emb = new EthernetMatchBuilder(); if (srcMac != null) emb.setEthernetSource(new EthernetSourceBuilder().setAddress(srcMac).build()); if (dstMac != null) emb.setEthernetDestination(new EthernetDestinationBuilder().setAddress(dstMac).build()); if (etherType != null) emb.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(etherType)).build()); return emb.build(); }
private static MatchBuilder createMatch33() { final MatchBuilder match = new MatchBuilder(); final Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); final Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10"); ipv4Match.setIpv4Source(prefix); final Ipv4Match i4m = ipv4Match.build(); match.setLayer3Match(i4m); final EthernetMatchBuilder eth = new EthernetMatchBuilder(); final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0xfffeL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
private static MatchBuilder createMatch1000() { MatchBuilder match = new MatchBuilder(); Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); Ipv4Prefix prefix = new Ipv4Prefix("10.1.1.1/24"); ipv4Match.setIpv4Destination(prefix); Ipv4Match i4m = ipv4Match.build(); match.setLayer3Match(i4m); EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x0800L)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
private static MatchBuilder createMatch33() { MatchBuilder match = new MatchBuilder(); Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.10"); ipv4Match.setIpv4Source(prefix); Ipv4Match i4m = ipv4Match.build(); match.setLayer3Match(i4m); EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0xfffeL)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); return match; }
private static MatchBuilder createMatchBld() { MatchBuilder match = new MatchBuilder(); Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24"); ipv4Match.setIpv4Destination(prefix); Ipv4Match i4m = ipv4Match.build(); match.setLayer3Match(i4m); EthernetMatchBuilder eth = new EthernetMatchBuilder(); EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); ethTypeBuilder.setType(new EtherType(0x0800L)); eth.setEthernetType(ethTypeBuilder.build()); match.setEthernetMatch(eth.build()); // AugmentTuple<Match> extAugmentWrapper = createNxMatchAugment(); // match.addAugmentation(extAugmentWrapper.getAugmentationClass(), extAugmentWrapper.getAugmentationObject()); return match; }