public EthernetDestination build() { return new EthernetDestinationImpl(this); }
public EthernetType build() { return new EthernetTypeImpl(this); }
public EthernetSource build() { return new EthernetSourceImpl(this); }
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(); }
/** * 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(); }
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; } }
public EthernetTypeBuilder(EthernetType base) { this._type = base.getType(); if (base instanceof EthernetTypeImpl) { EthernetTypeImpl _impl = (EthernetTypeImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
public EthernetSourceBuilder(EthernetSource base) { this._address = base.getAddress(); this._mask = base.getMask(); if (base instanceof EthernetSourceImpl) { EthernetSourceImpl _impl = (EthernetSourceImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
public EthernetDestinationBuilder(EthernetDestination base) { this._address = base.getAddress(); this._mask = base.getMask(); if (base instanceof EthernetDestinationImpl) { EthernetDestinationImpl _impl = (EthernetDestinationImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
private static boolean convertEthernetDlSrc(final MatchV10Builder matchBuilder, final EthernetMatch ethernetMatch) { if (ethernetMatch.getEthernetSource() != null) { matchBuilder.setDlSrc(ethernetMatch.getEthernetSource().getAddress()); return false; } return true; }
private static boolean convertEthernetDlDst(final MatchV10Builder matchBuilder, final EthernetMatch ethernetMatch) { if (ethernetMatch.getEthernetDestination() != null) { matchBuilder.setDlDst(ethernetMatch.getEthernetDestination().getAddress()); return false; } return true; }
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(); } }
/** * 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(); }
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; }
/** * Return the ethernet type in the given {@link EthernetType} instance. * * @param etype An {@link EthernetType} instance. * @return An {@link Integer} instance if the ethernet type is present * in the given {@link EthernetType} instance. * Otherwise {@code null}. * @throws RpcException The given ethernet type is invalid. */ public static Integer getEtherType(EthernetType etype) throws RpcException { return (etype == null) ? null : getEtherType(etype.getType()); }
private boolean matchEthernetSrc(EthernetSource ethSrc, MatchFields matchFields) { return (ethSrc == null) || matchMacAddressWithMask(ethSrc.getAddress(), matchFields.srcMac, ethSrc.getMask()); }
private boolean matchEthernetDst(EthernetDestination ethDest, MatchFields matchFields) { return (ethDest == null) || matchMacAddressWithMask(ethDest.getAddress(), matchFields.dstMac, ethDest.getMask()); }
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 void equalOrNotSetValidation(EthernetType ethTypeInMatch, long paramValue) { if (ethTypeInMatch != null) { if (paramValue != ethTypeInMatch.getType().getValue()) { throw new IllegalArgumentException(MSG_CLASSIFICATION_CONFLICT_DETECTED + " at " + EtherTypeClassifierDefinition.ETHERTYPE_PARAM + " parameter for values " + ethTypeInMatch.getType().getValue() + " and " + paramValue + ". It is not allowed " + "to assign different values to the same parameter among all the classifiers within one rule."); } } }
private boolean matchEthernetType(EthernetType ethernetType, MatchFields matchFields) { return (ethernetType == null) || (matchFields.ethernetType != null && ethernetType.getType().getValue().longValue() == matchFields.ethernetType.longValue()); }