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);
}
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);
}
}
}
}
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;
}
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;
}
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;
}
Aggregations