本文整理汇总了Java中org.opendaylight.controller.sal.core.NodeTable类的典型用法代码示例。如果您正苦于以下问题:Java NodeTable类的具体用法?Java NodeTable怎么用?Java NodeTable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeTable类属于org.opendaylight.controller.sal.core包,在下文中一共展示了NodeTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testNodeTableStatisticsMethods
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Test
public void testNodeTableStatisticsMethods() {
NodeTable nt = NodeTableCreator.createNodeTable(Byte.valueOf("2") , NodeCreator.createOFNode((long)20));
NodeTableStatistics ntStats = new NodeTableStatistics();
ntStats.setNodeTable(nt);
ntStats.setActiveCount(100);
ntStats.setLookupCount(200);
ntStats.setMatchedCount(500);
ntStats.setName("Test");
Assert.assertTrue(ntStats.getNodeTable().equals(nt));
Assert.assertTrue(ntStats.getActiveCount() == 100);
Assert.assertTrue(ntStats.getLookupCount() == 200);
Assert.assertTrue(ntStats.getMatchedCount() == 500);
Assert.assertTrue(ntStats.getName().equals("Test"));
}
示例2: getNodeTableStatistics
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public NodeTableStatistics getNodeTableStatistics(NodeTable nodeTable) {
if (nodeTable == null){
return null;
}
List<NodeTableStatistics> statList = tableStatistics.get(nodeTable.getNode());
if (statList != null){
for (NodeTableStatistics stat : statList) {
if (stat.getNodeTable().getID().equals(nodeTable.getID())){
return stat;
}
}
}
return null;
}
示例3: filterTableListPerContainer
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
public List<OFStatistics> filterTableListPerContainer(
String container, long switchId, List<OFStatistics> list) {
if (list == null) {
return null;
}
// Create new filtered list of node tables
List<OFStatistics> newList = new ArrayList<OFStatistics>();
for (OFStatistics stat : list) {
OFTableStatistics target = (OFTableStatistics) stat;
NodeTable nt = NodeTableCreator.createOFNodeTable(target.getTableId(), NodeCreator.createOFNode(switchId));
if (containerOwnsNodeTable(container, nt)) {
newList.add(target);
}
}
return newList;
}
示例4: readNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public NodeTableStatistics readNodeTable(String containerName,
NodeTable table, boolean cached) {
if (!containerOwnsNodeTable(containerName, table)) {
return null;
}
Node node = table.getNode();
long sid = (Long) node.getID();
Byte tableId = (Byte) table.getID();
List<OFStatistics> ofList = (cached == true) ? statsMgr.getOFTableStatistics(sid, tableId) :
statsMgr.queryStatistics(sid, OFStatisticsType.TABLE, tableId);
List<NodeTableStatistics> ntStatistics = new TableStatisticsConverter(sid, ofList).getNodeTableStatsList();
return (ntStatistics.isEmpty()) ? new NodeTableStatistics() : ntStatistics.get(0);
}
示例5: readAllNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public List<NodeTableStatistics> readAllNodeTable(Node node, boolean cached) {
NodeTableStatistics stats = new NodeTableStatistics();
try {
NodeTable nt = new NodeTable(NodeTable.NodeTableIDType.OPENFLOW, Byte.valueOf("10"), node);
stats.setNodeTable(nt);
} catch (ConstructionException e) {
// couldn't create nodetable.
}
stats.setActiveCount(4);
stats.setLookupCount(4);
stats.setMatchedCount(4);
List<NodeTableStatistics> result = new ArrayList<NodeTableStatistics>();
result.add(stats);
return result;
}
示例6: createNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
/**
* Generic NodeTable creator
* The nodeTable type is OPENFLOW only for the time being
*
* @param portId
* @param node
* @return
*/
public static NodeTable createNodeTable(byte tableId, Node node) {
try {
return new NodeTable(NodeTableIDType.OPENFLOW, tableId, node);
} catch (ConstructionException e1) {
logger.error("",e1);
return null;
}
}
示例7: createOFNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
public static NodeTable createOFNodeTable(byte tableId, Node node) {
try {
return new NodeTable(NodeTableIDType.OPENFLOW, tableId, node);
} catch (ConstructionException e1) {
logger.error("",e1);
return null;
}
}
示例8: nonCachedReadNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public NodeTableStatistics nonCachedReadNodeTable(NodeTable table) {
Node node = table.getNode();
if (pluginReader != null && node != null) {
if (this.pluginReader.get(node.getType()) != null) {
return this.pluginReader.get(node.getType())
.readNodeTable(table, false);
}
}
logger.warn("Plugin {} unavailable", node.getType());
return null;
}
示例9: readNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public NodeTableStatistics readNodeTable(NodeTable table) {
Node node = table.getNode();
if (pluginReader != null && node != null) {
if (this.pluginReader.get(node.getType()) != null) {
return this.pluginReader.get(node.getType())
.readNodeTable(table, true);
}
}
logger.warn("Plugin {} unavailable", node.getType());
return null;
}
示例10: _readtable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
public void _readtable(CommandInterpreter ci) {
String nodeId = ci.nextArgument();
String tableId = ci.nextArgument();
String cacheReq = ci.nextArgument();
boolean cached;
if (nodeId == null) {
ci.print("Node id not specified");
return;
}
if (tableId == null) {
ci.print("Table id not specified");
return;
}
cached = (cacheReq == null) ? true : cacheReq.equals("true");
NodeTable nodeTable = null;
Node node = NodeCreator.createOFNode(Long.parseLong(nodeId));
nodeTable = NodeTableCreator.createNodeTable(Byte
.valueOf(tableId), node);
NodeTableStatistics stats = (cached) ? this
.readNodeTable(nodeTable) : this
.nonCachedReadNodeTable(nodeTable);
if (stats != null) {
ci.println(stats.toString());
} else {
ci.println("null");
}
}
示例11: init
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
/**
* Function called by the dependency manager when all the required
* dependencies are satisfied
*
*/
void init() {
containerToNc = new ConcurrentHashMap<String, Set<NodeConnector>>();
containerToNt = new ConcurrentHashMap<String, Set<NodeTable>>();
containerToNode = new ConcurrentHashMap<String, Set<Node>>();
containerFlows = new ConcurrentHashMap<String, Set<ContainerFlow>>();
readFilterInternalListeners = new ConcurrentHashMap<String, IReadFilterInternalListener>();
}
示例12: containerOwnsNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
/**
* Returns whether the passed NodeConnector belongs to the container
*
* @param container container name
* @param table node table to test
* @return true if belongs false otherwise
*/
public boolean containerOwnsNodeTable(String container, NodeTable table) {
// All node table belong to the default container
if (container.equals(GlobalConstants.DEFAULT.toString())) {
return true;
}
Set<NodeTable> tableSet = containerToNt.get(container);
return (tableSet == null) ? false : tableSet.contains(table);
}
示例13: readNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public NodeTableStatistics readNodeTable(NodeTable table, boolean cached) {
if (!table.getNode().getType()
.equals(NodeIDType.OPENFLOW)) {
logger.error("Invalid node type");
return null;
}
if (!connectionOutService.isLocal(table.getNode())) {
logger.debug("This Controller is not the master for connector : "+table);
return null;
}
return filter.readNodeTable(containerName, table, cached);
}
示例14: readNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
@Override
public NodeTableStatistics readNodeTable(NodeTable table, boolean b) {
NodeTableStatistics stats = new NodeTableStatistics();
stats.setNodeTable(table);
stats.setActiveCount(4);
stats.setLookupCount(4);
stats.setMatchedCount(4);
return stats;
}
示例15: getNodeTable
import org.opendaylight.controller.sal.core.NodeTable; //导入依赖的package包/类
/**
* @return the node table
*/
public NodeTable getNodeTable() {
return nodeTable;
}