Avantika-Huawei
Committed by Gerrit Code Review

[ONOS-4163] Add tunnel service API

Change-Id: I5b0f862731cd62e2f977bee809eaf75bc22d83d0
......@@ -23,6 +23,8 @@ import org.onosproject.event.ListenerService;
import org.onosproject.incubator.net.tunnel.Tunnel.Type;
import org.onosproject.net.Annotations;
import org.onosproject.net.DeviceId;
import org.onosproject.net.ElementId;
import org.onosproject.net.Path;
/**
* Service for interacting with the inventory of tunnels.
......@@ -92,6 +94,27 @@ public interface TunnelService
Annotations... annotations);
/**
* Creates a tunnel with given path and default initial state. The state changes
* in due course of time based on changes happening in the network.
*
* @param producerId a tunnel producer
* @param srcElementId element id of the source
* @param tunnel to be created
* @param path path of the tunnel
* @return generated tunnel identity
*/
TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path);
/**
* Triggers removal of specified tunnel.
*
* @param producerId a tunnel producer
* @param tunnelId identity for the tunnel to be triggered for removal
* @return success or failure
*/
boolean downTunnel(ApplicationId producerId, TunnelId tunnelId);
/**
* Returns back a specific tunnel to store.
*
* @param consumerId a tunnel consumer
......
......@@ -43,6 +43,7 @@ import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate;
import org.onosproject.incubator.net.tunnel.TunnelSubscription;
import org.onosproject.net.Annotations;
import org.onosproject.net.DeviceId;
import org.onosproject.net.ElementId;
import org.onosproject.net.Path;
import org.onosproject.net.provider.AbstractProviderService;
import org.onosproject.net.provider.ProviderId;
......@@ -227,6 +228,18 @@ public class TunnelManager
}
@Override
public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) {
// TODO: Insert into store and trigger provider API.
return null;
}
@Override
public boolean downTunnel(ApplicationId producerId, TunnelId tunnelId) {
// TODO: Change the tunnel status and trigger provider API.
return false;
}
@Override
public boolean returnTunnel(ApplicationId consumerId,
TunnelId tunnelId, Annotations... annotations) {
return store.returnTunnel(consumerId, tunnelId, annotations);
......
......@@ -25,9 +25,11 @@ import org.onosproject.incubator.net.tunnel.TunnelService;
import org.onosproject.incubator.net.tunnel.TunnelSubscription;
import org.onosproject.net.Annotations;
import org.onosproject.net.DeviceId;
import org.onosproject.net.ElementId;
import java.util.Collection;
import java.util.Collections;
import org.onosproject.net.Path;
public class TunnelServiceAdapter implements TunnelService {
@Override
......@@ -54,6 +56,16 @@ public class TunnelServiceAdapter implements TunnelService {
}
@Override
public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) {
return null;
}
@Override
public boolean downTunnel(ApplicationId producerId, TunnelId tunnelId) {
return false;
}
@Override
public boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, Annotations... annotations) {
return false;
}
......