use of org.openkilda.floodlight.utils.NewCorrelationContextRequired in project open-kilda by telstra.
the class InputService method receive.
@Override
@NewCorrelationContextRequired
public Command receive(IOFSwitch sw, OFMessage message, FloodlightContext context) {
// must be constructed as early as possible
final OfInput input = new OfInput(sw, message, context);
final String packetIdentity = String.format("(dpId: %s, xId: %s, version: %s, type: %s)", sw.getId(), message.getXid(), message.getVersion(), message.getType());
log.debug("{} - receive message {}", getClass().getCanonicalName(), packetIdentity);
try {
handle(input);
} catch (Exception e) {
log.error(String.format("Unhandled exception during processing %s", packetIdentity), e);
}
return Command.CONTINUE;
}
use of org.openkilda.floodlight.utils.NewCorrelationContextRequired in project open-kilda by telstra.
the class StatisticsService method gatherMeterStats.
@NewCorrelationContextRequired
private void gatherMeterStats(IOFSwitch iofSwitch) {
OFFactory factory = iofSwitch.getOFFactory();
SwitchId switchId = new SwitchId(iofSwitch.getId().getLong());
if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
OFMeterStatsRequest meterStatsRequest = factory.buildMeterStatsRequest().setMeterId(OFPM_ALL).build();
logger.info("Getting meter stats for switch={} OF-xid:{}", iofSwitch.getId(), meterStatsRequest.getXid());
Futures.addCallback(iofSwitch.writeStatsRequest(meterStatsRequest), new RequestCallback<>(data -> OfMeterStatsMapper.INSTANCE.toMeterStatsData(data, switchId), switchId, "meter"), directExecutor());
}
}
use of org.openkilda.floodlight.utils.NewCorrelationContextRequired in project open-kilda by telstra.
the class StatisticsService method gatherTableStats.
@NewCorrelationContextRequired
private void gatherTableStats(IOFSwitch iofSwitch) {
final SwitchId switchId = new SwitchId(iofSwitch.getId().getLong());
OFFactory factory = iofSwitch.getOFFactory();
OFTableStatsRequest flowStatsRequest = factory.buildTableStatsRequest().build();
logger.info("Getting table stats for switch={} OF-xid:{}", iofSwitch.getId(), flowStatsRequest.getXid());
if (factory.getVersion().compareTo(OFVersion.OF_13) >= 0) {
Function<List<OFTableStatsReply>, InfoData> converter = (response) -> {
List<TableStatsEntry> tableEntries = response.stream().filter(reply -> CollectionUtils.isNotEmpty(reply.getEntries())).map(OFTableStatsReply::getEntries).flatMap(List::stream).filter(entry -> entry.getActiveCount() != NumberUtils.LONG_ZERO).map(OfTableStatsMapper.INSTANCE::toTableStatsEntry).collect(Collectors.toList());
return SwitchTableStatsData.builder().switchId(switchId).tableStatsEntries(tableEntries).build();
};
RequestCallback<OFTableStatsReply> callback = new RequestCallback<>(converter, switchId, "table");
Futures.addCallback(iofSwitch.writeStatsRequest(flowStatsRequest), callback, directExecutor());
}
}
use of org.openkilda.floodlight.utils.NewCorrelationContextRequired in project open-kilda by telstra.
the class StatisticsService method gatherFlowStats.
@NewCorrelationContextRequired
private void gatherFlowStats(IOFSwitch iofSwitch) {
OFFactory factory = iofSwitch.getOFFactory();
final SwitchId switchId = new SwitchId(iofSwitch.getId().getLong());
OFFlowStatsRequest flowStatsRequest = factory.buildFlowStatsRequest().setOutGroup(OFGroup.ANY).build();
if (factory.getVersion().compareTo(OFVersion.OF_15) != 0) {
// skip flow stats for OF 1.5 protocol version
logger.info("Getting flow stats for switch={} OF-xid:{}", iofSwitch.getId(), flowStatsRequest.getXid());
Futures.addCallback(iofSwitch.writeStatsRequest(flowStatsRequest), new RequestCallback<>(data -> OfFlowStatsMapper.INSTANCE.toFlowStatsData(data, switchId), switchId, "flow"), directExecutor());
}
}
use of org.openkilda.floodlight.utils.NewCorrelationContextRequired in project open-kilda by telstra.
the class StatisticsService method gatherPortStats.
@NewCorrelationContextRequired
private void gatherPortStats(IOFSwitch iofSwitch) {
OFFactory factory = iofSwitch.getOFFactory();
SwitchId switchId = new SwitchId(iofSwitch.getId().getLong());
OFPortStatsRequest portStatsRequest = factory.buildPortStatsRequest().setPortNo(OFPort.ANY).build();
logger.info("Getting port stats for switch={} OF-xid:{}", iofSwitch.getId(), portStatsRequest.getXid());
Futures.addCallback(iofSwitch.writeStatsRequest(portStatsRequest), new RequestCallback<>(data -> OfPortStatsMapper.INSTANCE.toPostStatsData(data, switchId), switchId, "port"), directExecutor());
}
Aggregations