Search in sources :

Example 46 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class TunnelManager method setupTunnel.

@Override
public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) {
    // TODO: producerId to check if really required to consider while setup the tunnel.
    checkNotNull(tunnel, TUNNNEL_NULL);
    TunnelId tunnelId = store.createOrUpdateTunnel(tunnel, State.INIT);
    if (tunnelId != null) {
        Set<ProviderId> ids = getProviders();
        Tunnel newT = queryTunnel(tunnelId);
        for (ProviderId providerId : ids) {
            TunnelProvider provider = getProvider(providerId);
            provider.setupTunnel(srcElementId, newT, path);
        }
    }
    return tunnelId;
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) TunnelProvider(org.onosproject.incubator.net.tunnel.TunnelProvider) Tunnel(org.onosproject.incubator.net.tunnel.Tunnel) DefaultTunnel(org.onosproject.incubator.net.tunnel.DefaultTunnel) TunnelId(org.onosproject.incubator.net.tunnel.TunnelId)

Example 47 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class TunnelManager method borrowTunnel.

@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, TunnelEndPoint dst, Annotations... annotations) {
    Collection<Tunnel> tunnels = store.borrowTunnel(consumerId, src, dst, annotations);
    if (tunnels == null || tunnels.isEmpty()) {
        Tunnel tunnel = new DefaultTunnel(null, src, dst, null, null, null, null, null, annotations);
        Set<ProviderId> ids = getProviders();
        for (ProviderId providerId : ids) {
            TunnelProvider provider = getProvider(providerId);
            provider.setupTunnel(tunnel, null);
        }
    }
    return tunnels;
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) TunnelProvider(org.onosproject.incubator.net.tunnel.TunnelProvider) DefaultTunnel(org.onosproject.incubator.net.tunnel.DefaultTunnel) Tunnel(org.onosproject.incubator.net.tunnel.Tunnel) DefaultTunnel(org.onosproject.incubator.net.tunnel.DefaultTunnel)

Example 48 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class TunnelManager method updateTunnel.

@Override
public void updateTunnel(Tunnel tunnel, Path path) {
    store.createOrUpdateTunnel(tunnel);
    if (tunnel.providerId() != null) {
        TunnelProvider provider = getProvider(tunnel.providerId());
        if (provider != null) {
            provider.updateTunnel(tunnel, path);
        }
    } else {
        Set<ProviderId> ids = getProviders();
        for (ProviderId providerId : ids) {
            TunnelProvider provider = getProvider(providerId);
            provider.updateTunnel(tunnel, path);
        }
    }
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) TunnelProvider(org.onosproject.incubator.net.tunnel.TunnelProvider)

Example 49 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class HostEventTest method createHost.

private Host createHost() {
    MacAddress mac = MacAddress.valueOf("00:00:11:00:00:01");
    VlanId vlan = VlanId.vlanId((short) 10);
    HostLocation loc = new HostLocation(DeviceId.deviceId("of:foo"), PortNumber.portNumber(100), 123L);
    Set<IpAddress> ipset = Sets.newHashSet(IpAddress.valueOf("10.0.0.1"), IpAddress.valueOf("10.0.0.2"));
    HostId hid = HostId.hostId(mac, vlan);
    return new DefaultHost(new ProviderId("of", "foo"), hid, mac, vlan, loc, ipset);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) DefaultHost(org.onosproject.net.DefaultHost) HostLocation(org.onosproject.net.HostLocation) IpAddress(org.onlab.packet.IpAddress) MacAddress(org.onlab.packet.MacAddress) HostId(org.onosproject.net.HostId) VlanId(org.onlab.packet.VlanId)

Example 50 with ProviderId

use of org.onosproject.net.provider.ProviderId in project onos by opennetworkinglab.

the class HostServiceAdapter method getHost.

@Override
public Host getHost(HostId hostId) {
    ProviderId providerId = ProviderId.NONE;
    MacAddress mac = MacAddress.valueOf("fa:12:3e:56:ee:a2");
    VlanId vlan = VlanId.NONE;
    HostLocation location = HostLocation.NONE;
    Set<IpAddress> ips = Sets.newHashSet();
    Annotations annotations = null;
    return new DefaultHost(providerId, hostId, mac, vlan, location, ips, annotations);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) DefaultHost(org.onosproject.net.DefaultHost) Annotations(org.onosproject.net.Annotations) HostLocation(org.onosproject.net.HostLocation) IpAddress(org.onlab.packet.IpAddress) MacAddress(org.onlab.packet.MacAddress) VlanId(org.onlab.packet.VlanId)

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