use of org.openkilda.messaging.model.PingMeters in project open-kilda by telstra.
the class UniFlowPingResponseTest method serializeLoop.
@Test
public void serializeLoop() throws Exception {
NetworkEndpoint endpointAlpha = new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:01"), 8);
NetworkEndpoint endpointBeta = new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:02"), 10);
UniFlowPingResponse origin = new UniFlowPingResponse(new Ping(endpointBeta, endpointAlpha, new FlowTransitEncapsulation(4, FlowEncapsulationType.TRANSIT_VLAN), 5), new PingMeters(3L, 2L, 1L), null);
InfoMessage wrapper = new InfoMessage(origin, System.currentTimeMillis(), getClass().getSimpleName());
serializer.serialize(wrapper);
InfoMessage decodedWrapper = (InfoMessage) serializer.deserialize();
InfoData decoded = decodedWrapper.getData();
Assert.assertEquals(String.format("%s object have been mangled in serialisation/deserialization loop", origin.getClass().getName()), origin, decoded);
}
use of org.openkilda.messaging.model.PingMeters in project open-kilda by telstra.
the class FlowPingResponseTest method serializeLoop.
@Test
public void serializeLoop() throws Exception {
NetworkEndpoint endpointAlpha = new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:01"), 8);
NetworkEndpoint endpointBeta = new NetworkEndpoint(new SwitchId("ff:fe:00:00:00:00:00:02"), 10);
UniFlowPingResponse forward = new UniFlowPingResponse(new Ping(endpointAlpha, endpointBeta, new FlowTransitEncapsulation(4, FlowEncapsulationType.TRANSIT_VLAN), 5), new PingMeters(1L, 2L, 3L), null);
UniFlowPingResponse reverse = new UniFlowPingResponse(new Ping(endpointBeta, endpointAlpha, new FlowTransitEncapsulation(4, FlowEncapsulationType.TRANSIT_VLAN), 5), new PingMeters(3L, 2L, 1L), null);
FlowPingResponse origin = new FlowPingResponse("flowId-" + getClass().getSimpleName(), forward, reverse, null);
InfoMessage wrapper = new InfoMessage(origin, System.currentTimeMillis(), getClass().getSimpleName());
serializer.serialize(wrapper);
InfoMessage decodedWrapper = (InfoMessage) serializer.deserialize();
InfoData decoded = decodedWrapper.getData();
Assert.assertEquals(String.format("%s object have been mangled in serialisation/deserialization loop", origin.getClass().getName()), origin, decoded);
}
use of org.openkilda.messaging.model.PingMeters in project open-kilda by telstra.
the class PingResponseTest method serializeLoop.
@Test
public void serializeLoop() throws Exception {
PingMeters meters = new PingMeters(1L, 2L, 3L);
PingResponse origin = new PingResponse(System.currentTimeMillis(), UUID.randomUUID(), null, meters);
InfoMessage wrapper = new InfoMessage(origin, System.currentTimeMillis(), getClass().getSimpleName());
serializer.serialize(wrapper);
InfoMessage decodedWrapper = (InfoMessage) serializer.deserialize();
InfoData decoded = decodedWrapper.getData();
Assert.assertEquals(String.format("%s object have been mangled in serialisation/deserialization loop", origin.getClass().getName()), origin, decoded);
}
use of org.openkilda.messaging.model.PingMeters in project open-kilda by telstra.
the class PingResponseCommand method process.
private void process(PingData data) {
Long latency = input.getLatency();
if (latency == null) {
log.warn("There is no latency info for {} - ping latency is unreliable", data.getPingId());
latency = 0L;
}
PingMeters meters = data.produceMeasurements(input.getReceiveTime(), latency);
logCatch(data, meters);
PingResponse response = new PingResponse(getContext().getCtime(), data.getPingId(), meters);
sendResponse(response);
}
use of org.openkilda.messaging.model.PingMeters in project open-kilda by telstra.
the class FlowMapperTest method testPingOutput.
@Test
public void testPingOutput() {
FlowPingResponse response = new FlowPingResponse(FLOW_ID, new UniFlowPingResponse(false, Errors.TIMEOUT, null, null), new UniFlowPingResponse(true, null, new PingMeters(1, 2, 3), null), ERROR_MESSAGE);
PingOutput output = flowMapper.toPingOutput(response);
assertEquals(response.getFlowId(), output.getFlowId());
assertEquals(response.getError(), output.getError());
assertEquals(response.getForward().isPingSuccess(), output.getForward().isPingSuccess());
assertEquals(0, output.getForward().getLatency());
assertEquals(TIMEOUT_ERROR_MESSAGE, output.getForward().getError());
assertEquals(response.getReverse().isPingSuccess(), output.getReverse().isPingSuccess());
assertEquals(1, output.getReverse().getLatency());
assertNull(output.getReverse().getError());
}
Aggregations