本文整理汇总了Java中org.projectfloodlight.openflow.protocol.OFStatsReply类的典型用法代码示例。如果您正苦于以下问题:Java OFStatsReply类的具体用法?Java OFStatsReply怎么用?Java OFStatsReply使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OFStatsReply类属于org.projectfloodlight.openflow.protocol包,在下文中一共展示了OFStatsReply类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDriverHandshakeMessage
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
public void processDriverHandshakeMessage(OFMessage m) {
if (!startDriverHandshakeCalled) {
throw new SwitchDriverSubHandshakeNotStarted();
}
if (driverHandshakeComplete.get()) {
throw new SwitchDriverSubHandshakeCompleted(m);
}
log.debug("processDriverHandshakeMessage for sw {}", getStringId());
switch (m.getType()) {
case STATS_REPLY: // multipart message is reported as STAT
processOFMultipartReply((OFStatsReply) m);
break;
default:
log.warn("Received message {} during switch-driver " +
"subhandshake " + "from switch {} ... " +
"Ignoring message", m,
getStringId());
}
}
示例2: processOFMultipartReply
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
private void processOFMultipartReply(OFStatsReply stats) {
log.debug("Received message {} during switch-driver " +
"subhandshake " + "from switch {} ... " +
stats,
getStringId());
if (stats.getStatsType() == OFStatsType.EXPERIMENTER) {
try {
OFExpPortDescReply expPortDescReply = (OFExpPortDescReply) stats;
expPortDes.addAll(expPortDescReply.getEntries());
if (!expPortDescReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
driverHandshakeComplete.set(true);
return;
}
} catch (ClassCastException e) {
log.error("Unexspected Experimenter Multipart message type {} ",
stats.getClass().getName());
}
}
}
示例3: handleMessage
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
public void handleMessage(Dpid dpid, OFMessage msg) {
switch (msg.getType()) {
case STATS_REPLY:
pushMeterStats(dpid, (OFStatsReply) msg);
break;
case ERROR:
OFErrorMsg error = (OFErrorMsg) msg;
if (error.getErrType() == OFErrorType.METER_MOD_FAILED) {
MeterOperation op =
pendingOperations.getIfPresent(error.getXid());
pendingOperations.invalidate(error.getXid());
if (op == null) {
log.warn("Unknown Meter operation failed {}", error);
} else {
OFMeterModFailedErrorMsg meterError =
(OFMeterModFailedErrorMsg) error;
signalMeterError(meterError, op);
}
}
break;
default:
break;
}
}
示例4: processOFStatsReply
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
/**
* Accumulate a list of the OFTableFeaturesStatsReply's until there
* are no more remaining. Then, pass the list to the switch for
* parsing and configuration.
*
* The assumption is that the OFMessage dispatcher will call this each
* time, which it does. We don't loop and receive here.
*
* @param m, The potential OFTableFeaturesStatsReply message we want to include
*/
void processOFStatsReply(OFStatsReply m) {
if (m.getStatsType() == OFStatsType.TABLE_FEATURES) {
replies.add((OFTableFeaturesStatsReply) m);
if (!((OFTableFeaturesStatsReply)m).getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
handleTableFeaturesMessage(replies, false);
nextState();
}
} else {
/* should only receive TABLE_FEATURES here */
log.error("Received {} message but expected TABLE_FEATURES.", m.getStatsType().toString());
}
}
示例5: writeStatsRequest
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public <REPLY extends OFStatsReply> ListenableFuture<List<REPLY>> writeStatsRequest(OFStatsRequest<REPLY> request) {
ListenableFuture<List<REPLY>> ofStatsFuture =
EasyMock.createNiceMock(ListenableFuture.class);
// We create a mock future and return info from the map
try {
OFStatsType statsType = request.getStatsType();
List<REPLY> replies = (List<REPLY>) statsMap.get(statsType);
EasyMock.expect(ofStatsFuture.get(EasyMock.anyLong(),
EasyMock.anyObject(TimeUnit.class))).andReturn(replies).anyTimes();
EasyMock.expect(ofStatsFuture.get()).andReturn(replies).anyTimes();
EasyMock.replay(ofStatsFuture);
} catch (Exception e) {
throw new RuntimeException(e);
}
return ofStatsFuture;
}
示例6: processOFStatsReply
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
/**
* Accumulate a list of the OFTableFeaturesStatsReply's until there
* are no more remaining. Then, pass the list to the switch for
* parsing and configuration.
*
* The assumption is that the OFMessage dispatcher will call this each
* time, which it does. We don't loop and receive here.
*
* @param m, The potential OFTableFeaturesStatsReply message we want to include
*/
void processOFStatsReply(OFStatsReply m) {
if (m.getStatsType() == OFStatsType.TABLE_FEATURES) {
replies.add((OFTableFeaturesStatsReply) m);
if (!((OFTableFeaturesStatsReply)m).getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
handleTableFeaturesMessage(replies, false);
nextState();
}
} else {
/* should only receive TABLE_FEATURES here */
log.error("Received {} message but expected TABLE_FEATURES.", m.getStatsType().toString());
}
}
示例7: processOFStatisticsReply
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
throws SwitchStateException {
// Read port description
if (m.getStatsType() != OFStatsType.PORT_DESC) {
log.warn("Expecting port description stats but received stats "
+ "type {} from {}. Ignoring ...", m.getStatsType(),
h.channel.getRemoteAddress());
return;
}
if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
log.debug("Stats reply indicates more stats from sw {} for "
+ "port description",
h.getSwitchInfoString());
h.portDescReplies.add((OFPortDescStatsReply)m);
return;
}
else {
h.portDescReplies.add((OFPortDescStatsReply)m);
}
//h.portDescReply = (OFPortDescStatsReply) m; // temp store
log.info("Received port desc reply for switch at {}",
h.getSwitchInfoString());
try {
h.sendHandshakeSetConfig();
} catch (IOException e) {
log.error("Unable to send setConfig after PortDescReply. "
+ "Error: {}", e.getMessage());
}
h.setState(WAIT_CONFIG_REPLY);
}
示例8: handleMessage
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
public void handleMessage(Dpid dpid, OFMessage msg) {
if (isDisabled) {
return;
}
try {
switch (msg.getType()) {
case STATS_REPLY:
if (((OFStatsReply) msg).getStatsType() == OFStatsType.PORT) {
OFPortStatsReply portStatsReply = (OFPortStatsReply) msg;
List<OFPortStatsEntry> portStatsReplyList = portStatsReplies.get(dpid);
if (portStatsReplyList == null) {
portStatsReplyList = Lists.newCopyOnWriteArrayList();
}
portStatsReplyList.addAll(portStatsReply.getEntries());
portStatsReplies.put(dpid, portStatsReplyList);
if (!portStatsReply.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
List<OFPortStatsEntry> statsEntries = portStatsReplies.get(dpid);
if (statsEntries != null) {
pushPortMetrics(dpid, statsEntries);
statsEntries.clear();
}
}
}
break;
case ERROR:
if (((OFErrorMsg) msg).getErrType() == OFErrorType.PORT_MOD_FAILED) {
LOG.error("port mod failed");
}
default:
break;
}
} catch (IllegalStateException e) {
// system is shutting down and the providerService is no longer
// valid. Messages cannot be processed.
}
}
示例9: processOFMessage
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
/**
* Process an OF message received on the channel and
* update state accordingly.
*
* The main "event" of the state machine. Process the received message,
* send follow up message if required and update state if required.
*
* Switches on the message type and calls more specific event handlers
* for each individual OF message type. If we receive a message that
* is supposed to be sent from a controller to a switch we throw
* a SwitchStateExeption.
*
* The more specific handlers can also throw SwitchStateExceptions
*
* @param h The OFChannelHandler that received the message
* @param m The message we received.
* @throws SwitchStateException
* @throws IOException
*/
void processOFMessage(OFMessage m) {
roleChanger.checkTimeout();
switch(m.getType()) {
case BARRIER_REPLY:
processOFBarrierReply((OFBarrierReply) m);
break;
case ERROR:
processOFError((OFErrorMsg) m);
break;
case FLOW_REMOVED:
processOFFlowRemoved((OFFlowRemoved) m);
break;
case GET_CONFIG_REPLY:
processOFGetConfigReply((OFGetConfigReply) m);
break;
case PACKET_IN:
processOFPacketIn((OFPacketIn) m);
break;
case PORT_STATUS:
processOFPortStatus((OFPortStatus) m);
break;
case QUEUE_GET_CONFIG_REPLY:
processOFQueueGetConfigReply((OFQueueGetConfigReply) m);
break;
case STATS_REPLY:
processOFStatsReply((OFStatsReply) m);
break;
case ROLE_REPLY:
processOFRoleReply((OFRoleReply) m);
break;
case EXPERIMENTER:
processOFExperimenter((OFExperimenter) m);
break;
default:
illegalMessageReceived(m);
break;
}
}
示例10: processOFStatsReply
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
void processOFStatsReply(OFStatsReply m) {
switch(m.getStatsType()) {
case PORT_DESC:
processPortDescStatsReply((OFPortDescStatsReply) m);
break;
default:
unhandledMessageReceived(m);
}
}
示例11: processDriverHandshakeMessage
import org.projectfloodlight.openflow.protocol.OFStatsReply; //导入依赖的package包/类
@Override
public void processDriverHandshakeMessage(OFMessage m) {
if (!startDriverHandshakeCalled) {
throw new SwitchDriverSubHandshakeNotStarted();
}
if (driverHandshakeComplete.get()) {
throw new SwitchDriverSubHandshakeCompleted(m);
}
switch (m.getType()) {
case BARRIER_REPLY:
log.debug("OPLK ROADM Received barrier response");
break;
case ERROR:
log.error("Switch {} Error {}", getStringId(), m);
break;
case FEATURES_REPLY:
break;
case FLOW_REMOVED:
break;
case GET_ASYNC_REPLY:
break;
case PACKET_IN:
break;
case PORT_STATUS:
processOFPortStatus((OFCircuitPortStatus) m);
break;
case QUEUE_GET_CONFIG_REPLY:
break;
case ROLE_REPLY:
break;
case STATS_REPLY:
OFStatsReply stats = (OFStatsReply) m;
if (stats.getStatsType() == OFStatsType.EXPERIMENTER) {
log.warn("OPLK ROADM : Received multipart (port desc) reply message {}", m);
//OTN Optical extension 1.0 port-desc
createOpticalPortList((OFCircuitPortsReply) m);
driverHandshakeComplete.set(true);
}
break;
default:
log.warn("Received message {} during switch-driver " +
"subhandshake " + "from switch {} ... " +
"Ignoring message", m,
getStringId());
}
}