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


Java NodesBuilder类代码示例

本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder的典型用法代码示例。如果您正苦于以下问题:Java NodesBuilder类的具体用法?Java NodesBuilder怎么用?Java NodesBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NodesBuilder类属于org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819包,在下文中一共展示了NodesBuilder类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNodes

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodesBuilder; //导入依赖的package包/类
/**
 * Retrieve all the {@link Node} along with a list of their
 * associated {@link NodeConnector}.
 * @return nodes A map with {@link Node} as the key and a {@link List} of {@link NodeConnector}.
 */
public static Map<Node, List<NodeConnector>> getNodes(final DataBroker dataBroker) {
    Map<Node, List<NodeConnector>> nodeMap = new HashMap<Node, List<NodeConnector>>();
    Nodes nodeList = new NodesBuilder().build();
    ReadTransaction tx = dataBroker.newReadOnlyTransaction();
    try {
        final InstanceIdentifier<Nodes> nodesIdentifier = InstanceIdentifier.create(Nodes.class);
        final CheckedFuture<Optional<Nodes>, ReadFailedException> txCheckedFuture = tx.read(LogicalDatastoreType
                .OPERATIONAL, nodesIdentifier);
        nodeList = txCheckedFuture.checkedGet().get();

        for (Node node : nodeList.getNode()) {
            LOG.info("Node ID : {}", node.getId());
            List<NodeConnector> nodeConnector = node.getNodeConnector();
            nodeMap.put(node, nodeConnector);
        }
    } catch (ReadFailedException e) {
        //TODO: Perform fail over
        LOG.error("Error reading Nodes from MD-SAL", e);
    }
    return nodeMap;
}
 
开发者ID:opendaylight,项目名称:nic,代码行数:27,代码来源:TopologyUtils.java


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