/** * 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); }