本文整理汇总了Java中org.openflow.protocol.OFStatisticsRequest.getStatisticType方法的典型用法代码示例。如果您正苦于以下问题:Java OFStatisticsRequest.getStatisticType方法的具体用法?Java OFStatisticsRequest.getStatisticType怎么用?Java OFStatisticsRequest.getStatisticType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openflow.protocol.OFStatisticsRequest
的用法示例。
在下文中一共展示了OFStatisticsRequest.getStatisticType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serializeMessage
import org.openflow.protocol.OFStatisticsRequest; //导入方法依赖的package包/类
/**
* Serializes an Openflow Statistics Request message for Pyretic
* @param switchID switch id
* @param statsRequest object to be serialized
* @return
*/
public static String serializeMessage(long switchID, OFStatisticsRequest statsRequest) {
String retString="";
switch (statsRequest.getStatisticType()) {
case DESC:
break;
case FLOW:
retString = "[\"flow_stats_request\", " + switchID + "]" + "\n";
break;
case AGGREGATE:
case PORT:
retString = "[\"port_stats_request\", " + switchID + "]" + "\n"; //maybe portId is also required
case TABLE:
case VENDOR:
case QUEUE:
}
return retString;
}
示例2: handleStatsRequest
import org.openflow.protocol.OFStatisticsRequest; //导入方法依赖的package包/类
private void handleStatsRequest(OFMessage msg){
OFStatisticsRequest request = (OFStatisticsRequest) msg;
switch(request.getStatisticType()){
case FLOW:
handleFlowStatsRequest(msg);
return;
case DESC:
handleDescrStatsRequest(msg);
return;
case VENDOR:
handleVendorStatsRequest(msg);
return;
case AGGREGATE:
handleAggregateStatsRequest(msg);
return;
case TABLE:
handleTableStatsRequest(msg);
return;
case PORT:
handlePortStatsRequest(msg);
return;
case QUEUE:
handleQueueStatsRequest(msg);
return;
}
}
示例3: getStatistics
import org.openflow.protocol.OFStatisticsRequest; //导入方法依赖的package包/类
@Override
public synchronized Future<List<OFStatistics>> getStatistics(OFStatisticsRequest request) throws IOException {
if (request == null) {
throw new UnsupportedOperationException("Not supported.");
}
if (request.getStatisticType() == null
|| !request.getStatisticType().equals(OFStatisticsType.PORT)) {
throw new UnsupportedOperationException("Not supported.");
}
if (request.getStatistics() == null
|| request.getStatistics().size() != 1) {
throw new UnsupportedOperationException("Not supported.");
}
if (!request.getStatistics().get(0).getClass()
.equals(OFPortStatisticsRequest.class)) {
throw new UnsupportedOperationException("Not supported.");
}
final short port = ((OFPortStatisticsRequest) request.getStatistics()
.get(0)).getPortNumber();
return new Future<List<OFStatistics>>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return true;
}
@Override
public List<OFStatistics> get() throws InterruptedException, ExecutionException {
OFPortStatisticsReply reply = new OFPortStatisticsReply();
reply.setTransmitBytes(traffic.get(port));
List<OFStatistics> result = new ArrayList<>();
result.add(reply);
return result;
}
@Override
public List<OFStatistics> get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException,
TimeoutException {
return get();
}
};
}