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


Java Nodes.getNode方法代码示例

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


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

示例1: getListOfDpns

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入方法依赖的package包/类
public static List<BigInteger> getListOfDpns(DataBroker broker) {
    List<BigInteger> dpnsList = new LinkedList<>();
    InstanceIdentifier<Nodes> nodesInstanceIdentifier = InstanceIdentifier.builder(Nodes.class).build();
    Optional<Nodes> nodesOptional =
            MDSALUtil.read(broker, LogicalDatastoreType.OPERATIONAL, nodesInstanceIdentifier);
    if (!nodesOptional.isPresent()) {
        return dpnsList;
    }
    Nodes nodes = nodesOptional.get();
    List<Node> nodeList = nodes.getNode();
    for (Node node : nodeList) {
        NodeId nodeId = node.getId();
        if (nodeId == null) {
            continue;
        }
        BigInteger dpnId = MDSALUtil.getDpnIdFromNodeName(nodeId);
        dpnsList.add(dpnId);
    }
    return dpnsList;
}
 
开发者ID:opendaylight,项目名称:netvirt,代码行数:21,代码来源:DhcpServiceUtils.java

示例2: getNodes

import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; //导入方法依赖的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.Nodes.getNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。