use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.
the class OpenstackNetworkingUiManager method createLinksConnectedToTargetvDevice.
private void createLinksConnectedToTargetvDevice(Device targetvDevice) {
vDevices.stream().filter(d -> !d.equals(targetvDevice)).forEach(device -> {
if (vxlanPort(targetvDevice.id()).isPresent() && vxlanPort(device.id()).isPresent()) {
ConnectPoint srcConnectPoint = createConnectPoint(targetvDevice.id());
ConnectPoint dstConnectPoint = createConnectPoint(device.id());
LinkDescription linkDescription = createLinkDescription(srcConnectPoint, dstConnectPoint);
linkStore.createOrUpdateLink(new ProviderId(SONA_GUI, APP_ID), linkDescription);
}
});
}
use of org.onosproject.net.provider.ProviderId in project fabric-tna by stratum.
the class IntManagerTest method testWithHostEvent.
/**
* Test when receving an host event with IP address of the collector.
*/
@Test
public void testWithHostEvent() {
testActivateWithConfig();
Host host = new DefaultHost(new ProviderId("of", "foo"), HostId.hostId("00:00:00:00:00:01/None"), MacAddress.valueOf("00:00:00:00:00:01"), VlanId.NONE, new HostLocation(ConnectPoint.fromString("device:leaf1/1"), 0), ImmutableSet.of(COLLECTOR_IP));
HostListener listener = hostListener.getValue();
CompletableFuture<Void> completableFuture = new CompletableFuture<>();
reset(intProgrammable, netcfgService, deviceService, mastershipService);
expect(netcfgService.getConfig(APP_ID, IntReportConfig.class)).andReturn(INT_CONFIG_1).anyTimes();
expect(intProgrammable.setUpIntConfig(INT_CONFIG_1)).andAnswer(() -> {
completableFuture.complete(null);
return true;
}).once();
expect(deviceService.getAvailableDevices()).andReturn(ImmutableList.of(mockDevice)).anyTimes();
expect(deviceService.isAvailable(DEVICE_ID_1)).andReturn(true).anyTimes();
expect(mastershipService.isLocalMaster(DEVICE_ID_1)).andReturn(true).anyTimes();
replay(intProgrammable, netcfgService, deviceService, mastershipService);
HostEvent hostEvent = new HostEvent(HostEvent.Type.HOST_ADDED, host);
listener.event(hostEvent);
try {
completableFuture.get(1, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
fail("Didn't get expected call within 1 second.");
}
verifyAll();
}
Aggregations