blob: 84b795d2e6b78e436f0ebecd34386a2e927b04a3 [file] [log] [blame]
tony-liuaff59a72016-10-21 15:41:46 +08001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.tetunnel.api;
18
19import org.onosproject.incubator.net.tunnel.TunnelId;
20import org.onosproject.tetopology.management.api.TeTopologyKey;
21import org.onosproject.tetunnel.api.tunnel.TeTunnel;
22import org.onosproject.tetunnel.api.tunnel.TeTunnelKey;
23
24import java.util.Collection;
25
26/**
27 * Manages TE tunnel attributes.
28 * <p>
29 * Please note that this service works with the existing Tunnel subsystem
30 * together, just as an extension to the tunnel subsystem, and only focus on TE
31 * Tunnel attributes management.
32 */
33public interface TeTunnelStore {
34
35 /**
36 * Creates a TE Tunnel with the supplied attributes, and returns true on
37 * success, or false on failure.
38 *
39 * @param teTunnel TE Tunnel attributes
40 * @return true on success, or false on failure
41 */
42 boolean addTeTunnel(TeTunnel teTunnel);
43
44 /**
45 * Sets the corresponding Tunnel identifier of the TE Tunnel specified
46 * by the given key.
47 *
48 * @param teTunnelKey TE Tunnel key
49 * @param tunnelId corresponding tunnel identifier
50 */
51 void setTunnelId(TeTunnelKey teTunnelKey, TunnelId tunnelId);
52
53 /**
54 * Returns the corresponding Tunnel identifier of the TE tunnel.
55 *
56 * @param teTunnelKey TE Tunnel key
57 * @return corresponding Tunnel identifier
58 */
59 TunnelId getTunnelId(TeTunnelKey teTunnelKey);
60
61 /**
62 * Updates TE Tunnel attributes with supplied information, the old
63 * attributes will be totally overwrote by the new attributes.
64 *
65 * @param teTunnel new TE Tunnel attributes
66 */
67 void updateTeTunnel(TeTunnel teTunnel);
68
69 /**
70 * Removes a TE Tunnel specified by the given key.
71 *
72 * @param teTunnelKey TE Tunnel key
73 */
74 void removeTeTunnel(TeTunnelKey teTunnelKey);
75
76 /**
77 * Returns the TE Tunnel with the specified key.
78 *
79 * @param teTunnelKey TE Tunnel key
80 * @return TeTunnel or null if one with the given key is not known
81 */
82 TeTunnel getTeTunnel(TeTunnelKey teTunnelKey);
83
84 /**
85 * Returns the TE Tunnel with the specified identifier.
86 *
87 * @param tunnelId corresponding tunnel identifier
88 * @return TeTunnel or null if one with the given identifier is not known
89 */
90 TeTunnel getTeTunnel(TunnelId tunnelId);
91
92
93 /**
94 * Returns a collection of currently known TE Tunnels.
95 *
96 * @return collection of TeTunnels
97 */
98 Collection<TeTunnel> getTeTunnels();
99
100 /**
101 * Returns a collection of currently known TE Tunnels filtered by the
102 * specified TE tunnel type.
103 *
104 * @param type TE tunnel type to filter by
105 * @return filtered collection of TE tunnels
106 */
107 Collection<TeTunnel> getTeTunnels(TeTunnel.Type type);
108
109 /**
110 * Returns a collection of currently known TE tunnels filtered by specified
111 * TE topology key.
112 *
113 * @param teTopologyKey TE topology key to filter by
114 * @return filtered collection of TE tunnels
115 */
116 Collection<TeTunnel> getTeTunnels(TeTopologyKey teTopologyKey);
117}