use of org.onosproject.net.packet.PacketContext in project onos by opennetworkinglab.
the class DhcpRelayManagerTest method testDhcp4DualHome.
@Test
public void testDhcp4DualHome() {
PacketContext packetContext = new TestDhcpAckPacketContext(CLIENT_DH_CP, CLIENT_MAC, CLIENT_VLAN, INTERFACE_IP.ipAddress().getIp4Address(), false);
reset(manager.hostService);
expect(manager.hostService.getHost(CLIENT_HOST_ID)).andReturn(EXISTS_HOST).anyTimes();
Capture<HostDescription> capturedHostDesc = newCapture();
mockHostProviderService.hostDetected(eq(CLIENT_HOST_ID), capture(capturedHostDesc), eq(false));
replay(mockHostProviderService, manager.hostService);
packetService.processPacket(packetContext);
assertAfter(PKT_PROCESSING_MS, () -> verify(mockHostProviderService));
assertAfter(PKT_PROCESSING_MS, () -> assertTrue(capturedHostDesc.hasCaptured()));
HostDescription hostDesc = capturedHostDesc.getValue();
Set<HostLocation> hostLocations = hostDesc.locations();
assertAfter(PKT_PROCESSING_MS, () -> assertEquals(2, hostLocations.size()));
assertAfter(PKT_PROCESSING_MS, () -> assertTrue(hostLocations.contains(CLIENT_LOCATION)));
assertAfter(PKT_PROCESSING_MS, () -> assertTrue(hostLocations.contains(CLIENT_DH_LOCATION)));
}
use of org.onosproject.net.packet.PacketContext in project onos by opennetworkinglab.
the class MQEventHandlerTest method knownPktCtx.
@Test
public void knownPktCtx() {
deviceListener.event(deviceEvent(DEVICE_ADDED, DID1));
deviceListener.event(deviceEvent(DEVICE_ADDED, DID2));
PacketContext pktCtx = new TestPacketContext(deviceService.getDevice(DID2));
/*
* EasyMock.expectLastCall(); EasyMock.replay(manageSender);
*/
testProcessor.process(pktCtx);
}
use of org.onosproject.net.packet.PacketContext in project onos by opennetworkinglab.
the class MQEventHandlerTest method unknownPktCtx.
@Test
public void unknownPktCtx() {
// Note: DID3 hasn't been added to TestDeviceService
PacketContext pktCtx = new TestPacketContext(device1(DID3));
testProcessor.process(pktCtx);
assertFalse("Context should still be free", pktCtx.isHandled());
}
use of org.onosproject.net.packet.PacketContext in project onos by opennetworkinglab.
the class LldpLinkProviderTest method unknownPktCtx.
@Test
public void unknownPktCtx() {
// Note: DID3 hasn't been added to TestDeviceService
PacketContext pktCtx = new TestPacketContext(device(DID3));
testProcessor.process(pktCtx);
assertFalse("Context should still be free", pktCtx.isHandled());
}
use of org.onosproject.net.packet.PacketContext in project onos by opennetworkinglab.
the class LldpLinkProviderTest method knownPktCtx.
@Test
public void knownPktCtx() {
deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_ADDED, DID1));
deviceListener.event(deviceEvent(DeviceEvent.Type.DEVICE_ADDED, DID2));
PacketContext pktCtx = new TestPacketContext(deviceService.getDevice(DID2));
testProcessor.process(pktCtx);
assertTrue("Link not detected", detectedLink(DID1, DID2));
}
Aggregations