use of org.projectfloodlight.openflow.protocol.OFBarrierReply in project open-kilda by telstra.
the class SwitchManagerTest method mockBarrierRequest.
private void mockBarrierRequest() throws InterruptedException, ExecutionException, TimeoutException {
OFBarrierReply ofBarrierReply = mock(OFBarrierReply.class);
ListenableFuture<OFBarrierReply> ofBarrierFuture = mock(ListenableFuture.class);
expect(ofBarrierFuture.get(anyLong(), anyObject())).andStubReturn(ofBarrierReply);
replay(ofBarrierFuture);
expect(iofSwitch.writeRequest(anyObject(OFBarrierRequest.class))).andStubReturn(ofBarrierFuture);
}
use of org.projectfloodlight.openflow.protocol.OFBarrierReply in project open-kilda by telstra.
the class SwitchManager method sendBarrierRequest.
private OFBarrierReply sendBarrierRequest(IOFSwitch sw) {
OFFactory ofFactory = sw.getOFFactory();
OFBarrierRequest barrierRequest = ofFactory.buildBarrierRequest().build();
OFBarrierReply result = null;
try {
ListenableFuture<OFBarrierReply> future = sw.writeRequest(barrierRequest);
result = future.get(10, TimeUnit.SECONDS);
} catch (ExecutionException | TimeoutException e) {
logger.error("Could not get a barrier reply for {}.", sw.getId(), e);
} catch (InterruptedException e) {
logger.error("Could not get a barrier reply for {}.", sw.getId(), e);
Thread.currentThread().interrupt();
}
return result;
}
Aggregations