Search in sources :

Example 6 with ArpInfoData

use of org.openkilda.messaging.info.event.ArpInfoData in project open-kilda by telstra.

the class PacketServiceTest method testHandleArpDataDifferentPortNumber.

@Test
public void testHandleArpDataDifferentPortNumber() {
    ArpInfoData updatedData = createArpInfoData();
    updatedData.setPortNumber(PORT_NUMBER_2);
    runHandleArpDataWithAddedDevice(updatedData);
}
Also used : ArpInfoData(org.openkilda.messaging.info.event.ArpInfoData) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 7 with ArpInfoData

use of org.openkilda.messaging.info.event.ArpInfoData in project open-kilda by telstra.

the class PacketBolt method handleInput.

@Override
protected void handleInput(Tuple input) throws PipelineException {
    if (active) {
        Message message = pullValue(input, FIELD_ID_PAYLOAD, Message.class);
        if (message instanceof InfoMessage) {
            log.debug("Received info message {}", message);
            InfoData data = ((InfoMessage) message).getData();
            if (data instanceof LldpInfoData) {
                packetService.handleLldpData((LldpInfoData) data);
            } else if (data instanceof ArpInfoData) {
                packetService.handleArpData((ArpInfoData) data);
            } else {
                unhandledInput(input);
            }
        } else {
            unhandledInput(input);
        }
    }
}
Also used : LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData) ArpInfoData(org.openkilda.messaging.info.event.ArpInfoData) InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) InfoMessage(org.openkilda.messaging.info.InfoMessage) ArpInfoData(org.openkilda.messaging.info.event.ArpInfoData) InfoData(org.openkilda.messaging.info.InfoData) LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData)

Example 8 with ArpInfoData

use of org.openkilda.messaging.info.event.ArpInfoData in project open-kilda by telstra.

the class PacketServiceTest method testHandleArpDataDifferentIpAddress.

@Test
public void testHandleArpDataDifferentIpAddress() {
    ArpInfoData updatedData = createArpInfoData();
    updatedData.setIpAddress(IP_ADDRESS_2);
    runHandleArpDataWithAddedDevice(updatedData);
}
Also used : ArpInfoData(org.openkilda.messaging.info.event.ArpInfoData) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 9 with ArpInfoData

use of org.openkilda.messaging.info.event.ArpInfoData in project open-kilda by telstra.

the class ConnectedDevicesService method handleArp.

private void handleArp(OfInput input, SwitchId switchId, long cookie) {
    Ethernet ethernet = input.getPacketInPayload();
    ArpPacketData data = deserializeArp(ethernet, switchId, cookie);
    if (data == null) {
        return;
    }
    ArpInfoData arpInfoData = new ArpInfoData(switchId, input.getPort().getPortNumber(), data.vlans, cookie, data.arp.getSenderHardwareAddress().toString(), data.arp.getSenderProtocolAddress().toString());
    InfoMessage message = new InfoMessage(arpInfoData, System.currentTimeMillis(), CorrelationContext.getId(), region);
    producerService.sendMessageAndTrackWithZk(topic, switchId.toString(), message);
}
Also used : ArpInfoData(org.openkilda.messaging.info.event.ArpInfoData) InfoMessage(org.openkilda.messaging.info.InfoMessage) Ethernet(net.floodlightcontroller.packet.Ethernet)

Aggregations

ArpInfoData (org.openkilda.messaging.info.event.ArpInfoData)9 Test (org.junit.Test)6 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)6 InfoMessage (org.openkilda.messaging.info.InfoMessage)2 Ethernet (net.floodlightcontroller.packet.Ethernet)1 Message (org.openkilda.messaging.Message)1 InfoData (org.openkilda.messaging.info.InfoData)1 LldpInfoData (org.openkilda.messaging.info.event.LldpInfoData)1 SwitchId (org.openkilda.model.SwitchId)1