Java 类org.projectfloodlight.openflow.protocol.OFEchoReply 实例源码

项目:athena    文件:OFChannelHandler.java   
void processOFEchoRequest(OFChannelHandler h, OFEchoRequest m)
        throws IOException {
    if (h.ofVersion == null) {
        log.error("No OF version set for {}. Not sending Echo REPLY",
                h.channel.getRemoteAddress());
        return;
    }
    OFFactory factory = (h.ofVersion == OFVersion.OF_13) ?
            h.controller.getOFMessageFactory13() : h.controller.getOFMessageFactory10();
            OFEchoReply reply = factory
                    .buildEchoReply()
                    .setXid(m.getXid())
                    .setData(m.getData())
                    .build();
            h.channel.write(Collections.singletonList(reply));
}
项目:fresco_floodlight    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isActive()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:fresco_floodlight    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:iTAP-controller    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:iTAP-controller    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isConnected()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:iTAP-controller    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:SDN-Multicast    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isActive()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:SDN-Multicast    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:arscheduler    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isActive()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:arscheduler    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight1.2-delay    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isActive()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight1.2-delay    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight-hardware    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isActive()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight-hardware    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:ACAMPController    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isActive()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:ACAMPController    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:fast-failover-demo    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:fast-failover-demo    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isConnected()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:fast-failover-demo    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:ravikumaran201504    文件:OFChannelHandler.java   
void processOFEchoRequest(OFChannelHandler h, OFEchoRequest m)
        throws IOException {
    if (h.ofVersion == null) {
        log.error("No OF version set for {}. Not sending Echo REPLY",
                h.channel.getRemoteAddress());
        return;
    }
    OFFactory factory = (h.ofVersion == OFVersion.OF_13) ?
            h.controller.getOFMessageFactory13() : h.controller.getOFMessageFactory10();
            OFEchoReply reply = factory
                    .buildEchoReply()
                    .setXid(m.getXid())
                    .setData(m.getData())
                    .build();
            h.channel.write(Collections.singletonList(reply));
}
项目:floodlightLB    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlightLB    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isConnected()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlightLB    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:DSC    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:DSC    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isConnected()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:DSC    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestNotConnectedFailure() throws InterruptedException,
        ExecutionException {
    EasyMock.expect(channel.isConnected()).andReturn(Boolean.FALSE).anyTimes();
    replay(channel);

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestDisconnectFailure() throws InterruptedException, ExecutionException {
    prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);

    assertThat("Connection should have 1 pending request", conn.getPendingRequestIds().size(),
            equalTo(1));
    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    conn.disconnected();

    SwitchDisconnectedException e =
            FutureTestUtils.assertFutureFailedWithException(future,
                    SwitchDisconnectedException.class);
    assertThat(e.getId(), equalTo(switchId));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:athena    文件:OFChannelHandler.java   
@Override
void processOFMessage(OFChannelHandler h, OFMessage m)
        throws IOException, SwitchStateException {

    if (h.sw.isDriverHandshakeComplete()) {
        moveToActive(h);
        h.state.processOFMessage(h, m);
        return;

    }

    if (m.getType() == OFType.ECHO_REQUEST) {
        processOFEchoRequest(h, (OFEchoRequest) m);
    } else if (m.getType() == OFType.ECHO_REPLY) {
        processOFEchoReply(h, (OFEchoReply) m);
    } else if (m.getType() == OFType.ROLE_REPLY) {
        h.sw.handleRole(m);
    } else if (m.getType() == OFType.ERROR) {
        if (!h.sw.handleRoleError((OFErrorMsg)m)) {
            h.sw.processDriverHandshakeMessage(m);
            if (h.sw.isDriverHandshakeComplete()) {
                moveToActive(h);
            }
        }
    } else {
        if (m.getType() == OFType.EXPERIMENTER &&
                ((OFExperimenter) m).getExperimenter() ==
                RoleManager.NICIRA_EXPERIMENTER) {
            h.sw.handleNiciraRole(m);
        } else {
            h.sw.processDriverHandshakeMessage(m);
            if (h.sw.isDriverHandshakeComplete()) {
                moveToActive(h);
            }
        }
    }
}
项目:fresco_floodlight    文件:OFChannelHandler.java   
private void sendEchoReply(OFEchoRequest request) {
    OFEchoReply reply = factory.buildEchoReply()
            .setXid(request.getXid())
            .setData(request.getData())
            .build();
    write(reply);
}
项目:fresco_floodlight    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    eventLoop.runTasks();
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:iTAP-controller    文件:OFChannelHandler.java   
private void sendEchoReply(OFEchoRequest request) {
    OFEchoReply reply = factory.buildEchoReply()
            .setXid(request.getXid())
            .setData(request.getData())
            .build();
    channel.write(Collections.singletonList(reply));
}
项目:SDN-Multicast    文件:OFChannelHandler.java   
private void sendEchoReply(OFEchoRequest request) {
    OFEchoReply reply = factory.buildEchoReply()
            .setXid(request.getXid())
            .setData(request.getData())
            .build();
    write(reply);
}
项目:SDN-Multicast    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    eventLoop.runTasks();
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:arscheduler    文件:OFChannelHandler.java   
private void sendEchoReply(OFEchoRequest request) {
    OFEchoReply reply = factory.buildEchoReply()
            .setXid(request.getXid())
            .setData(request.getData())
            .build();
    write(reply);
}
项目:arscheduler    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    eventLoop.runTasks();
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight1.2-delay    文件:OFChannelHandler.java   
private void sendEchoReply(OFEchoRequest request) {
    OFEchoReply reply = factory.buildEchoReply()
            .setXid(request.getXid())
            .setData(request.getData())
            .build();

log.info("》》》》》》》》》》》》》》》》EchoReply-xid :  ");
    //不显示

    write(reply);
}
项目:floodlight1.2-delay    文件:OFConnectionTest.java   
@Test(timeout = 5000)
public void testWriteRequestSuccess() throws InterruptedException, ExecutionException {
    Capture<List<OFMessage>> cMsgList = prepareChannelForWriteList();

    OFEchoRequest echoRequest = factory.echoRequest(new byte[] {});
    ListenableFuture<OFEchoReply> future = conn.writeRequest(echoRequest);
    assertThat("Connection should have 1 pending request",
            conn.getPendingRequestIds().size(), equalTo(1));

    eventLoop.runTasks();
    assertThat("Should have captured MsgList", cMsgList.getValue(),
            Matchers.<OFMessage> contains(echoRequest));

    assertThat("Future should not be complete yet", future.isDone(), equalTo(false));

    OFEchoReply echoReply = factory.buildEchoReply()
            .setXid(echoRequest.getXid())
            .build();

    assertThat("Connection should have accepted the response",
            conn.deliverResponse(echoReply),
            equalTo(true));
    assertThat("Future should be complete ", future.isDone(), equalTo(true));
    assertThat(future.get(), equalTo(echoReply));
    assertThat("Connection should have no pending requests",
            conn.getPendingRequestIds().isEmpty(), equalTo(true));
}
项目:floodlight-hardware    文件:OFChannelHandler.java   
private void sendEchoReply(OFEchoRequest request) {
    OFEchoReply reply = factory.buildEchoReply()
            .setXid(request.getXid())
            .setData(request.getData())
            .build();
    write(reply);
}