public static void addMatchDstMac(MatchBuilder match, final String dstMac) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(new MacAddress(dstMac)); ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); match.setEthernetMatch(mergeEthernetMatch(match, ethernetMatch)); }
/** * Create Ethernet Destination Match * * @param matchBuilder MatchBuilder Object without a match yet * @param dMacAddr String representing a destination MAC * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createDestEthMatch(MatchBuilder matchBuilder, MacAddress dMacAddr, MacAddress mask) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(dMacAddr); if (mask != null) { ethDestinationBuilder.setMask(mask); } ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
/** * 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 Ethernet Destination Match * * @param matchBuilder MatchBuilder Object without a match yet * @param dMacAddr String representing a destination MAC * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createEthDstMatch(MatchBuilder matchBuilder, MacAddress dMacAddr, MacAddress mask) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(new MacAddress(dMacAddr)); if (mask != null) { ethDestinationBuilder.setMask(mask); } ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
/** * 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(); }
@Override public Optional<MatchBuilder> process(@Nonnull EthDstCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) { final MatchBuilder matchBuilder = data.getMatchBuilder(); final EthernetMatchBuilder ethMatchBuilder = data.getEthernetMatchBuilder(); final EthDst ethDstCase = source.getEthDst(); if (ethDstCase != null) { EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(ethDstCase.getMacAddress()); byte[] destinationMask = ethDstCase.getMask(); if (destinationMask != null) { ethDestinationBuilder.setMask(new MacAddress(macAddressToString(destinationMask))); } ethMatchBuilder.setEthernetDestination(ethDestinationBuilder.build()); matchBuilder.setEthernetMatch(ethMatchBuilder.build()); } return Optional.of(matchBuilder); } }
/** * Create Ethernet Source Match * * @param matchBuilder MatchBuilder Object without a match yet * @param srcMac String representing a source MAC * @param dstMac String representing a destination MAC * @return matchBuilder Map MatchBuilder Object with a match */ public static MatchBuilder createEthMatch(MatchBuilder matchBuilder, MacAddress srcMac, MacAddress dstMac) { Preconditions.checkNotNull(matchBuilder); EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); if (srcMac != null) { EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); ethSourceBuilder.setAddress(srcMac); ethernetMatch.setEthernetSource(ethSourceBuilder.build()); } if (dstMac != null) { EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(dstMac); ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); } matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
private static MatchBuilder createEthernetMatch() { final MatchBuilder match = new MatchBuilder(); final EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype // match final EthernetTypeBuilder ethtype = new EthernetTypeBuilder(); final EtherType type = new EtherType(0x0800L); ethmatch.setEthernetType(ethtype.setType(type).build()); final EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet // macaddress // match final MacAddress macdest = new MacAddress(DEST_MAC_ADDRESS); ethdest.setAddress(macdest); ethdest.setMask(new MacAddress("ff:ff:ff:00:00:00")); ethmatch.setEthernetDestination(ethdest.build()); final EthernetSourceBuilder ethsrc = new EthernetSourceBuilder(); final MacAddress macsrc = new MacAddress(SRC_MAC_ADDRESS); ethsrc.setAddress(macsrc); ethsrc.setMask(new MacAddress("ff:ff:00:00:00:00")); ethmatch.setEthernetSource(ethsrc.build()); match.setEthernetMatch(ethmatch.build()); return match; }
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(); }
/** * Broadcast flow for destination mapper * * @param priority of the flow * @param ordinals of the endpoint (input parameter in {@link DestinationMapper#sync(Endpoint, OfWriter)}) * @param mac address of the multicast router {@link DestinationMapper#MULTICAST_MAC} * @param ofWriter flow writer */ void createBroadcastFlow(int priority, OrdinalFactory.EndpointFwdCtxOrdinals ordinals, MacAddress mac, OfWriter ofWriter) { MatchBuilder matchBuilder = new MatchBuilder() .setEthernetMatch(new EthernetMatchBuilder() .setEthernetDestination(new EthernetDestinationBuilder().setAddress(mac).setMask(mac).build()) .build()); addNxRegMatch(matchBuilder, FlowUtils.RegMatch.of(NxmNxReg5.class, (long) ordinals.getFdId())); Match match = matchBuilder.build(); FlowId flowId = FlowIdUtils.newFlowId(tableId, "broadcast", match); FlowBuilder flowBuilder = base(tableId) .setPriority(priority) .setId(flowId) .setMatch(match) .setInstructions(instructions(applyActionIns(nxLoadTunIdAction(BigInteger .valueOf(ordinals.getFdId()), false), groupAction((long) ordinals.getFdId())))); ofWriter.writeFlow(nodeId, tableId, flowBuilder.build()); }
public static Action createActionSetDlDst(String dstMac, int order) { EthernetDestinationBuilder ethDst = new EthernetDestinationBuilder(); ethDst.setAddress(new MacAddress(dstMac)); EthernetMatchBuilder ethMatchBuilder = new EthernetMatchBuilder(); ethMatchBuilder.setEthernetDestination(ethDst.build()); SetFieldCaseBuilder setFieldCase = new SetFieldCaseBuilder(); setFieldCase.setSetField( new SetFieldBuilder().setEthernetMatch(ethMatchBuilder.build()) .build()); ActionBuilder ab = createActionBuilder(order); ab.setAction(setFieldCase.build()); return ab.build(); }
EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(dMacAddr); if (mask != null) { ethDestinationBuilder.setMask(mask); ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build());
private Match createMacMatch(MacAddress srcMac, MacAddress dstMac) { EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder(); if (dstMac != null) { ethernetMatchBuilder.setEthernetDestination(new EthernetDestinationBuilder() .setAddress(dstMac) .build()); } if (srcMac != null) { ethernetMatchBuilder.setEthernetSource(new EthernetSourceBuilder() .setAddress(srcMac) .build()); } EthernetMatch ethernetMatch = ethernetMatchBuilder.build(); if (ethernetMatch != null) { return new MatchBuilder() .setEthernetMatch(ethernetMatch) .build(); } else { return null; } }
EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder(); ethDestinationBuilder.setAddress(new MacAddress(dMacAddr)); if (mask != null) { ethDestinationBuilder.setMask(mask); ethernetMatch.setEthernetDestination(ethDestinationBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build());
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(); } }
EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder(); ethDestBuilder.setAddress(dMacAddr); if (mask != null) { ethDestBuilder.setMask(mask); ethernetMatch.setEthernetDestination(ethDestBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build());
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(); }
EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder(); ethDestBuilder.setAddress(new MacAddress(dMacAddr)); if (mask != null) { ethDestBuilder.setMask(mask); ethernetMatch.setEthernetDestination(ethDestBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build());
public static MatchBuilder createEthSrcDstMatch(MatchBuilder matchBuilder, MacAddress srcMac, MacAddress dstMac) { EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); if (srcMac != null) { EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); ethSourceBuilder.setAddress(srcMac); ethernetMatch.setEthernetSource(ethSourceBuilder.build()); } if (dstMac != null) { EthernetDestinationBuilder ethDestinationBuild = new EthernetDestinationBuilder(); ethDestinationBuild.setAddress(dstMac); ethernetMatch.setEthernetDestination(ethDestinationBuild.build()); } if (matchBuilder.getEthernetMatch() != null && matchBuilder.getEthernetMatch().getEthernetType() != null) { ethernetMatch.setEthernetType(matchBuilder.getEthernetMatch().getEthernetType()); } matchBuilder.setEthernetMatch(ethernetMatch.build()); return matchBuilder; }
EthernetDestinationBuilder ethDestBuilder = new EthernetDestinationBuilder(); ethDestBuilder.setAddress(new MacAddress(dstMac)); if (mask != null) { ethDestBuilder.setMask(mask); ethernetMatch.setEthernetDestination(ethDestBuilder.build()); matchBuilder.setEthernetMatch(ethernetMatch.build());