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


Java FlowOnNode类代码示例

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


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

示例1: testFlowStatistics

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Test
public void testFlowStatistics() {
    List<FlowOnNode> fon = new ArrayList<FlowOnNode>();
    Node node = NodeCreator.createOFNode(1L);
    FlowStatistics fs = new FlowStatistics(node, fon);
    Assert.assertTrue(fs.getNode().equals(node));
    Assert.assertTrue(fs.getFlowStats().equals(fon));

    Node node2 = NodeCreator.createOFNode(2L);
    fs.setNode(node2);
    Assert.assertTrue(fs.getNode().equals(node2));
    fs.setNode(node2);
    Assert.assertTrue(fs.getNode().equals(node2));
    fs.setFlowStats(null);
    Assert.assertTrue(fs.getFlowStats() == null);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:StatisticsNorthboundTest.java

示例2: readAllFlow

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public List<FlowOnNode> readAllFlow(String container, Node node,
        boolean cached) {

    long sid = (Long) node.getID();
    List<OFStatistics> ofList = (cached == true) ? statsMgr
            .getOFFlowStatistics(sid) : statsMgr.queryStatistics(sid,
            OFStatisticsType.FLOW, null);

    // Convert and filter the statistics per container
    List<FlowOnNode> flowOnNodeList = new FlowStatisticsConverter(ofList).getFlowOnNodeList(node);
    List<FlowOnNode> filteredList = filterFlowListPerContainer(container, node, flowOnNodeList);

    return (filteredList == null) ? null : filteredList;

}
 
开发者ID:lbchen,项目名称:ODL,代码行数:17,代码来源:ReadServiceFilter.java

示例3: filterFlowListPerContainer

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
/**
 * Filters a list of FlowOnNode elements based on the container
 *
 * @param container
 * @param nodeId
 * @param list
 * @return
 */
public List<FlowOnNode> filterFlowListPerContainer(String container,
        Node nodeId, List<FlowOnNode> list) {
    if (list == null) {
        return null;
    }

    // Create new filtered list of flows
    List<FlowOnNode> newList = new ArrayList<FlowOnNode>();

    for (FlowOnNode target : list) {
        // Check whether the described flow (match + actions) belongs to this container
        if (flowBelongToContainer(container, nodeId, target.getFlow())) {
            newList.add(target);
        }
    }

    return newList;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:27,代码来源:ReadServiceFilter.java

示例4: flowStatisticsRefreshed

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public void flowStatisticsRefreshed(Long switchId, List<OFStatistics> flows) {
    String container;
    IReadFilterInternalListener listener;
    Node node = NodeCreator.createOFNode(switchId);
    for (Map.Entry<String, IReadFilterInternalListener> l : readFilterInternalListeners.entrySet()) {
        container = l.getKey();
        listener = l.getValue();

        // Convert and filter the statistics per container
        List<FlowOnNode> flowOnNodeList = new FlowStatisticsConverter(flows).getFlowOnNodeList(node);
        flowOnNodeList = filterFlowListPerContainer(container, node, flowOnNodeList);

        // notify listeners
        listener.nodeFlowStatisticsUpdated(node, flowOnNodeList);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:18,代码来源:ReadServiceFilter.java

示例5: getFlowStats

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@RequestMapping(value = "/flowStats", method = RequestMethod.GET)
@ResponseBody
public TroubleshootingJsonBean getFlowStats(
        @RequestParam("nodeId") String nodeId,
        HttpServletRequest request, @RequestParam(required = false) String container) {
    List<Map<String, String>> cells = new ArrayList<Map<String, String>>();
    String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container;

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

    if (privilege != Privilege.NONE) {
        IStatisticsManager statisticsManager = (IStatisticsManager) ServiceHelper
                .getInstance(IStatisticsManager.class, containerName, this);
        if (statisticsManager != null) {
            Node node = Node.fromString(nodeId);
            List<FlowOnNode> statistics = statisticsManager.getFlows(node);
            for (FlowOnNode stats : statistics) {
                cells.add(this.convertFlowStatistics(node, stats, containerName));
            }
        }
    }

    TroubleshootingJsonBean result = new TroubleshootingJsonBean();
    result.setColumnNames(flowStatsColumnNames);
    result.setNodeData(cells);
    return result;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:30,代码来源:Troubleshoot.java

示例6: testFlowOnNodeMethods

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Test
        public void testFlowOnNodeMethods () {
        Match match = new Match();
        NodeConnector inNC = NodeConnectorCreator.createNodeConnector((short)10, NodeCreator.createOFNode((long)10));
        NodeConnector outNC = NodeConnectorCreator.createNodeConnector((short)20, NodeCreator.createOFNode((long)20));

        match.setField(MatchType.DL_TYPE, EtherTypes.IPv4.shortValue());
        match.setField(MatchType.IN_PORT, inNC);

        Output output = new Output(outNC);
        ArrayList<Action> action = new ArrayList<Action>();
        action.add(output);

        Flow flow = new Flow (match, action);

        FlowOnNode flowOnNode = new FlowOnNode (flow);

        Assert.assertTrue(flowOnNode.getFlow().equals(flow));

        flowOnNode.setPacketCount((long)100);
        flowOnNode.setByteCount((long)800);
        flowOnNode.setTableId((byte)0x55);
        flowOnNode.setDurationNanoseconds(40);
        flowOnNode.setDurationSeconds(45);

        Assert.assertTrue(flowOnNode.getPacketCount() == 100);
        Assert.assertTrue(flowOnNode.getByteCount() == 800);
        Assert.assertTrue(flowOnNode.getDurationNanoseconds() == 40);
        Assert.assertTrue(flowOnNode.getDurationSeconds() == 45);
        Assert.assertTrue(flowOnNode.getTableId() == (byte)0x55);
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:32,代码来源:FlowOnNodeTest.java

示例7: readFlow

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public FlowOnNode readFlow(Node node, Flow flow) {
    if (pluginReader != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .readFlow(node, flow, true);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:12,代码来源:ReadService.java

示例8: nonCachedReadFlow

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public FlowOnNode nonCachedReadFlow(Node node, Flow flow) {
    if (pluginReader != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .readFlow(node, flow, false);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:12,代码来源:ReadService.java

示例9: readAllFlows

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public List<FlowOnNode> readAllFlows(Node node) {
    if (pluginReader != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .readAllFlow(node, true);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:12,代码来源:ReadService.java

示例10: nonCachedReadAllFlows

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public List<FlowOnNode> nonCachedReadAllFlows(Node node) {
    if (pluginReader != null) {
        if (this.pluginReader.get(node.getType()) != null) {
            return this.pluginReader.get(node.getType())
                    .readAllFlow(node, false);
        }
    }
    logger.warn("Plugin {} unavailable", node.getType());
    return null;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:12,代码来源:ReadService.java

示例11: retrieveCaches

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "deprecation" })
private void retrieveCaches() {
    ConcurrentMap<?, ?> map;

    if (this.clusterContainerService == null) {
        log.warn("Can't retrieve statistics manager cache, Clustering service unavailable.");
        return;
    }

    log.debug("Statistics Manager - retrieveCaches for Container {}", container);

    map = clusterContainerService.getCache("statisticsmanager.flowStatistics");
    if (map != null) {
        this.flowStatistics = (ConcurrentMap<Node, List<FlowOnNode>>) map;
    } else {
        log.error("Cache allocation failed for statisticsmanager.flowStatistics in container {}", container.getName());
    }

    map = clusterContainerService.getCache("statisticsmanager.nodeConnectorStatistics");
    if (map != null) {
        this.nodeConnectorStatistics = (ConcurrentMap<Node, List<NodeConnectorStatistics>>) map;
    } else {
        log.error("Cache allocation failed for statisticsmanager.nodeConnectorStatistics in container {}", container.getName());
    }

    map = clusterContainerService.getCache("statisticsmanager.tableStatistics");
    if (map != null) {
        this.tableStatistics = (ConcurrentMap<Node, List<NodeTableStatistics>>) map;
    } else {
        log.error("Cache allocation failed for statisticsmanager.tableStatistics in container {}", container.getName());
    }

    map = clusterContainerService.getCache("statisticsmanager.descriptionStatistics");
    if (map != null) {
        this.descriptionStatistics = (ConcurrentMap<Node, NodeDescription>) map;
    } else {
        log.error("Cache allocation failed for statisticsmanager.descriptionStatistics in container {}", container.getName());
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:40,代码来源:StatisticsManager.java

示例12: getFlows

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public List<FlowOnNode> getFlows(Node node) {
    if (node == null) {
        return null;
    }

    List<FlowOnNode> flowList = new ArrayList<FlowOnNode>();
    List<FlowOnNode> cachedList = flowStatistics.get(node);
    if (cachedList != null){
        flowList.addAll(cachedList);
    }
    return flowList;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:14,代码来源:StatisticsManager.java

示例13: getFlowStatisticsForFlowList

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public Map<Node, List<FlowOnNode>> getFlowStatisticsForFlowList(List<FlowEntry> flowList) {
    Map<Node, List<FlowOnNode>> statMapOutput = new HashMap<Node, List<FlowOnNode>>();

    if (flowList == null || flowList.isEmpty()){
        return statMapOutput;
    }

    Node node;
    // Index FlowEntries' flows by node so we don't traverse entire flow list for each flowEntry
    Map<Node, Set<Flow>> index = new HashMap<Node, Set<Flow>>();
    for (FlowEntry flowEntry : flowList) {
        node = flowEntry.getNode();
        Set<Flow> set = (index.containsKey(node) ? index.get(node) : new HashSet<Flow>());
        set.add(flowEntry.getFlow());
        index.put(node, set);
    }

    // Iterate over flows per indexed node and add to output
    for (Entry<Node, Set<Flow>> indexEntry : index.entrySet()) {
        node = indexEntry.getKey();
        List<FlowOnNode> flowsPerNode = flowStatistics.get(node);

        if (flowsPerNode != null && !flowsPerNode.isEmpty()){
            List<FlowOnNode> filteredFlows = statMapOutput.containsKey(node) ?
                    statMapOutput.get(node) : new ArrayList<FlowOnNode>();

            for (FlowOnNode flowOnNode : flowsPerNode) {
                if (indexEntry.getValue().contains(flowOnNode.getFlow())) {
                    filteredFlows.add(flowOnNode);
                }
            }
            statMapOutput.put(node, filteredFlows);
        }
    }
    return statMapOutput;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:38,代码来源:StatisticsManager.java

示例14: getFlowsNumber

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public int getFlowsNumber(Node node) {
    List<FlowOnNode> l;
    if (node == null || (l = flowStatistics.get(node)) == null){
        return -1;
    }
    return l.size();
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:StatisticsManager.java

示例15: nodeFlowStatisticsUpdated

import org.opendaylight.controller.sal.reader.FlowOnNode; //导入依赖的package包/类
@Override
public void nodeFlowStatisticsUpdated(Node node, List<FlowOnNode> flowStatsList) {
    List<FlowOnNode> currentStat = this.flowStatistics.get(node);
    // Update cache only if changed to avoid unnecessary cache sync operations
    if (! flowStatsList.equals(currentStat)){
        this.flowStatistics.put(node, flowStatsList);
    }
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:9,代码来源:StatisticsManager.java


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