Search in sources :

Example 1 with OFMeterConfigStatsRequest

use of org.projectfloodlight.openflow.protocol.OFMeterConfigStatsRequest in project open-kilda by telstra.

the class SwitchManager method dumpMeters.

/**
 * {@inheritDoc}
 */
@Override
public OFMeterConfigStatsReply dumpMeters(final DatapathId dpid) throws SwitchOperationException {
    OFMeterConfigStatsReply values = null;
    IOFSwitch sw = lookupSwitch(dpid);
    if (sw == null) {
        throw new IllegalArgumentException(String.format("Switch %s was not found", dpid.toString()));
    }
    OFFactory ofFactory = sw.getOFFactory();
    OFMeterConfigStatsRequest meterRequest = ofFactory.buildMeterConfigStatsRequest().setMeterId(0xffffffff).build();
    try {
        ListenableFuture<OFMeterConfigStatsReply> future = sw.writeRequest(meterRequest);
        values = future.get(5, TimeUnit.SECONDS);
    } catch (ExecutionException | InterruptedException | TimeoutException e) {
        logger.error("Could not get meter config stats: {}", e.getMessage());
    }
    return values;
}
Also used : OFMeterConfigStatsRequest(org.projectfloodlight.openflow.protocol.OFMeterConfigStatsRequest) OFMeterConfigStatsReply(org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)1 OFMeterConfigStatsReply (org.projectfloodlight.openflow.protocol.OFMeterConfigStatsReply)1 OFMeterConfigStatsRequest (org.projectfloodlight.openflow.protocol.OFMeterConfigStatsRequest)1