当前位置: 首页>>代码示例>>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;未经允许,请勿转载。