Search in sources :

Example 1 with OFBarrierReply

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);
}
Also used : OFBarrierReply(org.projectfloodlight.openflow.protocol.OFBarrierReply) OFBarrierRequest(org.projectfloodlight.openflow.protocol.OFBarrierRequest)

Example 2 with OFBarrierReply

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;
}
Also used : OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFBarrierReply(org.projectfloodlight.openflow.protocol.OFBarrierReply) OFBarrierRequest(org.projectfloodlight.openflow.protocol.OFBarrierRequest) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException)

Aggregations

OFBarrierReply (org.projectfloodlight.openflow.protocol.OFBarrierReply)2 OFBarrierRequest (org.projectfloodlight.openflow.protocol.OFBarrierRequest)2 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)1