/** * Return a String representing the value of this union. * * @return String representation of this union's value. */ public String stringValue() { if (_vppDscpType != null) { return _vppDscpType.toString(); } if (_dscp != null) { return _dscp.getValue().toString(); } throw new IllegalStateException("No value assinged"); }
/** * Return the IP DSCP value in the given instance. * * @param vaction A {@link VtnSetInetDscpAction} instance. * @return IP DSCP value. */ private short getDscpValue(VtnSetInetDscpAction vaction) { if (vaction != null) { Dscp d = vaction.getDscp(); if (d != null) { Short v = d.getValue(); if (v != null) { return v.shortValue(); } } } return DEFAULT_VALUE; }
/** * Return the IP DSCP field value configured in the given {@link Dscp} * instance. * * @param dscp A {@link Dscp} instance. * @return A {@link Short} instance if the DSCP value is present in the * given {@link Dscp} instance. * Otherwise {@code null}. * @throws RpcException The given DSCP value is invalid. */ public static Short getIpDscp(Dscp dscp) throws RpcException { Short value = null; if (dscp != null) { value = dscp.getValue(); if (value != null) { // This check can be removed when RESTCONF implements the // restriction check. checkIpDscp(value.shortValue()); } } return value; }
@Override public void serialize(MatchEntry entry, ByteBuf outBuffer) { super.serialize(entry, outBuffer); IpDscpCase entryValue = (IpDscpCase) entry.getMatchEntryValue(); outBuffer.writeByte(entryValue.getIpDscp().getDscp().getValue()); }
private static boolean convertNwTos(final MatchV10Builder matchBuilder, final IpMatch ipMatch) { if (ipMatch.getIpDscp() != null) { matchBuilder.setNwTos(ActionUtil.dscpToTos(ipMatch.getIpDscp().getValue())); return false; } return true; }
@Override public Optional<MatchBuilder> process(@Nonnull IpDscpCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) { final MatchBuilder matchBuilder = data.getMatchBuilder(); final IpMatchBuilder ipMatchBuilder = data.getIpMatchBuilder(); IpDscp ipDscp = source.getIpDscp(); if (ipDscp != null) { ipMatchBuilder.setIpDscp(new Dscp(ipDscp.getDscp().getValue())); matchBuilder.setIpMatch(ipMatchBuilder.build()); } return Optional.of(matchBuilder); } }
private byte parseDscp(@Nonnull MeterActionParams actionParams) { final DscpType dscp = actionParams.getDscp(); if (dscp == null) { return 0; } final Class<? extends MeterActionType> meterActionType = actionParams.getMeterActionType(); checkArgument(MeterActionMarkDscp.class == meterActionType, "dcsp is supported only for meter-action-mark-dscp, but %s defined", meterActionType); if (dscp.getVppDscpType() != null) { return (byte) dscp.getVppDscpType().getIntValue(); } if (dscp.getDscp() != null) { return dscp.getDscp().getValue().byteValue(); } return 0; }
request.match[baseOffset + DSCP_OFFSET] = (byte) (DSCP_MASK & (aceIp.getDscp().getValue() << 2));
final int dscp = aceIp.getDscp().getValue();
AceIp aceIp = (AceIp) matches.getAceType(); if (aceIp.getDscp() != null) { matchesNode.put(_DSCP, aceIp.getDscp().getValue());
/** * @param order An integer representing the order of the Action * within the table. * @param dscp A DSCP value * @return Action with an order */ public static Action createQosNormal(int order, Dscp dscp) { short dscpValue = dscp.getValue(); Integer tos = Integer.valueOf(dscpToTos(dscpValue)); SetNwTosAction nw = new SetNwTosActionBuilder().setTos(tos).build(); return new ActionBuilder().setOrder(order) .setKey(new ActionKey(order)) .setAction(new SetNwTosActionCaseBuilder() .setSetNwTosAction(nw) .build()) .build(); }
private void addIpMatch() { AceIp aceIp = (AceIp)matches.getAceType(); if (aceIp.getDscp() != null) { MatchUtils.addDscp(matchBuilder, aceIp.getDscp().getValue()); } if (aceIp.getProtocol() != null) { addIpProtocolMatch(aceIp); } if (aceIp.getAceIpVersion() instanceof AceIpv4) { addIpV4Match(aceIp); } if (aceIp.getAceIpVersion() instanceof AceIpv6) { addIpV6Match(aceIp); } }