use of org.openkilda.wfm.topology.network.controller.bfd.BfdSessionAction.ActionResult in project open-kilda by telstra.
the class BfdSessionActionTest method mustFilterResponsesByRequestKey.
@Test
public void mustFilterResponsesByRequestKey() {
String requestKey = "request-key";
BfdSessionAction action = new BfdSessionActionImpl(requestKey, false);
// invalid
BfdSessionResponse response = new BfdSessionResponse(payload, null);
Assert.assertFalse(action.consumeSpeakerResponse(requestKey + "+invalid", response).isPresent());
// valid
ActionResult result = action.consumeSpeakerResponse(requestKey, new BfdSessionResponse(payload, null)).orElseThrow(() -> new AssertionError("Action must produce result"));
Assert.assertTrue(result.isSuccess());
// extra result
ActionResult result2 = action.consumeSpeakerResponse(requestKey, new BfdSessionResponse(payload, Errors.NOVI_BFD_UNKNOWN_ERROR)).orElseThrow(() -> new AssertionError("Action must produce result"));
// because extra result was ignored
Assert.assertTrue(result2.isSuccess());
}
use of org.openkilda.wfm.topology.network.controller.bfd.BfdSessionAction.ActionResult in project open-kilda by telstra.
the class BfdSessionActionTest method errorResponse.
@Test
public void errorResponse() {
ActionResult result = makeWithResponse(new BfdSessionResponse(payload, Errors.SWITCH_RESPONSE_ERROR));
Assert.assertEquals(Errors.SWITCH_RESPONSE_ERROR, result.getErrorCode());
Assert.assertFalse(result.isSuccess());
}
use of org.openkilda.wfm.topology.network.controller.bfd.BfdSessionAction.ActionResult in project open-kilda by telstra.
the class BfdSessionActionTest method missingSessionErrorResponse.
@Test
public void missingSessionErrorResponse() {
ActionResult result;
result = makeWithResponse(new BfdSessionResponse(payload, Errors.NOVI_BFD_DISCRIMINATOR_NOT_FOUND_ERROR), false);
Assert.assertFalse(result.isSuccess());
result = makeWithResponse(new BfdSessionResponse(payload, Errors.NOVI_BFD_DISCRIMINATOR_NOT_FOUND_ERROR), true);
Assert.assertTrue(result.isSuccess());
}
use of org.openkilda.wfm.topology.network.controller.bfd.BfdSessionAction.ActionResult in project open-kilda by telstra.
the class BfdSessionActionTest method timeoutResponse.
@Test
public void timeoutResponse() {
ActionResult result = makeWithResponse(null);
Assert.assertNull(result.getErrorCode());
Assert.assertFalse(result.isSuccess());
}
Aggregations