use of org.onosproject.net.DefaultPort in project onos by opennetworkinglab.
the class OpenstackSwitchingHostProviderTest method testProcessPortAddedForUpdate.
/**
* Tests the process port added method for updating case.
*/
@Test
public void testProcessPortAddedForUpdate() {
org.onosproject.net.Port addedPort = new DefaultPort(DEV1, P1, true, ANNOTATIONS);
DeviceEvent addedEvent = new DeviceEvent(DeviceEvent.Type.PORT_ADDED, DEV1, addedPort);
target.portAddedHelper(addedEvent);
// org.onosproject.net.Port updatedPort = new DefaultPort(DEV1, P2, true, ANNOTATIONS);
// DeviceEvent updatedEvent = new DeviceEvent(DeviceEvent.Type.PORT_ADDED, DEV1, updatedPort);
target.portAddedHelper(addedEvent);
HostId hostId = HostId.hostId(HOST_MAC);
HostDescription hostDesc = new DefaultHostDescription(HOST_MAC, VlanId.NONE, new HostLocation(CP11, System.currentTimeMillis()), ImmutableSet.of(HOST_IP11), ANNOTATIONS);
verifyHostResult(hostId, hostDesc);
}
use of org.onosproject.net.DefaultPort in project onos by opennetworkinglab.
the class OpenstackSwitchingHostProviderTest method testProcessPortRemoved.
@Test
public void testProcessPortRemoved() {
org.onosproject.net.Port addedPort = new DefaultPort(DEV1, P1, true, ANNOTATIONS);
DeviceEvent addedEvent = new DeviceEvent(DeviceEvent.Type.PORT_ADDED, DEV1, addedPort);
target.portAddedHelper(addedEvent);
org.onosproject.net.Port removedPort = new DefaultPort(DEV2, P1, true, ANNOTATIONS);
DeviceEvent removedEvent = new DeviceEvent(DeviceEvent.Type.PORT_REMOVED, DEV2, removedPort);
target.portRemovedHelper(removedEvent);
assertNull(target.hostService.getHost(HostId.hostId(HOST_MAC)));
}
use of org.onosproject.net.DefaultPort in project onos by opennetworkinglab.
the class NetworkConfigLinksProviderTest method testAddPort.
/**
* Tests adding a new port via an event.
*/
@Test
public void testAddPort() {
deviceListener.event(new DeviceEvent(DeviceEvent.Type.PORT_ADDED, dev3, new DefaultPort(dev3, portNumber3, true)));
assertThat(provider.discoverers.entrySet(), hasSize(3));
}
use of org.onosproject.net.DefaultPort in project onos by opennetworkinglab.
the class HostLocationProviderTest method removeHostByDevicePortDown.
@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.locationRemoveCount);
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.locationRemoveCount);
}
use of org.onosproject.net.DefaultPort in project onos by opennetworkinglab.
the class DeviceEventTest method withoutTime.
@Override
@Test
public void withoutTime() {
Device device = createDevice();
Port port = new DefaultPort(device, PortNumber.portNumber(123), true);
long before = System.currentTimeMillis();
DeviceEvent event = new DeviceEvent(DeviceEvent.Type.DEVICE_ADDED, device, port);
long after = System.currentTimeMillis();
validateEvent(event, DeviceEvent.Type.DEVICE_ADDED, device, before, after);
}
Aggregations