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


Java IOFSwitch.writeRequest方法代码示例

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


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

示例1: dumpMeters

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public OFMeterConfigStatsReply dumpMeters(final DatapathId dpid) {
    OFMeterConfigStatsReply values = null;
    IOFSwitch sw = ofSwitchService.getSwitch(dpid);
    if (sw == null) {
        throw new IllegalArgumentException(String.format("Switch %s was not found", dpid.toString()));
    }

    OFFactory ofFactory = sw.getOFFactory();
    OFMeterConfigStatsRequest meterRequest = ofFactory.buildMeterConfigStatsRequest()
            .setMeterId(0xffffffff)
            .build();

    try {
        ListenableFuture<OFMeterConfigStatsReply> future = sw.writeRequest(meterRequest);
        values = future.get(5, TimeUnit.SECONDS);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
        logger.error("Could not get meter config stats: {}", e.getMessage());
    }

    return values;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:26,代码来源:SwitchManager.java

示例2: getSwitchFeaturesReply

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
protected OFFeaturesReply getSwitchFeaturesReply(DatapathId switchId) {
	IOFSwitchService switchService =
			(IOFSwitchService) getContext().getAttributes().
			get(IOFSwitchService.class.getCanonicalName());

	IOFSwitch sw = switchService.getSwitch(switchId);
	Future<OFFeaturesReply> future;
	OFFeaturesReply featuresReply = null;
	OFFeaturesRequest featuresRequest = sw.getOFFactory().buildFeaturesRequest().build();
	if (sw != null) {
		try {
			future = sw.writeRequest(featuresRequest);
			featuresReply = future.get(10, TimeUnit.SECONDS);
		} catch (Exception e) {
			log.error("Failure getting features reply from switch" + sw, e);
		}
	}

	return featuresReply;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:SwitchResourceBase.java

示例3: dumpFlowTable

import net.floodlightcontroller.core.IOFSwitch; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public OFFlowStatsReply dumpFlowTable(final DatapathId dpid) {
    OFFlowStatsReply values = null;
    IOFSwitch sw = ofSwitchService.getSwitch(dpid);
    if (sw == null) {
        throw new IllegalArgumentException(String.format("Switch %s was not found", dpid.toString()));
    }

    OFFactory ofFactory = sw.getOFFactory();
    OFFlowStatsRequest flowRequest = ofFactory.buildFlowStatsRequest()
            .setMatch(sw.getOFFactory().matchWildcardAll())
            .setTableId(TableId.ALL)
            .setOutPort(OFPort.ANY)
            .setOutGroup(OFGroup.ANY)
            .setCookieMask(U64.ZERO)
            .build();

    try {
        ListenableFuture<OFFlowStatsReply> future = sw.writeRequest(flowRequest);
        values = future.get(10, TimeUnit.SECONDS);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
        logger.error("Could not get flow stats: {}", e.getMessage());
    }

    return values;
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:30,代码来源:SwitchManager.java


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