@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; }
@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; }
@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; }
@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; }
@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()) .setTableId(TableId.of(flowRule().type().ordinal())) .build(); return fm; }
public static short toWireValue(Set<OFFlowModFlags> set) { short wireValue = 0; for(OFFlowModFlags e: set) { switch(e) { case SEND_FLOW_REM: wireValue |= SEND_FLOW_REM_VAL; break; case CHECK_OVERLAP: wireValue |= CHECK_OVERLAP_VAL; break; case RESET_COUNTS: wireValue |= RESET_COUNTS_VAL; break; default: throw new IllegalArgumentException("Illegal enum value for type OFFlowModFlags in version 1.2: " + e); } } return wireValue; }
public static Set<OFFlowModFlags> ofWireValue(short val) { EnumSet<OFFlowModFlags> set = EnumSet.noneOf(OFFlowModFlags.class); if((val & SEND_FLOW_REM_VAL) != 0) set.add(OFFlowModFlags.SEND_FLOW_REM); if((val & CHECK_OVERLAP_VAL) != 0) set.add(OFFlowModFlags.CHECK_OVERLAP); if((val & RESET_COUNTS_VAL) != 0) set.add(OFFlowModFlags.RESET_COUNTS); if((val & NO_PKT_COUNTS_VAL) != 0) set.add(OFFlowModFlags.NO_PKT_COUNTS); if((val & NO_BYT_COUNTS_VAL) != 0) set.add(OFFlowModFlags.NO_BYT_COUNTS); if((val & BSN_SEND_IDLE_VAL) != 0) set.add(OFFlowModFlags.BSN_SEND_IDLE); return Collections.unmodifiableSet(set); }
public static short toWireValue(Set<OFFlowModFlags> set) { short wireValue = 0; for(OFFlowModFlags e: set) { switch(e) { case SEND_FLOW_REM: wireValue |= SEND_FLOW_REM_VAL; break; case CHECK_OVERLAP: wireValue |= CHECK_OVERLAP_VAL; break; case EMERG: wireValue |= EMERG_VAL; break; default: throw new IllegalArgumentException("Illegal enum value for type OFFlowModFlags in version 1.0: " + e); } } return wireValue; }
public static short toWireValue(Set<OFFlowModFlags> set) { short wireValue = 0; for(OFFlowModFlags e: set) { switch(e) { case SEND_FLOW_REM: wireValue |= SEND_FLOW_REM_VAL; break; case CHECK_OVERLAP: wireValue |= CHECK_OVERLAP_VAL; break; default: throw new IllegalArgumentException("Illegal enum value for type OFFlowModFlags in version 1.1: " + e); } } return wireValue; }
@Override public OFFlowMod buildFlowDel() { Match match = buildMatch(); long cookie = flowRule().id().value(); OFFlowDeleteStrict.Builder 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())); if (flowRule().timeout() != 0) { fm.setIdleTimeout(flowRule().timeout()); } else { fm.setHardTimeout(flowRule().hardTimeout()); } return fm.build(); }
@Override public OFFlowAdd buildFlowAdd() { Match match = buildMatch(); List<OFAction> actions = buildActions(); long cookie = flowRule().id().value(); OFFlowAdd.Builder 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()); if (flowRule().timeout() != 0) { fm.setIdleTimeout(flowRule().timeout()); } else { fm.setHardTimeout(flowRule().hardTimeout()); } return fm.build(); }
@Override public OFFlowMod buildFlowMod() { Match match = buildMatch(); List<OFAction> actions = buildActions(); long cookie = flowRule().id().value(); OFFlowMod.Builder 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()) .setPriority(flowRule().priority()); if (flowRule().timeout() != 0) { fm.setIdleTimeout(flowRule().timeout()); } else { fm.setHardTimeout(flowRule().hardTimeout()); } return fm.build(); }
@Override public OFFlowDelete buildFlowDel() { Match match = buildMatch(); long cookie = flowRule().id().value(); OFFlowDelete.Builder 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()); if (flowRule().timeout() != 0) { fm.setIdleTimeout(flowRule().timeout()); } else { fm.setHardTimeout(flowRule().hardTimeout()); } return fm.build(); }
@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())) .setHardTimeout(flowRule().hardTimeout()) .build(); return fm; }
@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()) .setHardTimeout(flowRule().hardTimeout()) .build(); return fm; }
@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()) .setHardTimeout(flowRule().hardTimeout()) .build(); return fm; }
@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()) .setHardTimeout(flowRule().hardTimeout()) .build(); return fm; }
/** * Sets defaults for an OFFlowMod used in the StaticFlowEntryPusher * @param fm The OFFlowMod to set defaults for * @param entryName The name of the entry. Used to compute the cookie. */ public static void initDefaultFlowMod(OFFlowMod.Builder fmb, String entryName) { fmb.setIdleTimeout(INFINITE_TIMEOUT) // not setting these would also work .setHardTimeout(INFINITE_TIMEOUT) .setBufferId(OFBufferId.NO_BUFFER) .setOutPort(OFPort.ANY) .setCookie(computeEntryCookie(0, entryName)) .setPriority(Integer.MAX_VALUE) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)); return; }
@Override public OFFlowAdd buildFlowAdd() { Match match = buildMatch(); List<OFAction> deferredActions = buildActions(treatment.deferred()); List<OFAction> immediateActions = buildActions(treatment.immediate()); List<OFInstruction> instructions = Lists.newLinkedList(); if (immediateActions.size() > 0) { instructions.add(factory().instructions().applyActions(immediateActions)); } if (treatment.clearedDeferred()) { instructions.add(factory().instructions().clearActions()); } if (deferredActions.size() > 0) { instructions.add(factory().instructions().writeActions(deferredActions)); } if (treatment.tableTransition() != null) { instructions.add(buildTableGoto(treatment.tableTransition())); } long cookie = flowRule().id().value(); OFFlowAdd fm = factory().buildFlowAdd() .setXid(xid) .setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setInstructions(instructions) .setMatch(match) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) .setPriority(flowRule().priority()) .setTableId(TableId.of(flowRule().type().ordinal())) .build(); return fm; }
@Override public OFFlowMod buildFlowMod() { Match match = buildMatch(); List<OFAction> deferredActions = buildActions(treatment.deferred()); List<OFAction> immediateActions = buildActions(treatment.immediate()); List<OFInstruction> instructions = Lists.newLinkedList(); if (immediateActions.size() > 0) { instructions.add(factory().instructions().applyActions(immediateActions)); } if (treatment.clearedDeferred()) { instructions.add(factory().instructions().clearActions()); } if (deferredActions.size() > 0) { instructions.add(factory().instructions().writeActions(deferredActions)); } if (treatment.tableTransition() != null) { instructions.add(buildTableGoto(treatment.tableTransition())); } long cookie = flowRule().id().value(); OFFlowMod fm = factory().buildFlowModify() .setXid(xid) .setCookie(U64.of(cookie)) .setBufferId(OFBufferId.NO_BUFFER) .setInstructions(instructions) .setMatch(match) .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM)) .setPriority(flowRule().priority()) .setTableId(TableId.of(flowRule().type().ordinal())) .build(); return fm; }
public static Set<OFFlowModFlags> readFrom(ChannelBuffer bb) throws OFParseError { try { return ofWireValue(bb.readShort()); } catch (IllegalArgumentException e) { throw new OFParseError(e); } }