當前位置: 首頁>>代碼示例>>Java>>正文


Java HostNodePair類代碼示例

本文整理匯總了Java中org.opendaylight.controller.samples.simpleforwarding.HostNodePair的典型用法代碼示例。如果您正苦於以下問題:Java HostNodePair類的具體用法?Java HostNodePair怎麽用?Java HostNodePair使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HostNodePair類屬於org.opendaylight.controller.samples.simpleforwarding包,在下文中一共展示了HostNodePair類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: uninstallPerHostRules

import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //導入依賴的package包/類
/**
 * Cleanup all the host rules for a given host
 *
 * @param host Host for which the host rules need to be cleaned
 * up, the host could be null in that case it match all the hosts
 *
 * @return a return code that convey the programming status of the HW
 */
private RulesProgrammingReturnCode uninstallPerHostRules(
        HostNodeConnector host) {
    RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
    Map<NodeConnector, FlowEntry> pos;
    FlowEntry po;
    // Now program every single switch
    for (HostNodePair key : this.rulesDB.keySet()) {
        if (host == null || key.getHost().equals(host)) {
            pos = this.rulesDB.get(key);
            for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
                po = e.getValue();
                if (po != null) {
                    // Uninstall the policy
                    this.frm.uninstallFlowEntry(po);
                }
            }
            this.rulesDB.remove(key);
        }
    }
    return retCode;
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:30,代碼來源:SimpleForwardingImpl.java

示例2: uninstallPerNodeRules

import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //導入依賴的package包/類
/**
 * Cleanup all the host rules for a given node, triggered when the
 * switch disconnects, so there is no reason for Hw cleanup
 * because it's disconnected anyhow
 * TBD - Revisit above stmt in light of CSCus88743
 * @param targetNode Node for which we want to do cleanup
 *
 */
private void uninstallPerNodeRules(Node targetNode) {
    //RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
    Map<NodeConnector, FlowEntry> pos;
    FlowEntry po;

    // Now program every single switch
    for (HostNodePair key : this.rulesDB.keySet()) {
        Node node = key.getNode();
        if (targetNode == null || node.equals(targetNode)) {
            log.debug("Work on {} host {}", node, key.getHost());
            pos = this.rulesDB.get(key);
            for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
                po = e.getValue();
                if (po != null) {
                    // Uninstall the policy
                    this.frm.uninstallFlowEntry(po);
                }
            }
            log.debug("Remove {}", key);
            this.rulesDB.remove(key);
        }
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:32,代碼來源:SimpleForwardingImpl.java

示例3: retrieveCaches

import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //導入依賴的package包/類
@SuppressWarnings({ "unchecked", "deprecation" })
private void retrieveCaches() {
    if (this.clusterContainerService == null) {
        log.info("un-initialized clusterContainerService, can't retrieve cache");
        return;
    }

    rulesDB = (ConcurrentMap<HostNodePair, HashMap<NodeConnector, FlowEntry>>) clusterContainerService
            .getCache("forwarding.ipswitch.rules");
    if (rulesDB == null) {
        log.error("\nFailed to get rulesDB handle");
    }
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:14,代碼來源:SimpleForwardingImpl.java

示例4: installPerHostRules

import org.opendaylight.controller.samples.simpleforwarding.HostNodePair; //導入依賴的package包/類
/**
 * Routine that fetch the per-Host rules from the rulesDB and
 * install in HW, the one having the same match rules will be
 * overwritten silently.
 *
 * @param host host for which we want to install in HW the per-Host rules
 * @param switchesToProgram list of switches to be programmed in
 * HW, usually are them all, but better to be explicit, that list
 * may change with time based on new switch addition/removal
 *
 * @return a return code that convey the programming status of the HW
 */
private RulesProgrammingReturnCode installPerHostRules(
        HostNodeConnector host, Set<Node> switchesToProgram) {
    RulesProgrammingReturnCode retCode = RulesProgrammingReturnCode.SUCCESS;
    if (host == null || switchesToProgram == null) {
        return RulesProgrammingReturnCode.FAILED_WRONG_PARAMS;
    }
    Map<NodeConnector, FlowEntry> pos;
    FlowEntry po;
    // Now program every single switch
    log.debug("Inside installPerHostRules");
    for (Node swId : switchesToProgram) {
        HostNodePair key = new HostNodePair(host, swId);
        pos = this.rulesDB.get(key);
        if (pos == null) {
            continue;
        }
        for (Map.Entry<NodeConnector, FlowEntry> e : pos.entrySet()) {
            po = e.getValue();
            if (po != null) {
                // Populate the Policy field now
                Status poStatus = this.frm.installFlowEntry(po);
                if (!poStatus.isSuccess()) {
                    log.error("Failed to install policy: "
                            + po.getGroupName() + " ("
                            + poStatus.getDescription() + ")");

                    retCode = RulesProgrammingReturnCode.FAILED_FEW_SWITCHES;
                    // Remove the entry from the DB, it was not installed!
                    this.rulesDB.remove(key);
                } else {
                    log.debug("Successfully installed policy "
                            + po.toString() + " on switch " + swId);
                }
            } else {
                log.error("Cannot find a policy for SW:({}) Host: ({})",
                          swId, host);
                /* // Now dump every single rule */
                /* for (HostNodePair dumpkey : this.rulesDB.keySet()) { */
                /*  po = this.rulesDB.get(dumpkey); */
                /*  log.debug("Dumping entry H{" + dumpkey.getHost() + "} S{" + dumpkey.getSwitchId() + "} = {" + (po == null ? "null policy" : po)); */
                /* } */
            }
        }
    }
    log.debug("Leaving installPerHostRules");
    return retCode;
}
 
開發者ID:lbchen,項目名稱:ODL,代碼行數:60,代碼來源:SimpleForwardingImpl.java


注:本文中的org.opendaylight.controller.samples.simpleforwarding.HostNodePair類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。