Search in sources :

Example 61 with ProviderId

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);
        }
    });
}
Also used : UiViewHidden(org.onosproject.ui.UiViewHidden) UiTopoOverlayFactory(org.onosproject.ui.UiTopoOverlayFactory) DeviceService(org.onosproject.net.device.DeviceService) UiExtensionService(org.onosproject.ui.UiExtensionService) LoggerFactory(org.slf4j.LoggerFactory) UiView(org.onosproject.ui.UiView) DefaultLinkDescription(org.onosproject.net.link.DefaultLinkDescription) UiMessageHandlerFactory(org.onosproject.ui.UiMessageHandlerFactory) ConnectPoint(org.onosproject.net.ConnectPoint) Component(org.osgi.service.component.annotations.Component) ImmutableList(com.google.common.collect.ImmutableList) Port(org.onosproject.net.Port) SWITCH(org.onosproject.net.Device.Type.SWITCH) Activate(org.osgi.service.component.annotations.Activate) NoSuchElementException(java.util.NoSuchElementException) LinkDescription(org.onosproject.net.link.LinkDescription) Logger(org.slf4j.Logger) Device(org.onosproject.net.Device) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) ProviderId(org.onosproject.net.provider.ProviderId) Streams(com.google.common.collect.Streams) Collectors(java.util.stream.Collectors) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) List(java.util.List) Optional(java.util.Optional) LinkStore(org.onosproject.net.link.LinkStore) DeviceId(org.onosproject.net.DeviceId) Reference(org.osgi.service.component.annotations.Reference) UiExtension(org.onosproject.ui.UiExtension) Type(org.onosproject.net.Link.Type) ProviderId(org.onosproject.net.provider.ProviderId) DefaultLinkDescription(org.onosproject.net.link.DefaultLinkDescription) LinkDescription(org.onosproject.net.link.LinkDescription) ConnectPoint(org.onosproject.net.ConnectPoint)

Example 62 with ProviderId

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();
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) Host(org.onosproject.net.Host) DefaultHost(org.onosproject.net.DefaultHost) HostListener(org.onosproject.net.host.HostListener) TestUtils.getIntReportConfig(org.stratumproject.fabric.tna.utils.TestUtils.getIntReportConfig) DefaultHost(org.onosproject.net.DefaultHost) HostEvent(org.onosproject.net.host.HostEvent) CompletableFuture(java.util.concurrent.CompletableFuture) HostLocation(org.onosproject.net.HostLocation) ExecutionException(java.util.concurrent.ExecutionException) TimeoutException(java.util.concurrent.TimeoutException) Test(org.junit.Test)

Aggregations

ProviderId (org.onosproject.net.provider.ProviderId)62 DefaultDevice (org.onosproject.net.DefaultDevice)15 DeviceId (org.onosproject.net.DeviceId)13 Tunnel (org.onosproject.incubator.net.tunnel.Tunnel)12 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)12 Device (org.onosproject.net.Device)12 PortDescription (org.onosproject.net.device.PortDescription)12 TunnelProvider (org.onosproject.incubator.net.tunnel.TunnelProvider)10 DefaultPort (org.onosproject.net.DefaultPort)10 Port (org.onosproject.net.Port)10 DeviceEvent (org.onosproject.net.device.DeviceEvent)10 MastershipBasedTimestamp (org.onosproject.store.impl.MastershipBasedTimestamp)10 PortNumber (org.onosproject.net.PortNumber)9 DeviceDescription (org.onosproject.net.device.DeviceDescription)9 Timestamp (org.onosproject.store.Timestamp)9 MultiValuedTimestamp (org.onosproject.store.service.MultiValuedTimestamp)9 WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)9 DefaultTunnel (org.onosproject.incubator.net.tunnel.DefaultTunnel)7 TunnelId (org.onosproject.incubator.net.tunnel.TunnelId)7 DefaultLinkDescription (org.onosproject.net.link.DefaultLinkDescription)7