Committed by
Gerrit Code Review
[ONOS-4163] Add tunnel service API
Change-Id: I5b0f862731cd62e2f977bee809eaf75bc22d83d0
Showing
3 changed files
with
48 additions
and
0 deletions
... | @@ -23,6 +23,8 @@ import org.onosproject.event.ListenerService; | ... | @@ -23,6 +23,8 @@ import org.onosproject.event.ListenerService; |
23 | import org.onosproject.incubator.net.tunnel.Tunnel.Type; | 23 | import org.onosproject.incubator.net.tunnel.Tunnel.Type; |
24 | import org.onosproject.net.Annotations; | 24 | import org.onosproject.net.Annotations; |
25 | import org.onosproject.net.DeviceId; | 25 | import org.onosproject.net.DeviceId; |
26 | +import org.onosproject.net.ElementId; | ||
27 | +import org.onosproject.net.Path; | ||
26 | 28 | ||
27 | /** | 29 | /** |
28 | * Service for interacting with the inventory of tunnels. | 30 | * Service for interacting with the inventory of tunnels. |
... | @@ -92,6 +94,27 @@ public interface TunnelService | ... | @@ -92,6 +94,27 @@ public interface TunnelService |
92 | Annotations... annotations); | 94 | Annotations... annotations); |
93 | 95 | ||
94 | /** | 96 | /** |
97 | + * Creates a tunnel with given path and default initial state. The state changes | ||
98 | + * in due course of time based on changes happening in the network. | ||
99 | + * | ||
100 | + * @param producerId a tunnel producer | ||
101 | + * @param srcElementId element id of the source | ||
102 | + * @param tunnel to be created | ||
103 | + * @param path path of the tunnel | ||
104 | + * @return generated tunnel identity | ||
105 | + */ | ||
106 | + TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path); | ||
107 | + | ||
108 | + /** | ||
109 | + * Triggers removal of specified tunnel. | ||
110 | + * | ||
111 | + * @param producerId a tunnel producer | ||
112 | + * @param tunnelId identity for the tunnel to be triggered for removal | ||
113 | + * @return success or failure | ||
114 | + */ | ||
115 | + boolean downTunnel(ApplicationId producerId, TunnelId tunnelId); | ||
116 | + | ||
117 | + /** | ||
95 | * Returns back a specific tunnel to store. | 118 | * Returns back a specific tunnel to store. |
96 | * | 119 | * |
97 | * @param consumerId a tunnel consumer | 120 | * @param consumerId a tunnel consumer | ... | ... |
... | @@ -43,6 +43,7 @@ import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate; | ... | @@ -43,6 +43,7 @@ import org.onosproject.incubator.net.tunnel.TunnelStoreDelegate; |
43 | import org.onosproject.incubator.net.tunnel.TunnelSubscription; | 43 | import org.onosproject.incubator.net.tunnel.TunnelSubscription; |
44 | import org.onosproject.net.Annotations; | 44 | import org.onosproject.net.Annotations; |
45 | import org.onosproject.net.DeviceId; | 45 | import org.onosproject.net.DeviceId; |
46 | +import org.onosproject.net.ElementId; | ||
46 | import org.onosproject.net.Path; | 47 | import org.onosproject.net.Path; |
47 | import org.onosproject.net.provider.AbstractProviderService; | 48 | import org.onosproject.net.provider.AbstractProviderService; |
48 | import org.onosproject.net.provider.ProviderId; | 49 | import org.onosproject.net.provider.ProviderId; |
... | @@ -227,6 +228,18 @@ public class TunnelManager | ... | @@ -227,6 +228,18 @@ public class TunnelManager |
227 | } | 228 | } |
228 | 229 | ||
229 | @Override | 230 | @Override |
231 | + public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) { | ||
232 | + // TODO: Insert into store and trigger provider API. | ||
233 | + return null; | ||
234 | + } | ||
235 | + | ||
236 | + @Override | ||
237 | + public boolean downTunnel(ApplicationId producerId, TunnelId tunnelId) { | ||
238 | + // TODO: Change the tunnel status and trigger provider API. | ||
239 | + return false; | ||
240 | + } | ||
241 | + | ||
242 | + @Override | ||
230 | public boolean returnTunnel(ApplicationId consumerId, | 243 | public boolean returnTunnel(ApplicationId consumerId, |
231 | TunnelId tunnelId, Annotations... annotations) { | 244 | TunnelId tunnelId, Annotations... annotations) { |
232 | return store.returnTunnel(consumerId, tunnelId, annotations); | 245 | return store.returnTunnel(consumerId, tunnelId, annotations); | ... | ... |
... | @@ -25,9 +25,11 @@ import org.onosproject.incubator.net.tunnel.TunnelService; | ... | @@ -25,9 +25,11 @@ import org.onosproject.incubator.net.tunnel.TunnelService; |
25 | import org.onosproject.incubator.net.tunnel.TunnelSubscription; | 25 | import org.onosproject.incubator.net.tunnel.TunnelSubscription; |
26 | import org.onosproject.net.Annotations; | 26 | import org.onosproject.net.Annotations; |
27 | import org.onosproject.net.DeviceId; | 27 | import org.onosproject.net.DeviceId; |
28 | +import org.onosproject.net.ElementId; | ||
28 | 29 | ||
29 | import java.util.Collection; | 30 | import java.util.Collection; |
30 | import java.util.Collections; | 31 | import java.util.Collections; |
32 | +import org.onosproject.net.Path; | ||
31 | 33 | ||
32 | public class TunnelServiceAdapter implements TunnelService { | 34 | public class TunnelServiceAdapter implements TunnelService { |
33 | @Override | 35 | @Override |
... | @@ -54,6 +56,16 @@ public class TunnelServiceAdapter implements TunnelService { | ... | @@ -54,6 +56,16 @@ public class TunnelServiceAdapter implements TunnelService { |
54 | } | 56 | } |
55 | 57 | ||
56 | @Override | 58 | @Override |
59 | + public TunnelId setupTunnel(ApplicationId producerId, ElementId srcElementId, Tunnel tunnel, Path path) { | ||
60 | + return null; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public boolean downTunnel(ApplicationId producerId, TunnelId tunnelId) { | ||
65 | + return false; | ||
66 | + } | ||
67 | + | ||
68 | + @Override | ||
57 | public boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, Annotations... annotations) { | 69 | public boolean returnTunnel(ApplicationId consumerId, TunnelId tunnelId, Annotations... annotations) { |
58 | return false; | 70 | return false; |
59 | } | 71 | } | ... | ... |
-
Please register or login to post a comment