本文整理汇总了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;
}
示例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;
}
示例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;
}