Search in sources :

Example 1 with DiscoPacketSendingConfirmation

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());
}
Also used : DiscoPacketSendingConfirmation(org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation) InfoMessage(org.openkilda.messaging.info.InfoMessage)

Example 2 with DiscoPacketSendingConfirmation

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));
}
Also used : DiscoPacketSendingConfirmation(org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation) NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) CommandContext(org.openkilda.wfm.CommandContext) InfoMessage(org.openkilda.messaging.info.InfoMessage) Values(org.apache.storm.tuple.Values) TupleImpl(org.apache.storm.tuple.TupleImpl) Tuple(org.apache.storm.tuple.Tuple) Test(org.junit.Test)

Example 3 with DiscoPacketSendingConfirmation

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));
}
Also used : DiscoverIslCommandData(org.openkilda.messaging.command.discovery.DiscoverIslCommandData) DiscoPacketSendingConfirmation(org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation) NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) InfoMessage(org.openkilda.messaging.info.InfoMessage) DatapathId(org.projectfloodlight.openflow.types.DatapathId)

Aggregations

InfoMessage (org.openkilda.messaging.info.InfoMessage)3 DiscoPacketSendingConfirmation (org.openkilda.messaging.info.discovery.DiscoPacketSendingConfirmation)3 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)2 Tuple (org.apache.storm.tuple.Tuple)1 TupleImpl (org.apache.storm.tuple.TupleImpl)1 Values (org.apache.storm.tuple.Values)1 Test (org.junit.Test)1 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)1 CommandContext (org.openkilda.wfm.CommandContext)1 DatapathId (org.projectfloodlight.openflow.types.DatapathId)1