@Override public Optional<Long> cookie() { checkPermission(PACKET_READ); if (pktin.getVersion() != OFVersion.OF_10) { return Optional.of(pktin.getCookie().getValue()); } else { return Optional.empty(); } }
private TableStatisticsEntry buildTableStatistics(DeviceId deviceId, OFTableStatsEntry ofEntry) { TableStatisticsEntry entry = null; if (ofEntry != null) { entry = new DefaultTableStatisticsEntry(deviceId, ofEntry.getTableId().getValue(), ofEntry.getActiveCount(), ofEntry.getLookupCount().getValue(), ofEntry.getMatchedCount().getValue()); } return entry; } }
@Override public OFFlowDelete buildFlowDel() { Match match = buildMatch(); long cookie = flowRule().id().value(); OFFlowDelete fm = factory().buildFlowDelete() .setXid(xid) .setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setMatch(match) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) .setPriority(flowRule().priority()) .build(); return fm; }
private Collection<PortStatistics> buildPortStatistics(DeviceId deviceId, List<OFPortStatsEntry> entries) { HashSet<PortStatistics> stats = Sets.newHashSet(); for (OFPortStatsEntry entry : entries) { try { if (entry == null || entry.getPortNo() == null || entry.getPortNo().getPortNumber() < 0) { continue; } DefaultPortStatistics.Builder builder = DefaultPortStatistics.builder(); DefaultPortStatistics stat = builder.setDeviceId(deviceId) .setPort(entry.getPortNo().getPortNumber()) .setPacketsReceived(entry.getRxPackets().getValue()) .setPacketsSent(entry.getTxPackets().getValue()) .setBytesReceived(entry.getRxBytes().getValue()) .setBytesSent(entry.getTxBytes().getValue()) .setPacketsRxDropped(entry.getRxDropped().getValue()) .setPacketsTxDropped(entry.getTxDropped().getValue()) .setPacketsRxErrors(entry.getRxErrors().getValue()) .setPacketsTxErrors(entry.getTxErrors().getValue()) .setDurationSec(entry.getVersion() == OFVersion.OF_10 ? 0 : entry.getDurationSec()) .setDurationNano(entry.getVersion() == OFVersion.OF_10 ? 0 : entry.getDurationNsec()) .build(); stats.add(stat); } catch (Exception e) { LOG.warn("Unable to process port stats", e); } } return Collections.unmodifiableSet(stats); }
.setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setInstructions(instructions)
DefaultGroup group = (DefaultGroup) groups.get(groupId); if (group != null) { group.setBytes(entry.getByteCount().getValue()); group.setLife(entry.getDurationSec()); group.setPackets(entry.getPacketCount().getValue()); group.setReferenceCount(entry.getRefCount()); int bucketIndex = 0; .get(bucketIndex)) .setPackets(bucketStats .getPacketCount().getValue()); ((StoredGroupBucketEntry) group.buckets().buckets() .get(bucketIndex)) .setBytes(entry.getBucketStats() .get(bucketIndex) .getByteCount().getValue()); bucketIndex++;
.setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setInstructions(instructions)
@Override public OFFlowAdd buildFlowAdd() { Match match = buildMatch(); List<OFAction> actions = buildActions(); long cookie = flowRule().id().value(); OFFlowAdd fm = factory().buildFlowAdd() .setXid(xid) .setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setActions(actions) .setMatch(match) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) .setPriority(flowRule().priority()) .build(); return fm; }
.withPriority(stat.getPriority()) .makeTemporary(stat.getIdleTimeout()) .withCookie(stat.getCookie().getValue()); if (stat.getVersion() != OFVersion.OF_10) { builder.forTable(stat.getTableId().getValue()); stat.getPacketCount().getValue(), stat.getByteCount().getValue()); case REMOVED: builder = DefaultFlowRule.builder() .withPriority(removed.getPriority()) .makeTemporary(removed.getIdleTimeout()) .withCookie(removed.getCookie().getValue()); if (removed.getVersion() != OFVersion.OF_10) { builder.forTable(removed.getTableId().getValue()); removed.getPacketCount().getValue(), removed.getByteCount().getValue()); case MOD: FlowEntryState flowState = state.length > 0 ? state[0] : FlowEntryState.FAILED; .withPriority(flowMod.getPriority()) .makeTemporary(flowMod.getIdleTimeout()) .withCookie(flowMod.getCookie().getValue()); if (flowMod.getVersion() != OFVersion.OF_10) { builder.forTable(flowMod.getTableId().getValue());
@Override public OFFlowMod buildFlowMod() { Match match = buildMatch(); List<OFAction> actions = buildActions(); long cookie = flowRule().id().value(); OFFlowMod fm = factory().buildFlowModify() .setXid(xid) .setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setActions(actions) .setMatch(match) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) .setPriority(flowRule().priority()) .build(); return fm; }
@SuppressWarnings("unchecked") OFOxm<U64> tunnelId = (OFOxm<U64>) oxm; builder.setTunnelId(tunnelId.getValue().getValue()); break; case TCP_DST:
@Override public OFFlowMod buildFlowDel() { Match match = buildMatch(); long cookie = flowRule().id().value(); OFFlowDeleteStrict fm = factory().buildFlowDeleteStrict() .setXid(xid) .setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setMatch(match) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) .setPriority(flowRule().priority()) .setTableId(TableId.of(flowRule().tableId())) .build(); return fm; }
L2ModificationInstruction.ModTunnelIdInstruction tunnelId = (L2ModificationInstruction.ModTunnelIdInstruction) l2m; oxm = factory.oxms().tunnelId(U64.of(tunnelId.tunnelId())); break; default:
case TUNNEL_ID: ModTunnelIdInstruction tunnelId = (ModTunnelIdInstruction) l2m; oxm = factory().oxms().tunnelId(U64.of(tunnelId.tunnelId())); break; default:
TunnelIdCriterion tunnelId = (TunnelIdCriterion) c; mBuilder.setExact(MatchField.TUNNEL_ID, U64.of(tunnelId.tunnelId())); break; case MPLS_BOS: