Java 类org.projectfloodlight.openflow.protocol.OFFlowDeleteStrict 实例源码

项目:athena    文件:FlowModBuilderVer13.java   
@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;
}
项目:Engine    文件:FlowModBuilderVer13.java   
@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();
}
项目:onos    文件:FlowModBuilderVer13.java   
@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;
}
项目:fresco_floodlight    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:fresco_floodlight    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:iTAP-controller    文件:StaticFlowEntryPusher.java   
@LogMessageDoc(level="ERROR",
        message="inconsistent internal state: no switch has rule {rule}",
        explanation="Inconsistent internat state discovered while " +
                "deleting a static flow rule",
                recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

    if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
        entriesFromStorage.get(dpid).remove(entryName);
    } else {
        log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
        return;
    }

    writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    return;
}
项目:iTAP-controller    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:iTAP-controller    文件:OFSwitchHandshakeHandler.java   
/** 
 * Adds an initial table-miss flow to each
 * and every table on the switch. This replaces the default behavior of
 * forwarding table-miss packets to the controller. The table-miss flows
 * inserted will forward all packets that do not match a flow to the 
 * controller for processing.
 * 
 * Adding the default flow only applies to OpenFlow 1.3+ switches, which 
 * remove the default forward-to-controller behavior of flow tables.
 */
private void addDefaultFlows() {
    /*
     * Only for OF1.3+, insert the default forward-to-controller flow for
     * each table. This is priority=0 with no Match.
     */
    if (this.sw.getOFFactory().getVersion().compareTo(OFVersion.OF_13) >= 0) {
        /*
         * Remove the default flow if it's present.
         */
        OFFlowDeleteStrict deleteFlow = this.factory.buildFlowDeleteStrict()
                .setTableId(TableId.ALL)
                .setOutPort(OFPort.CONTROLLER)
                .build();
        this.sw.write(deleteFlow);

        ArrayList<OFAction> actions = new ArrayList<OFAction>(1);
        actions.add(factory.actions().output(OFPort.CONTROLLER, 0xffFFffFF));
        ArrayList<OFMessage> flows = new ArrayList<OFMessage>();
        for (int tableId = 0; tableId < this.sw.getTables(); tableId++) {
            OFFlowAdd defaultFlow = this.factory.buildFlowAdd()
                    .setTableId(TableId.of(tableId))
                    .setPriority(0)
                    .setActions(actions)
                    .build();
            flows.add(defaultFlow);
        }
        this.sw.write(flows);
    }
}
项目:SDN-Multicast    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:SDN-Multicast    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:arscheduler    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:arscheduler    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:floodlight1.2-delay    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:floodlight1.2-delay    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:floodlight-hardware    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:floodlight-hardware    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:ACAMPController    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:ACAMPController    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:fast-failover-demo    文件:StaticFlowEntryPusher.java   
@LogMessageDoc(level="ERROR",
        message="inconsistent internal state: no switch has rule {rule}",
        explanation="Inconsistent internat state discovered while " +
                "deleting a static flow rule",
                recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

    if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
        entriesFromStorage.get(dpid).remove(entryName);
    } else {
        log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
        return;
    }

    writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    return;
}
项目:fast-failover-demo    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:fast-failover-demo    文件:OFSwitchHandshakeHandler.java   
/** 
 * Adds an initial table-miss flow to tables on the switch. 
 * This replaces the default behavior of forwarding table-miss packets 
 * to the controller. The table-miss flows inserted will forward all 
 * packets that do not match a flow to the controller for processing.
 * 
 * The OFSwitchManager is checked for used-defined behavior and default
 * max table to try to use.
 * 
 * Adding the default flow only applies to OpenFlow 1.3+ switches, which 
 * remove the default forward-to-controller behavior of flow tables.
 */
