• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java OFTableStatistics类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: tableStatBuilder

import org.openflow.protocol.statistics.OFTableStatistics; //导入依赖的package包/类
/**
 * OFTableStatistics builder
 *
 * @return the list
 */
private List<OFTableStatistics> tableStatBuilder() {
    List<OFTableStatistics> tableStats = new ArrayList<>();

    for (int i = 0; i < this.flow_table.size(); i++) {
        OFTableStatistics tableStat = new OFTableStatistics();
        tableStat.setActiveCount(42);
        tableStat.setLookupCount(42);
        tableStat.setMatchedCount(42);
        tableStat.setMaximumEntries(this.flow_table.capacity());
        tableStat.setName("toblerOne");
        tableStat.setTableId((byte) 42);

        tableStats.add(tableStat);
    }

    return tableStats;
}
 
开发者ID:lsinfo3,项目名称:ofcprobe,代码行数:23,代码来源:OFStatsHandler.java


示例2: filterTableListPerContainer

import org.openflow.protocol.statistics.OFTableStatistics; //导入依赖的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;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:20,代码来源:ReadServiceFilter.java


示例3: checkForTableStats

import org.openflow.protocol.statistics.OFTableStatistics; //导入依赖的package包/类
@LogMessageDocs({
    @LogMessageDoc(level="INFO",
        message="Switch {switch} flow table is full",
        explanation="The switch flow table at least 98% full, " +
                "this requires attention if using reactive flow setup"),
    @LogMessageDoc(level="INFO",
        message="Switch {switch} flow table capacity back to normal",
        explanation="The switch flow table is less than 90% full")
})
private void checkForTableStats(OFStatisticsReply statReply) {
    if (statReply.getStatisticType() != OFStatisticsType.TABLE) {
        return;
    }
    List<? extends OFStatistics> stats = statReply.getStatistics();
    // Assume a single table only
    OFStatistics stat = stats.get(0);
    if (stat instanceof OFTableStatistics) {
        OFTableStatistics tableStat = (OFTableStatistics) stat;
        int activeCount = tableStat.getActiveCount();
        int maxEntry = tableStat.getMaximumEntries();
        log.debug("Switch {} active entries {} max entries {}",
                new Object[] { this.stringId, activeCount, maxEntry});
        int percentFull = activeCount * 100 / maxEntry;
        if (flowTableFull && percentFull < 90) {
            log.info("Switch {} flow table capacity is back to normal",
                    toString());
            floodlightProvider.addSwitchEvent(this.datapathId,
                    "SWITCH_FLOW_TABLE_NORMAL < 90% full", false);
        } else if (percentFull >= 98) {
            log.info("Switch {} flow table is almost full", toString());
            floodlightProvider.addSwitchEvent(this.datapathId,
                    "SWITCH_FLOW_TABLE_ALMOST_FULL >= 98% full", false);
        }
    }
}
 
开发者ID:JianqingJiang,项目名称:QoS-floodlight,代码行数:36,代码来源:OFSwitchBase.java


示例4: getOFTableStatistics

import org.openflow.protocol.statistics.OFTableStatistics; //导入依赖的package包/类
@Override
public List<OFStatistics> getOFTableStatistics(Long switchId, Byte tableId) {
    if (!tableStatistics.containsKey(switchId)) {
        return this.dummyList;
    }

    List<OFStatistics> list = new ArrayList<OFStatistics>(1);
    for (OFStatistics stats : tableStatistics.get(switchId)) {
        if (((OFTableStatistics) stats).getTableId() == tableId) {
            list.add(stats);
            break;
        }
    }
    return list;
}
 
开发者ID:lbchen,项目名称:ODL,代码行数:16,代码来源:OFStatisticsManager.java


示例5: parseStatsReply

