当前位置: 首页>>代码示例>>Java>>正文


Java Switch.getNode方法代码示例

本文整理汇总了Java中org.opendaylight.controller.switchmanager.Switch.getNode方法的典型用法代码示例。如果您正苦于以下问题:Java Switch.getNode方法的具体用法?Java Switch.getNode怎么用?Java Switch.getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opendaylight.controller.switchmanager.Switch的用法示例。


在下文中一共展示了Switch.getNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSingleNodes

import org.opendaylight.controller.switchmanager.Switch; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
    private void addSingleNodes(List<Switch> nodes, ISwitchManager switchManager, String containerName) {
    if (nodes == null) {
            return;
    }
    for (Switch sw : nodes) {
            Node n = sw.getNode();

            // skip production node
            if (nodeIgnore(n)) {
                continue;
            }

            String description = getNodeDesc(n, switchManager);

            if ((stagedNodes.containsKey(n.toString()) && metaCache.get(containerName).containsKey(n.toString())) || newNodes.containsKey(n.toString())) {
                    continue;
            }
            NodeBean node = createNodeBean(description, n);

            // FIXME still doesn't display standalone node when last remaining link is removed
            if (metaCache.get(containerName).containsKey(node.id()) && !stagedNodes.containsKey(node.id())) {
                    Map<String, Object> nodeEntry = metaCache.get(containerName).get(node.id());
                            Map<String, String> data = (Map<String, String>) nodeEntry.get("data");
                    data.put("$desc", description);
                    nodeEntry.put("data", data);
                    // clear adjacencies since this is now a single node
                    nodeEntry.put("adjacencies", new LinkedList<Map<String, Object>>());
            stagedNodes.put(node.id(), nodeEntry);
        } else {
            newNodes.put(node.id(), node.out());
        }
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:35,代码来源:Topology.java

示例2: getNodeFlows

import org.opendaylight.controller.switchmanager.Switch; //导入方法依赖的package包/类
@RequestMapping(value = "/node-flows")
@ResponseBody
public Map<String, Object> getNodeFlows(HttpServletRequest request, @RequestParam(required = false) String container) {
    String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container;

    // Derive the privilege this user has on the current container
    String userName = request.getUserPrincipal().getName();
    if (DaylightWebUtil.getContainerPrivilege(userName, containerName, this) == Privilege.NONE) {
        return null;
    }

    ISwitchManager switchManager = (ISwitchManager) ServiceHelper
            .getInstance(ISwitchManager.class, containerName, this);
    if (switchManager == null) {
        return null;
    }
    IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper
            .getInstance(IForwardingRulesManager.class, containerName, this);
    if (frm == null) {
        return null;
    }

    Map<String, Object> nodes = new HashMap<String, Object>();

    for (Switch sw : switchManager.getNetworkDevices()) {
        Node node = sw.getNode();

        List<FlowConfig> flows = frm.getStaticFlows(node);

        String nodeDesc = node.toString();
        SwitchConfig config = switchManager.getSwitchConfig(node
                .toString());
        if ((config != null) && (config.getProperty(Description.propertyName) != null)) {
            nodeDesc = ((Description) config.getProperty(Description.propertyName)).getValue();
        }

        nodes.put(nodeDesc, flows.size());
    }

    return nodes;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:42,代码来源:Flows.java


注:本文中的org.opendaylight.controller.switchmanager.Switch.getNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。