private void addDefaultFlows() {
    /*
     * Only for OF1.3+, insert the default forward-to-controller flow for
     * each table. This is priority=0 with no Match.
     */
    if (this.sw.getOFFactory().getVersion().compareTo(OFVersion.OF_13) >= 0) {
        /*
         * Remove the default flow if it's present.
         */
        OFFlowDeleteStrict deleteFlow = this.factory.buildFlowDeleteStrict()
                .setTableId(TableId.ALL)
                .setOutPort(OFPort.CONTROLLER)
                .build();
        this.sw.write(deleteFlow);

        ArrayList<OFAction> actions = new ArrayList<OFAction>(1);
        actions.add(factory.actions().output(OFPort.CONTROLLER, 0xffFFffFF));
        ArrayList<OFMessage> flows = new ArrayList<OFMessage>();
        for (int tableId = 0; tableId <= this.sw.getMaxTableForTableMissFlow().getValue(); tableId++) {
            OFFlowAdd defaultFlow = this.factory.buildFlowAdd()
                    .setTableId(TableId.of(tableId))
                    .setPriority(0)
                    .setActions(actions)
                    .build();
            flows.add(defaultFlow);
        }
        this.sw.write(flows);
    }
}
项目:floodlightLB    文件:StaticFlowEntryPusher.java   
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    if (switchService.getSwitch(DatapathId.of(dpid)) != null) {
        OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

        if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
            entriesFromStorage.get(dpid).remove(entryName);
        } else {
            log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
            return;
        }

        writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    } else {
        log.debug("Not sending flow delete for disconnected switch.");
    }
    return;
}
项目:floodlightLB    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:DSC    文件:StaticFlowEntryPusher.java   
@LogMessageDoc(level="ERROR",
        message="inconsistent internal state: no switch has rule {rule}",
        explanation="Inconsistent internat state discovered while " +
                "deleting a static flow rule",
                recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

    if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
        entriesFromStorage.get(dpid).remove(entryName);
    } else {
        log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
        return;
    }

    writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    return;
}
项目:DSC    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}
项目:DSC    文件:OFSwitchHandshakeHandler.java   
/** 
 * Adds an initial table-miss flow to each
 * and every table on the switch. This replaces the default behavior of
 * forwarding table-miss packets to the controller. The table-miss flows
 * inserted will forward all packets that do not match a flow to the 
 * controller for processing.
 * 
 * Adding the default flow only applies to OpenFlow 1.3+ switches, which 
 * remove the default forward-to-controller behavior of flow tables.
 * 
 * 下发table-miss
 */
private void addDefaultFlows() {
    /*
     * Only for OF1.3+, insert the default forward-to-controller flow for
     * each table. This is priority=0 with no Match.
     */
    if (this.sw.getOFFactory().getVersion().compareTo(OFVersion.OF_13) >= 0) {
        /*
         * Remove the default flow if it's present.
         */
        OFFlowDeleteStrict deleteFlow = this.factory.buildFlowDeleteStrict()
                .setTableId(TableId.ALL)
                .setOutPort(OFPort.CONTROLLER)
                .build();
        this.sw.write(deleteFlow);

        ArrayList<OFAction> actions = new ArrayList<OFAction>(1);
        actions.add(factory.actions().output(OFPort.CONTROLLER, 0xffFFffFF));
        ArrayList<OFMessage> flows = new ArrayList<OFMessage>();
        for (int tableId = 0; tableId < this.sw.getTables(); tableId++) {
            OFFlowAdd defaultFlow = this.factory.buildFlowAdd()
                    .setTableId(TableId.of(tableId))
                    .setPriority(0)
                    .setActions(actions)
                    .build();
            flows.add(defaultFlow);
        }
        this.sw.write(flows);
    }
}
项目:floodlight    文件:StaticFlowEntryPusher.java   
@LogMessageDoc(level="ERROR",
        message="inconsistent internal state: no switch has rule {rule}",
        explanation="Inconsistent internat state discovered while " +
                "deleting a static flow rule",
                recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
private void deleteStaticFlowEntry(String entryName) {
    String dpid = entry2dpid.remove(entryName);

    if (dpid == null) {
        // assume state has been cleared by deleteFlowsForSwitch() or
        // deleteAllFlows()
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending delete flow mod for flow {} for switch {}", entryName, dpid);
    }

    // send flow_mod delete
    OFFlowDeleteStrict flowMod = FlowModUtils.toFlowDeleteStrict(entriesFromStorage.get(dpid).get(entryName));

    if (entriesFromStorage.containsKey(dpid) && entriesFromStorage.get(dpid).containsKey(entryName)) {
        entriesFromStorage.get(dpid).remove(entryName);
    } else {
        log.debug("Tried to delete non-existent entry {} for switch {}", entryName, dpid);
        return;
    }

    writeFlowModToSwitch(DatapathId.of(dpid), flowMod);
    return;
}
项目:floodlight    文件:FlowModUtils.java   
public static OFFlowDeleteStrict toFlowDeleteStrict(OFFlowMod fm) {
    OFVersion version = fm.getVersion();
    OFFlowDeleteStrict.Builder b = OFFactories.getFactory(version).buildFlowDeleteStrict();
    if (b.getVersion().compareTo(OFVersion.OF_10) == 0) {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                // cookie-mask not supported
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                // instructions not supported
                .setMatch(fm.getMatch())
                // out-group not supported
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                // table-id not supported
                .setXid(fm.getXid())
                .build();
    } else {
        return b.setActions(fm.getActions())
                .setBufferId(fm.getBufferId())
                .setCookie(fm.getCookie())
                .setCookieMask(fm.getCookieMask()) // added in OF1.1
                .setFlags(fm.getFlags())
                .setHardTimeout(fm.getHardTimeout())
                .setIdleTimeout(fm.getIdleTimeout())
                .setInstructions(fm.getInstructions()) // added in OF1.1
                .setMatch(fm.getMatch())
                .setOutGroup(fm.getOutGroup()) // added in OF1.1
                .setOutPort(fm.getOutPort())
                .setPriority(fm.getPriority())
                .setTableId(fm.getTableId())
                .setXid(fm.getXid())
                .build();
    }
}