예제 #1
0
  @Test
  public void removeHostByDeviceOffline() {
    provider.modified(CTX_FOR_REMOVE);
    testProcessor.process(new TestArpPacketContext(DEV1));
    testProcessor.process(new TestArpPacketContext(DEV4));

    Device device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV1), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, device));
    assertEquals("incorrect remove count", 1, providerService.removeCount);

    device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV4), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(new DeviceEvent(DEVICE_AVAILABILITY_CHANGED, device));
    assertEquals("incorrect remove count", 2, providerService.removeCount);
  }
예제 #2
0
  @Test
  public void removeHostByDevicePortDown() {
    provider.modified(CTX_FOR_REMOVE);
    testProcessor.process(new TestArpPacketContext(DEV1));
    testProcessor.process(new TestArpPacketContext(DEV4));

    Device device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV1), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(
        new DeviceEvent(PORT_UPDATED, device, new DefaultPort(device, portNumber(INPORT), false)));
    assertEquals("incorrect remove count", 1, providerService.removeCount);

    device =
        new DefaultDevice(
            ProviderId.NONE, deviceId(DEV4), SWITCH, "m", "h", "s", "n", new ChassisId(0L));
    deviceService.listener.event(
        new DeviceEvent(PORT_UPDATED, device, new DefaultPort(device, portNumber(INPORT), false)));
    assertEquals("incorrect remove count", 2, providerService.removeCount);
  }