public static Dscp getDefaultInstance(String defaultValue) { return new Dscp(Short.valueOf(defaultValue)); }
@ConstructorProperties("value") public Dscp(java.lang.Short _value) { if (_value != null) { check_valueRange(_value); } Preconditions.checkNotNull(_value, "Supplied value may not be null"); this._value = _value; }
public IpMatchBuilder setIpDscp(Dscp value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value.getValue()); boolean isValidRange = false; for (Range<BigInteger> r : _ipDscp_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _ipDscp_range)); } } this._ipDscp = value; return this; } public static List<Range<BigInteger>> _ipDscp_range() {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_ipDscp == null) ? 0 : _ipDscp.hashCode()); result = prime * result + ((_ipEcn == null) ? 0 : _ipEcn.hashCode()); result = prime * result + ((_ipProto == null) ? 0 : _ipProto.hashCode()); result = prime * result + ((_ipProtocol == null) ? 0 : _ipProtocol.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); return result; }
return false; } else if(!_ipDscp.equals(other.getIpDscp())) { return false;
public static Dscp getDefaultInstance(String defaultValue) { return new Dscp(java.lang.Short.valueOf(defaultValue)); }
@ConstructorProperties("value") public Dscp(java.lang.Short _value) { if (_value != null) { check_valueRange(_value); } Preconditions.checkNotNull(_value, "Supplied value may not be null"); this._value = _value; }
private static void fillFrom(Match target, IpMatch ipMatch) { if (ipMatch != null) { Short ipProtocol = ipMatch.getIpProtocol(); if (ipProtocol != null && target.getField(NW_PROTO) == null) { target.setField(NW_PROTO, ipProtocol.byteValue()); } Dscp dscp = ipMatch.getIpDscp(); if (dscp != null) { Short dscpValue = dscp.getValue(); if (dscpValue != null) { target.setField(NW_TOS, dscpValue.byteValue()); } } } }
/** * Add a DSCP match to an existing match * @param matchBuilder Map matchBuilder MatchBuilder Object with a match * @param dscpValue * @return {@link MatchBuilder} */ public static MatchBuilder addDscp(MatchBuilder matchBuilder, short dscpValue) { createEtherTypeMatch(matchBuilder, new EtherType(ETHERTYPE_IPV4)); return matchBuilder.setIpMatch( new IpMatchBuilder() .setIpDscp(new Dscp(dscpValue)) .build()); }
private static IpMatch ipMatch(final Match sourceMatch) { IpMatchBuilder targetIpMatchBuild = new IpMatchBuilder(); MatchField networkTos = sourceMatch.getField(MatchType.NW_TOS); if (networkTos != null && networkTos.getValue() != null) { Dscp dscp = new Dscp( (short) (NetUtils.getUnsignedByte((Byte) networkTos .getValue()))); targetIpMatchBuild.setIpDscp(dscp); } MatchField protocol = sourceMatch.getField(MatchType.NW_PROTO); if (protocol != null && protocol.getValue() != null) { targetIpMatchBuild.setIpProtocol((short) ((byte) protocol .getValue())); } if((networkTos != null && networkTos.getValue() != null) || (protocol != null && protocol.getValue() != null)) { return targetIpMatchBuild.build(); } return null; }