Search in sources :

Example 16 with LldpInfoData

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

the class PacketServiceTest method testHandleLldpDataUpdateDifferentSystemCapabilities.

@Test
public void testHandleLldpDataUpdateDifferentSystemCapabilities() throws InterruptedException {
    LldpInfoData updatedData = createLldpInfoDataData();
    updatedData.setSystemCapabilities(CAPABILITIES_2);
    runHandleLldpDataWithUpdatedDevice(updatedData);
}
Also used : LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 17 with LldpInfoData

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

the class PacketServiceTest method testHandleLldpDataDifferentPortId.

@Test
public void testHandleLldpDataDifferentPortId() {
    LldpInfoData updatedData = createLldpInfoDataData();
    updatedData.setPortId(PORT_ID_2);
    runHandleLldpDataWithAddedDevice(updatedData);
}
Also used : LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 18 with LldpInfoData

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

the class PacketServiceTest method testHandleLldpDataUpdateDifferentSystemName.

@Test
public void testHandleLldpDataUpdateDifferentSystemName() throws InterruptedException {
    LldpInfoData updatedData = createLldpInfoDataData();
    updatedData.setSystemName(SYSTEM_NAME_2);
    runHandleLldpDataWithUpdatedDevice(updatedData);
}
Also used : LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 19 with LldpInfoData

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

the class PacketServiceTest method findFlowRelatedDataForOneSwitchOnePortFlowTest.

@Test
@Parameters(method = "getOneSwitchOnePortFlowParameters")
public void findFlowRelatedDataForOneSwitchOnePortFlowTest(int inVlan, int srcVlan, int dstVlan, List<Integer> vlansInPacket, boolean source) {
    createFlow(FLOW_ID, srcVlan, dstVlan, null, true, true);
    LldpInfoData data = createLldpInfoDataData(SWITCH_ID_1, vlansInPacket, PORT_NUMBER_1);
    FlowRelatedData flowRelatedData = packetService.findFlowRelatedDataForOneSwitchFlow(data);
    assertEquals(FLOW_ID, flowRelatedData.getFlowId());
    assertEquals(inVlan, flowRelatedData.getOriginalVlan());
    assertEquals(source, flowRelatedData.getSource());
}
Also used : LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData) FlowRelatedData(org.openkilda.wfm.topology.connecteddevices.service.PacketService.FlowRelatedData) Parameters(junitparams.Parameters) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 20 with LldpInfoData

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

the class PacketServiceTest method runHandleLldpDataWithUpdatedDevice.

private void runHandleLldpDataWithUpdatedDevice(LldpInfoData updatedData) throws InterruptedException {
    LldpInfoData data = createLldpInfoDataData();
    packetService.handleLldpData(data);
    Collection<SwitchConnectedDevice> oldDevices = switchConnectedDeviceRepository.findAll();
    assertEquals(1, oldDevices.size());
    assertLldpInfoDataDataEqualsSwitchConnectedDevice(data, oldDevices.iterator().next());
    SwitchConnectedDevice originalDevice = new SwitchConnectedDevice(oldDevices.iterator().next());
    // Need to have a different timestamp in 'data' and 'updatedData' messages.
    // More info https://github.com/telstra/open-kilda/issues/3064
    updatedData.setTimestamp(data.getTimestamp() + 1000);
    // we must update old device
    packetService.handleLldpData(updatedData);
    Collection<SwitchConnectedDevice> newDevices = switchConnectedDeviceRepository.findAll();
    assertEquals(1, newDevices.size());
    assertLldpInfoDataDataEqualsSwitchConnectedDevice(updatedData, newDevices.iterator().next());
    // time must be updated
    assertNotEquals(originalDevice.getTimeLastSeen(), newDevices.iterator().next().getTimeLastSeen());
}
Also used : LldpInfoData(org.openkilda.messaging.info.event.LldpInfoData) SwitchConnectedDevice(org.openkilda.model.SwitchConnectedDevice)

Aggregations

LldpInfoData (org.openkilda.messaging.info.event.LldpInfoData)21 Test (org.junit.Test)18 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)18 Parameters (junitparams.Parameters)4 FlowRelatedData (org.openkilda.wfm.topology.connecteddevices.service.PacketService.FlowRelatedData)4 SwitchConnectedDevice (org.openkilda.model.SwitchConnectedDevice)2 Message (org.openkilda.messaging.Message)1 InfoData (org.openkilda.messaging.info.InfoData)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 ArpInfoData (org.openkilda.messaging.info.event.ArpInfoData)1 SwitchId (org.openkilda.model.SwitchId)1