Java 类net.floodlightcontroller.core.internal.OFSwitchHandshakeHandler.QuarantineState 实例源码

项目:fresco_floodlight    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:iTAP-controller    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
               CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:SDN-Multicast    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:arscheduler    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:floodlight1.2-delay    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:floodlight-hardware    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:ACAMPController    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:fast-failover-demo    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:floodlightLB    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
            CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:DSC    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
               CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}
项目:floodlight    文件:OFSwitchHandlerTestBase.java   
/**
 * Tests a situation where a switch returns a QUARANTINE result. This means
 * we should move the handshake handler to a quarantine state and also
 * quarantine the switch in the controller.
 *
 * @throws Exception
 */
@Test
public void moveQuarantine() throws Exception {
    moveToWaitAppHandshakeState();

    reset(switchManager);
    switchManager.switchStatusChanged(sw, SwitchStatus.HANDSHAKE, SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(switchManager);

    assertThat(switchHandler.getStateForTesting(), CoreMatchers.instanceOf(WaitAppHandshakeState.class));
    WaitAppHandshakeState state = (WaitAppHandshakeState) switchHandler.getStateForTesting();
    assertThat(state.getCurrentPlugin(), CoreMatchers.<OFSwitchAppHandshakePlugin>equalTo(handshakePlugin));

    reset(sw);
    expect(sw.getStatus()).andReturn(SwitchStatus.HANDSHAKE);
    sw.setStatus(SwitchStatus.QUARANTINED);
    expectLastCall().once();
    replay(sw);

    PluginResult result = new PluginResult(PluginResultType.QUARANTINE, "test quarantine");
    handshakePlugin.exitPlugin(result);

    assertThat(switchHandler.getStateForTesting(),
               CoreMatchers.instanceOf(QuarantineState.class));
    verify(switchManager);
}