use of org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation in project open-kilda by telstra.
the class NetworkDiscoveryEmitterTest method verifyCaptured.
private void verifyCaptured(Capture<InfoMessage> capture, DiscoverIslCommandData request) {
Assert.assertTrue(capture.hasCaptured());
InfoMessage wrapper = capture.getValue();
Assert.assertEquals(REGION, wrapper.getRegion());
Assert.assertTrue(wrapper.getData() instanceof DiscoPacketSendingConfirmation);
DiscoPacketSendingConfirmation confirmation = (DiscoPacketSendingConfirmation) wrapper.getData();
Assert.assertEquals(request.getSwitchId(), confirmation.getEndpoint().getDatapath());
Assert.assertEquals(request.getPortNumber(), (int) confirmation.getEndpoint().getPortNumber());
Assert.assertEquals((long) request.getPacketId(), confirmation.getPacketId());
}
use of org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation in project open-kilda by telstra.
the class SpeakerToNetworkProxyBoltTest method verifySpeakerToConsumerTupleConsistency.
@Test
public void verifySpeakerToConsumerTupleConsistency() throws Exception {
injectLifecycleEventUpdate(START_SIGNAL);
ArgumentCaptor<Values> outputCaptor = ArgumentCaptor.forClass(Values.class);
verify(outputCollector).emit(anyString(), any(Tuple.class), outputCaptor.capture());
Values output = outputCaptor.getValue();
assertEquals(START_SIGNAL, ((LifecycleEvent) output.get(0)).getSignal());
InfoMessage discoveryConfirmation = new InfoMessage(new DiscoPacketSendingConfirmation(new NetworkEndpoint(switchAlpha, 1), 1L), 3L, "discovery-confirmation", REGION_ONE);
Tuple tuple = new TupleImpl(generalTopologyContext, new Values(switchAlpha.toString(), discoveryConfirmation, new CommandContext(discoveryConfirmation)), TASK_ID_SPOUT, STREAM_SPOUT_DEFAULT);
subject.execute(tuple);
ArgumentCaptor<Values> discoReplyValuesCaptor = ArgumentCaptor.forClass(Values.class);
verify(outputCollector).emit(eq(SpeakerToNetworkProxyBolt.STREAM_ALIVE_EVIDENCE_ID), eq(tuple), discoReplyValuesCaptor.capture());
assertEquals(REGION_ONE, discoReplyValuesCaptor.getValue().get(0));
assertEquals(discoveryConfirmation.getTimestamp(), discoReplyValuesCaptor.getValue().get(1));
ArgumentCaptor<Values> topoDiscoCaptor = ArgumentCaptor.forClass(Values.class);
verify(outputCollector).emit(eq(tuple), topoDiscoCaptor.capture());
assertEquals(switchAlpha.toString(), topoDiscoCaptor.getValue().get(0));
assertEquals(discoveryConfirmation, topoDiscoCaptor.getValue().get(1));
}
use of org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation in project open-kilda by telstra.
the class NetworkDiscoveryEmitter method emit.
void emit(DiscoveryHolder discovery) {
DiscoverIslCommandData request = discovery.getDiscoveryRequest();
DatapathId dpId = DatapathId.of(request.getSwitchId().getId());
pathVerificationService.sendDiscoveryMessage(dpId, OFPort.of(request.getPortNumber()), request.getPacketId());
DiscoPacketSendingConfirmation confirmation = new DiscoPacketSendingConfirmation(new NetworkEndpoint(request.getSwitchId(), request.getPortNumber()), request.getPacketId());
kafkaProducerService.sendMessageAndTrackWithZk(confirmationTopic, request.getSwitchId().toString(), new InfoMessage(confirmation, System.currentTimeMillis(), discovery.getCorrelationId(), region));
}
Aggregations