import org.openflow.protocol.statistics.OFTableStatistics; //导入依赖的package包/类
/**
 * Parses message into relevant properties
 * @param statsType the specific Stats Type (0:DESC, 1:FLOW, 2:AGGREGATE, 3:TABLE, 4:PORT, 5:QUEUE, 6:VENDOR)
 * @param rawMessage Assumes the following format and parses into properties:
 * "["flow_stats_reply", 3, [{"packet_count": 0, "hard_timeout": 0, "byte_count": 0, "idle_timeout": 0, "actions": "[{'output': 65533}]", 
 * 							  "duration_nsec": 27000000, "priority": 0, "duration_sec": 0, "table_id": 0, "cookie": 0, "match": "{}"}]]"
 */
public OFStatisticsReply parseStatsReply(OFStatisticsType statsType, String rawMessage) {
	//EXTRACT THE JSON
	String tmp = rawMessage.substring(rawMessage.indexOf(",")+2, rawMessage.length()-2);
	String switchStr = tmp.substring(0, 1);
	this.switchId = Long.parseLong(switchStr);
	String jsonStr = tmp.substring(tmp.indexOf(",")+3);
	JSONObject json = new JSONObject(jsonStr);
	
	//ADD PROPS TO STATS_REPLY OBJECT
	OFStatisticsReply statsReply = new OFStatisticsReply();
	//statsReply.setFlags(Short.parseShort(flagStr));
	statsReply.setStatisticType(statsType);
	statsReply.setStatisticsFactory(new BasicFactory());
	List<OFStatistics> statistics = new ArrayList<OFStatistics>();
	switch (statsType) {
		case DESC:
			OFDescriptionStatistics description = new OFDescriptionStatistics();
			description.setDatapathDescription("A");
			description.setHardwareDescription("B");
			description.setManufacturerDescription("C");
			description.setSerialNumber("D");
			description.setSoftwareDescription("E");
			statistics.add(description);
			break;
		case FLOW:
			OFFlowStatisticsReply flowStats = new OFFlowStatisticsReply();
			flowStats.setByteCount(json.getLong("byte_count"));
			flowStats.setActionFactory(new BasicFactory());
			//FORMATTING SEEMS OFF (why is it in " "), NEED TO CONVERT STRING TO JSON ARRAY
			String tmpArrayStr = json.getString("actions");
			JSONArray jsonArray = new JSONArray(tmpArrayStr);
			flowStats.setActions(parseActionsArray(jsonArray));
			//
			flowStats.setCookie(json.getLong("cookie"));
			flowStats.setDurationNanoseconds(json.getInt("duration_nsec"));
			flowStats.setDurationSeconds(json.getInt("duration_sec"));
			flowStats.setHardTimeout((short)json.getInt("hard_timeout"));
			flowStats.setIdleTimeout((short)json.getInt("idle_timeout"));
			flowStats.setPacketCount(json.getLong("packet_count"));
			flowStats.setPriority((short)json.getInt("priority"));
			flowStats.setTableId((byte)json.getInt("table_id"));
			OFMatch match = new OFMatch();
			flowStats.setMatch(match);
			statistics.add(flowStats);
			break;
		case TABLE:
			OFTableStatistics tables = new OFTableStatistics();
			tables.setTableId(Byte.parseByte(json.getString("table_id")));
			//tables.setActiveCount();
			//tables.setLookupCount(lookupCount);
			//tables.setMatchedCount(matchedCount);
			//tables.setMaximumEntries(maximumEntries);
			//tables.setWildcards(wildcards);
			statistics.add(tables);
			break;
		case PORT:
			OFPortStatisticsReply portStatReply = new OFPortStatisticsReply();
			portStatReply.setreceivePackets(json.getLong("packet_count"));
			portStatReply.setPortNumber(Short.parseShort(json.getString("port")));
			portStatReply.setReceiveBytes(json.getLong("received_bytes"));
			statistics.add(portStatReply);
			break;
		case AGGREGATE:
		case VENDOR:
		case QUEUE:
	}
	statsReply.setStatistics(statistics);
	return statsReply;
}
 
开发者ID:fp7-netide,项目名称:Engine,代码行数:77,代码来源:MessageParser.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockGrass类代码示例发布时间:2022-05-22
下一篇:
Java LibraryEditor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap