Search in sources :

Example 21 with Tunnel

use of org.onosproject.incubator.net.tunnel.Tunnel in project onos by opennetworkinglab.

the class TunnelManager method borrowTunnel.

@Override
public Collection<Tunnel> borrowTunnel(ApplicationId consumerId, TunnelEndPoint src, TunnelEndPoint dst, Type type, Annotations... annotations) {
    Collection<Tunnel> tunnels = store.borrowTunnel(consumerId, src, dst, type, annotations);
    if (tunnels == null || tunnels.isEmpty()) {
        Tunnel tunnel = new DefaultTunnel(null, src, dst, type, 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 22 with Tunnel

use of org.onosproject.incubator.net.tunnel.Tunnel 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 23 with Tunnel

use of org.onosproject.incubator.net.tunnel.Tunnel 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)

Aggregations

Tunnel (org.onosproject.incubator.net.tunnel.Tunnel)23 DefaultTunnel (org.onosproject.incubator.net.tunnel.DefaultTunnel)18 TunnelId (org.onosproject.incubator.net.tunnel.TunnelId)15 ProviderId (org.onosproject.net.provider.ProviderId)12 TunnelProvider (org.onosproject.incubator.net.tunnel.TunnelProvider)9 HashSet (java.util.HashSet)5 DefaultOpticalTunnelEndPoint (org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint)5 IpTunnelEndPoint (org.onosproject.incubator.net.tunnel.IpTunnelEndPoint)5 OpticalTunnelEndPoint (org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint)5 TunnelEndPoint (org.onosproject.incubator.net.tunnel.TunnelEndPoint)5 TunnelEvent (org.onosproject.incubator.net.tunnel.TunnelEvent)4 TunnelService (org.onosproject.incubator.net.tunnel.TunnelService)4 TunnelSubscription (org.onosproject.incubator.net.tunnel.TunnelSubscription)4 ArrayList (java.util.ArrayList)2 ApplicationId (org.onosproject.core.ApplicationId)2 DefaultApplicationId (org.onosproject.core.DefaultApplicationId)2 DefaultTunnelDescription (org.onosproject.incubator.net.tunnel.DefaultTunnelDescription)2 TunnelDescription (org.onosproject.incubator.net.tunnel.TunnelDescription)2 TunnelName (org.onosproject.incubator.net.tunnel.TunnelName)2 SparseAnnotations (org.onosproject.net.SparseAnnotations)2