Search in sources :

Example 6 with TunnelProvider

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

the class TunnelUpdateCommand method doExecute.

@Override
protected void doExecute() {
    TunnelProvider service = get(TunnelProvider.class);
    TunnelId id = TunnelId.valueOf(tunnelId);
    SparseAnnotations annotations = DefaultAnnotations.builder().set("bandwidth", bandwidth).build();
    TunnelDescription tunnel = new DefaultTunnelDescription(id, null, null, null, null, null, null, null, annotations);
    service.tunnelUpdated(tunnel);
}
Also used : SparseAnnotations(org.onosproject.net.SparseAnnotations) TunnelProvider(org.onosproject.incubator.net.tunnel.TunnelProvider) DefaultTunnelDescription(org.onosproject.incubator.net.tunnel.DefaultTunnelDescription) TunnelDescription(org.onosproject.incubator.net.tunnel.TunnelDescription) DefaultTunnelDescription(org.onosproject.incubator.net.tunnel.DefaultTunnelDescription) TunnelId(org.onosproject.incubator.net.tunnel.TunnelId)

Example 7 with TunnelProvider

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

the class TunnelManager method removeTunnel.

@Override
public void removeTunnel(TunnelId tunnelId) {
    checkNotNull(tunnelId, TUNNNEL_ID_NULL);
    Tunnel tunnel = store.queryTunnel(tunnelId);
    if (tunnel != null) {
        store.deleteTunnel(tunnelId);
        if (tunnel.providerId() != null) {
            TunnelProvider provider = getProvider(tunnel.providerId());
            if (provider != null) {
                provider.releaseTunnel(tunnel);
            }
        } else {
            Set<ProviderId> ids = getProviders();
            for (ProviderId providerId : ids) {
                TunnelProvider provider = getProvider(providerId);
                provider.releaseTunnel(tunnel);
            }
        }
    }
}
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)

Example 8 with TunnelProvider

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

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

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

TunnelProvider (org.onosproject.incubator.net.tunnel.TunnelProvider)11 ProviderId (org.onosproject.net.provider.ProviderId)10 Tunnel (org.onosproject.incubator.net.tunnel.Tunnel)9 DefaultTunnel (org.onosproject.incubator.net.tunnel.DefaultTunnel)7 TunnelId (org.onosproject.incubator.net.tunnel.TunnelId)5 DefaultTunnelDescription (org.onosproject.incubator.net.tunnel.DefaultTunnelDescription)3 TunnelDescription (org.onosproject.incubator.net.tunnel.TunnelDescription)3 DefaultOpticalTunnelEndPoint (org.onosproject.incubator.net.tunnel.DefaultOpticalTunnelEndPoint)2 IpTunnelEndPoint (org.onosproject.incubator.net.tunnel.IpTunnelEndPoint)2 OpticalTunnelEndPoint (org.onosproject.incubator.net.tunnel.OpticalTunnelEndPoint)2 TunnelEndPoint (org.onosproject.incubator.net.tunnel.TunnelEndPoint)2 SparseAnnotations (org.onosproject.net.SparseAnnotations)2 GroupId (org.onosproject.core.GroupId)1 TunnelService (org.onosproject.incubator.net.tunnel.TunnelService)1