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


Java OFFlowStatsEntry类代码示例

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


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

示例1: buildFlowStat

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
private Map<String, Object> buildFlowStat(final OFFlowStatsEntry entry) {
    Map<String, Object> data = new HashMap<>();
    data.put("version", entry.getVersion());
    data.put("duration-nsec", entry.getDurationNsec());
    data.put("duration-sec", entry.getDurationSec());
    data.put("hard-timeout", entry.getHardTimeout());
    data.put("idle-timeout", entry.getIdleTimeout());
    data.put("priority", entry.getPriority());
    data.put("byte-count", entry.getByteCount().getValue());
    data.put("packer-count", entry.getPacketCount().getValue());
    data.put("flags", entry.getFlags());
    data.put("cookie", Long.toHexString(entry.getCookie().getValue()));
    data.put("table-id", entry.getTableId().getValue());
    data.put("match", buildFlowMatch(entry.getMatch()));
    data.put("instructions", buildFlowInstructions(entry.getInstructions()));
    return data;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:18,代码来源:FlowsResource.java

示例2: getPairFlowInformation

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
public double[] getPairFlowInformation(Map<OFFlowStatsEntry, FlowEntry> table,
                                       Map<OFFlowStatsEntry, Boolean> pairFlowSet) {
    double[] vals = new double[4];

    //total flow
    vals[0] = table.size();

    //pair flow
    vals[1] = pairFlowSet.size();

    //single flow
    vals[2] = vals[0] - vals[1];

    //pairflowratio flow
    if (vals[1] == 0) {
        vals[3] = 0;
    } else {
        vals[3] = vals[1] / vals[0];
    }
    return vals;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:22,代码来源:FeatureCollectorProvider.java

示例3: analyzeStatsReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
@SuppressWarnings("unused")
private void analyzeStatsReply(OFMessage reply) {
    log.info("recieved stats reply (xid = {} type: {}) from sw {} ",
            reply.getXid(), reply.getType(), getStringId());
    if (reply.getType() == OFType.STATS_REPLY) {
        OFStatsReply sr = (OFStatsReply) reply;
        if (sr.getStatsType() == OFStatsType.FLOW) {
            OFFlowStatsReply fsr = (OFFlowStatsReply) sr;
            log.info("received flow stats sw {} --> {}", getStringId(), fsr);
            // fsr.getEntries().get(0).getMatch().getMatchFields()
            for (OFFlowStatsEntry e : fsr.getEntries()) {
                for (MatchField<?> mf : e.getMatch().getMatchFields()) {
                    log.info("mf is exact: {} for {}: {}",
                            e.getMatch().isExact(mf),
                            mf.id,
                            e.getMatch().get(mf));
                }
            }

        }
    }
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:23,代码来源:OFSwitchImplBase.java

示例4: getStatisticsReply

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
private OFStatsReply getStatisticsReply(int transactionId,
        int count, boolean moreReplies, OFVersion version) {
    OFFactory factory = OFFactories.getFactory(version);

    List<OFFlowStatsEntry> statistics = new ArrayList<OFFlowStatsEntry>();
    for (int i = 0; i < count; ++i) {
        statistics.add(factory.buildFlowStatsEntry().build());
    }
    assertEquals(statistics.size(), count);

    org.projectfloodlight.openflow.protocol.OFStatsReply.Builder
            statsReplyBuilder = factory.buildFlowStatsReply()
                .setXid(transactionId)
                .setEntries(statistics);

    if (moreReplies) {
        statsReplyBuilder.setFlags(
                Collections.singleton(OFStatsReplyFlags.REPLY_MORE));
    }

    return statsReplyBuilder.build();
}
 
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:23,代码来源:ControllerTest.java

示例5: getInstructions

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
private List<OFInstruction> getInstructions(OFFlowStatsEntry entry) {
    switch (entry.getVersion()) {
        case OF_10:
            return Lists.newArrayList(
                    OFFactoryVer13.INSTANCE.instructions().applyActions(entry.getActions()));
        case OF_11:
        case OF_12:
        case OF_13:
        case OF_14:
        case OF_15:
            return entry.getInstructions();
        default:
            log.warn("Unknown OF version {}", entry.getVersion());
    }
    return Lists.newLinkedList();
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:17,代码来源:FlowEntryBuilder.java

示例6: getFlows

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
@Get("json")
@SuppressWarnings("unchecked")
public Map<String, Object> getFlows() {
    Map<String, Object> response = new HashMap<>();
    String switchId = (String) this.getRequestAttributes().get("switch_id");
    logger.debug("Get flows for switch: {}", switchId);
    ISwitchManager switchManager = (ISwitchManager) getContext().getAttributes()
            .get(ISwitchManager.class.getCanonicalName());

    try {
        OFFlowStatsReply replay = switchManager.dumpFlowTable(DatapathId.of(switchId));
        logger.debug("OF_STATS: {}", replay);

        if (replay != null) {
            for (OFFlowStatsEntry entry : replay.getEntries()) {
                String key = String.format("flow-0x%s",
                        Long.toHexString(entry.getCookie().getValue()).toUpperCase());
                response.put(key, buildFlowStat(entry));
            }
        }
    } catch (IllegalArgumentException exception) {
        String messageString = "No such switch";
        logger.error("{}: {}", messageString, switchId, exception);
        MessageError responseMessage = new MessageError(DEFAULT_CORRELATION_ID, System.currentTimeMillis(),
                ErrorType.PARAMETERS_INVALID.toString(), messageString, exception.getMessage());
        response.putAll(MAPPER.convertValue(responseMessage, Map.class));
    }
    return response;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:30,代码来源:FlowsResource.java

示例7: publishFlowStats

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
private synchronized Collection<OFFlowStatsEntry> publishFlowStats(Dpid dpid,
                                                                   OFFlowStatsReply reply) {
    //TODO: Get rid of synchronized
    fullFlowStats.putAll(dpid, reply.getEntries());
    if (!reply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
        return fullFlowStats.removeAll(dpid);
    }
    return null;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:OpenFlowControllerImpl.java

示例8: FlowEntryBuilder

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
public FlowEntryBuilder(DeviceId deviceId, OFFlowStatsEntry entry, DriverService driverService) {
    this.stat = entry;
    this.match = entry.getMatch();
    this.instructions = getInstructions(entry);
    this.deviceId = deviceId;
    this.removed = null;
    this.flowMod = null;
    this.type = FlowType.STAT;
    this.driverService = driverService;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:11,代码来源:FlowEntryBuilder.java

示例9: getInstructions

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
private List<OFInstruction> getInstructions(OFFlowStatsEntry entry) {
    switch (entry.getVersion()) {
        case OF_10:
            return Lists.newArrayList(
                    OFFactoryVer13.INSTANCE.instructions().applyActions(entry.getActions()));
        case OF_11:
        case OF_12:
        case OF_13:
            return entry.getInstructions();
        default:
            log.warn("Unknown OF version {}", entry.getVersion());
    }
    return Lists.newLinkedList();
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:FlowEntryBuilder.java

示例10: getApplicationInfoFromInternalFlowTable

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
public Map<OFFlowStatsEntry, FlowEntry> getApplicationInfoFromInternalFlowTable(
        Dpid dpid,
        List<OFFlowStatsEntry> statsEntries) {

    //private DeviceId deviceId = DeviceId.deviceId("of:0000000000000001");
    DeviceId deviceId = DeviceId.deviceId(dpid.uri(dpid));

    /**
     *TODO optimize mechanism for comparing between incoming and internal one.
     */
    Map<OFFlowStatsEntry, FlowEntry> flowEntiresWithFlowInformation = new HashMap<>();

    Iterable<FlowEntry> internalFlowEntries = flowRuleService.getFlowEntries(deviceId);

    for (int i = 0; i < statsEntries.size(); i++) {
        OFFlowStatsEntry entry = statsEntries.get(i);
        TrafficSelector inSelector =
                featureCollectorProviderUtil.buildSelector(entry.getMatch());
        for (FlowEntry flowEntry : internalFlowEntries) {
            if (flowEntry.selector().equals(inSelector)) {
                flowEntiresWithFlowInformation.put(entry, flowEntry);
                break;
            }

        }
    }
    return flowEntiresWithFlowInformation;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:29,代码来源:FeatureCollectorProvider.java

示例11: FlowEntryBuilder

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
public FlowEntryBuilder(Dpid dpid, OFFlowStatsEntry entry, Type tableType) {
    this.stat = entry;
    this.match = entry.getMatch();
    this.instructions = getInstructions(entry);
    this.dpid = dpid;
    this.removed = null;
    this.flowMod = null;
    this.type = FlowType.STAT;
    this.tableType = tableType;
}
 
开发者ID:ravikumaran2015,项目名称:ravikumaran201504,代码行数:11,代码来源:FlowEntryBuilder.java

示例12: deleteflowentry

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
private void deleteflowentry(DatapathId src,OFFlowStatsEntry entry){
	OFFlowMod.Builder fmb = switchService.getSwitch(src).getOFFactory().buildFlowDelete();
	fmb.setMatch(entry.getMatch()) 
	.setActions(entry.getActions())
	.setIdleTimeout(entry.getIdleTimeout())
	.setHardTimeout(entry.getHardTimeout());
	switchService.getSwitch(src).write(fmb.build());
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:9,代码来源:failure_detection.java

示例13: sumflows

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
/**
 * ͳ�Ʒ�������������ɾ��ԭʼ���������ɾ������Ϊ֮����·����ȼ����ߵ������
 * @param sw
 * @param values
 * @return
 */
protected long sumflows(DatapathId sw, List<OFFlowStatsReply> values){
	long sum=0;
	OFFlowStatsReply value=values.get(0);
	List<OFFlowStatsEntry> entries = value.getEntries();
	for(OFFlowStatsEntry entry: entries){
		long bc = entry.getByteCount().getValue();
		sum += bc;
		deleteflowentry(sw,entry);
	}
	return sum;
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:18,代码来源:Massive_failure_recovery.java

示例14: deleteflowentry

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
/**
 * ɾ��ԭʼ������
 * @param src
 * @param entry
 */
private void deleteflowentry(DatapathId src,OFFlowStatsEntry entry){
	OFFlowMod.Builder fmb = switchService.getSwitch(src).getOFFactory().buildFlowDelete();
	fmb.setMatch(entry.getMatch())
	//.setActions(entry.getActions())
	.setActions(((OFInstructionApplyActions)entry.getInstructions().get(0)).getActions())
	.setIdleTimeout(entry.getIdleTimeout())
	.setHardTimeout(entry.getHardTimeout());
	switchService.getSwitch(src).write(fmb.build());
}
 
开发者ID:pixuan,项目名称:floodlight,代码行数:15,代码来源:Massive_failure_recovery.java

示例15: getActions

import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry; //导入依赖的package包/类
public static List<OFAction> getActions(OFFlowStatsEntry e) {
    if(e.getVersion() == OFVersion.OF_10) {
        return e.getActions();
    } else {
        for(OFInstruction i: e.getInstructions()) {
            if(i.getType() == OFInstructionType.APPLY_ACTIONS) {
                return ((OFInstructionApplyActions) i).getActions();
            }
        }
        return ImmutableList.of();
    }
}
 
开发者ID:o3project,项目名称:openflowj-otn,代码行数:13,代码来源:ActionUtils.java


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