Skip to content
Snippets Groups Projects
Commit 928c293a authored by Andreas Wundsam's avatar Andreas Wundsam
Browse files

floodlight/OFStatisticsMessageBase: add convenience method that returns the...

floodlight/OFStatisticsMessageBase: add convenience method that returns the first stats-req/reply message dcontained in the body
parent bf13c98b
No related branches found
No related tags found
No related merge requests found
......@@ -78,6 +78,23 @@ public abstract class OFStatisticsMessageBase extends OFMessage implements
return statistics;
}
/**
* return the first statistics request in the list of statistics, for
* statistics messages that expect exactly one message in their body (e.g.,
* flow stats request, port statsrequest)
*
* @return the first and only element in the list of statistics
* @throw NoSuchElementException if the list does not contain exactly one
* element
*/
public OFStatistics getFirstStatistics() {
if (statistics == null || statistics.size() != 1) {
throw new IllegalArgumentException("Invariant violation: statistics message of type "+statisticType+" contains "+statistics.size() +" statreq/reply messages in its body (should be 1)");
}
return statistics.get(0);
}
/**
* @param statistics the statistics to set
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment