/** * Return the flow cookie configured in the given instance. * * @param cookie A flow cookie. * @return The cookie value configured in {@code cookie}. */ public static BigInteger getCookie(FlowCookie cookie) { BigInteger value = (cookie == null) ? null : cookie.getValue(); return (value == null) ? COOKIE_DEFAULT : value; }
public GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder setCookieMask(FlowCookie value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _cookieMask_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _cookieMask_range)); } } this._cookieMask = value; return this; } public static List<Range<BigInteger>> _cookieMask_range() {
public GetFlowStatisticsFromFlowTableInputBuilder setCookieMask(FlowCookie value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _cookieMask_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _cookieMask_range)); } } this._cookieMask = value; return this; } public static List<Range<BigInteger>> _cookieMask_range() {
public FlowAndStatisticsMapListBuilder setCookieMask(FlowCookie value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _cookieMask_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _cookieMask_range)); } } this._cookieMask = value; return this; } public static List<Range<BigInteger>> _cookieMask_range() {
public GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder setCookie(FlowCookie value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _cookie_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _cookie_range)); } } this._cookie = value; return this; } public static List<Range<BigInteger>> _cookie_range() {
public GetFlowStatisticsFromFlowTableInputBuilder setCookie(FlowCookie value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _cookie_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _cookie_range)); } } this._cookie = value; return this; } public static List<Range<BigInteger>> _cookie_range() {
public FlowAndStatisticsMapListBuilder setCookie(FlowCookie value) { if (value != null) { BigInteger _constraint = value.getValue(); boolean isValidRange = false; for (Range<BigInteger> r : _cookie_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _cookie_range)); } } this._cookie = value; return this; } public static List<Range<BigInteger>> _cookie_range() {
/** * build pseudoUnique hashCode for flow in table * for future easy identification * * FIXME: we expect same version for YANG models for all clusters and that has to be fix * FIXME: CREATE BETTER KEY - for flow (MATCH is the problem) */ static String buildFlowIdOperKey(final FlowAndStatisticsMapList deviceFlow) { return new StringBuilder().append(deviceFlow.getMatch()) .append(deviceFlow.getPriority()).append(deviceFlow.getCookie().getValue()).toString(); }
/** * Create a MD-SAL transaction URI for the given flow entryu. * * @param vfent A {@link VtnFlowEntry} instance. * @param prefix Prefix of the URI. * @return An {@link Uri} instance. */ public static Uri createTxUri(VtnFlowEntry vfent, String prefix) { StringBuilder builder = new StringBuilder(prefix); BigInteger cookie = vfent.getCookie().getValue(); builder.append(Long.toHexString(cookie.longValue())). append('-').append(vfent.getOrder()); return new Uri(builder.toString()); }
/** * build pseudoUnique hashCode for flow in table * for future easy identification * * FIXME: we expect same version for YANG models for all clusters and that has to be fix * FIXME: CREATE BETTER KEY - for flow (MATCH is the problem) */ static String buildFlowIdOperKey(final FlowAndStatisticsMapList deviceFlow) { return new StringBuffer().append(deviceFlow.getMatch()) .append(deviceFlow.getPriority()).append(deviceFlow.getCookie().getValue()).toString(); }
/** * Return the VTN flow ID embedded in the given flow cookie. * * @param cookie A {@link FlowCookie} instance. * @return A {@link VtnFlowId} instance on success. * {@code null} on failure. */ public static VtnFlowId getVtnFlowId(FlowCookie cookie) { if (cookie == null) { return null; } long value = cookie.getValue().longValue(); if ((value & COOKIE_MASKVAL_VTN) != COOKIE_BITS_VTN) { return null; } long id = (value & ~COOKIE_MASKVAL_VTN); return new VtnFlowId(NumberUtils.getUnsigned(id)); }
private static void salToOFFlowCookieMask(Flow flow, FlowModInputBuilder flowMod) { if (flow.getCookieMask() != null) { flowMod.setCookieMask(flow.getCookieMask().getValue()); } else { flowMod.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK); } }
private static void salToOFFlowCookie(Flow flow, FlowModInputBuilder flowMod) { if (flow.getCookie() != null) { flowMod.setCookie(flow.getCookie().getValue()); } else { flowMod.setCookie(OFConstants.DEFAULT_COOKIE); } }
/** * @param source * @param target */ private static void genericFlowToAdFlow(GenericFlowAttributes source, final Flow target) { Integer hardTimeout = source.getHardTimeout(); if (hardTimeout != null) { target.setHardTimeout(hardTimeout.shortValue()); } Integer idleTimeout = source.getIdleTimeout(); if (idleTimeout != null) { target.setIdleTimeout(idleTimeout.shortValue()); } Integer priority = source.getPriority(); if (priority != null) { target.setPriority(priority.shortValue()); } target.setId(source.getCookie().getValue().longValue()); }
/** * {@inheritDoc} */ @Override public void flowStatsReceived(FlowAndStatisticsMap fstats) { FlowCookie cookie = fstats.getCookie(); if (cookie != null) { Long time = System.currentTimeMillis(); GenericStatistics gen = fstats; FlowStatsRecord fsr = new FlowStatsRecordBuilder(gen). setTime(time).build(); getFuture(cookie.getValue()).set(fsr); } }
BigInteger cookie = flowEntry.getCookie().getValue(); Match match = flowEntry.getMatch(); String ingress;
/** * Return a future associated with the task to read flow statistics * about the given VTN flow entry. * * @param vfent The target flow entry. * @return A {@link VTNFuture} instance which returns the flow statistics * about the specified flow entry. */ public VTNFuture<FlowStatsRecord> get(VtnFlowEntry vfent) { assert vfent.getNode().equals(targetNode.getNodeId()); BigInteger cookie = vfent.getCookie().getValue(); SettableVTNFuture<FlowStatsRecord> f = getFuture(cookie); if (txState.get() >= STATE_COMPLETED) { // No more statistics will be received. f.set(null); } return f; }
FlowCookie cookieMask = updated.getCookieMask(); if (cookieMask != null) { BigInteger mask = cookieMask.getValue(); if (mask != null && !mask.equals(BigInteger.ZERO)) { updCookie = uc.getValue(); } else { orgCookie = oc.getValue(); updCookie = (uc == null) ? OFConstants.DEFAULT_COOKIE : uc.getValue();