use of org.projectfloodlight.openflow.protocol.OFGroupDescStatsRequest in project open-kilda by telstra.
the class SwitchManager method dumpGroups.
private List<OFGroupDescStatsEntry> dumpGroups(IOFSwitch sw) {
OFFactory ofFactory = sw.getOFFactory();
OFGroupDescStatsRequest groupRequest = ofFactory.buildGroupDescStatsRequest().build();
List<OFGroupDescStatsReply> replies;
try {
ListenableFuture<List<OFGroupDescStatsReply>> future = sw.writeStatsRequest(groupRequest);
replies = future.get(10, TimeUnit.SECONDS);
} catch (ExecutionException | TimeoutException e) {
logger.error("Could not dump groups on switch {}.", sw.getId(), e);
return Collections.emptyList();
} catch (InterruptedException e) {
logger.error("Could not dump groups on switch {}.", sw.getId(), e);
Thread.currentThread().interrupt();
return Collections.emptyList();
}
return replies.stream().map(OFGroupDescStatsReply::getEntries).flatMap(List::stream).collect(toList());
}
Aggregations