blob: 3c9ceb751777e4ef46c4636875aa427bdc2e34e0 [file] [log] [blame]
Mahesh Poojary Sba827292016-05-09 11:31:12 +05301/*
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 */
16package org.onosproject.pce.pcestore.api;
17
18import java.util.List;
19
20import org.onosproject.incubator.net.resource.label.LabelResourceId;
21import org.onosproject.incubator.net.tunnel.TunnelId;
22import org.onosproject.net.DeviceId;
23import org.onosproject.net.Link;
24import org.onosproject.net.resource.ResourceConsumer;
25import org.onosproject.pce.pcestore.PceccTunnelInfo;
Mahesh Poojary Sf920ec02016-05-17 23:16:09 +053026import org.onosproject.pce.pcestore.PcePathInfo;
Mahesh Poojary Sba827292016-05-09 11:31:12 +053027
28import java.util.Map;
29
30/**
31 * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
32 */
33public interface PceStore {
34 /**
35 * Checks whether device id is present in global node label store.
36 *
37 * @param id device id
38 * @return success of failure
39 */
40 boolean existsGlobalNodeLabel(DeviceId id);
41
42 /**
43 * Checks whether link is present in adjacency label store.
44 *
45 * @param link link between devices
46 * @return success of failure
47 */
48 boolean existsAdjLabel(Link link);
49
50 /**
51 * Checks whether tunnel id is present in tunnel info store.
52 *
53 * @param tunnelId tunnel id
54 * @return success of failure
55 */
56 boolean existsTunnelInfo(TunnelId tunnelId);
57
58 /**
Mahesh Poojary Sf920ec02016-05-17 23:16:09 +053059 * Checks whether path info is present in failed path info list.
60 *
61 * @param failedPathInfo failed path information
62 * @return success or failure
63 */
64 boolean existsFailedPathInfo(PcePathInfo failedPathInfo);
65
66 /**
Mahesh Poojary Sba827292016-05-09 11:31:12 +053067 * Retrieves the node label count.
68 *
69 * @return node label count
70 */
71 int getGlobalNodeLabelCount();
72
73 /**
74 * Retrieves the adjacency label count.
75 *
76 * @return adjacency label count
77 */
78 int getAdjLabelCount();
79
80 /**
81 * Retrieves the tunnel info count.
82 *
83 * @return tunnel info count
84 */
85 int getTunnelInfoCount();
86
87 /**
Mahesh Poojary Sf920ec02016-05-17 23:16:09 +053088 * Retrieves the failed path info count.
89 *
90 * @return failed path info count
91 */
92 int getFailedPathInfoCount();
93
94 /**
Mahesh Poojary Sba827292016-05-09 11:31:12 +053095 * Retrieves device id and label pairs collection from global node label store.
96 *
97 * @return collection of device id and label pairs
98 */
99 Map<DeviceId, LabelResourceId> getGlobalNodeLabels();
100
101 /**
102 * Retrieves link and label pairs collection from adjacency label store.
103 *
104 * @return collection of link and label pairs
105 */
106 Map<Link, LabelResourceId> getAdjLabels();
107
108 /**
109 * Retrieves tunnel id and pcecc tunnel info pairs collection from tunnel info store.
110 *
111 * @return collection of tunnel id and pcecc tunnel info pairs
112 */
113 Map<TunnelId, PceccTunnelInfo> getTunnelInfos();
114
115 /**
Mahesh Poojary Sf920ec02016-05-17 23:16:09 +0530116 * Retrieves path info collection from failed path info store.
117 *
118 * @return collection of failed path info
119 */
120 Iterable<PcePathInfo> getFailedPathInfos();
121
122 /**
Mahesh Poojary Sba827292016-05-09 11:31:12 +0530123 * Retrieves node label for specified device id.
124 *
125 * @param id device id
126 * @return node label
127 */
128 LabelResourceId getGlobalNodeLabel(DeviceId id);
129
130 /**
131 * Retrieves adjacency label for specified link.
132 *
133 * @param link between devices
134 * @return adjacency label
135 */
136 LabelResourceId getAdjLabel(Link link);
137
138 /**
139 * Retrieves local label info with tunnel consumer id from tunnel info store.
140 *
141 * @param tunnelId tunnel id
142 * @return pcecc tunnel info
143 */
144 PceccTunnelInfo getTunnelInfo(TunnelId tunnelId);
145
146 /**
147 * Stores node label into global node label store.
148 *
149 * @param deviceId device id
150 * @param labelId node label id
151 */
152 void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId);
153
154 /**
155 * Stores adjacency label into adjacency label store.
156 *
157 * @param link link between nodes
158 * @param labelId link label id
159 */
160 void addAdjLabel(Link link, LabelResourceId labelId);
161
162 /**
163 * Stores local label info with tunnel consumer id into tunnel info store for specified tunnel id.
164 *
165 * @param tunnelId tunnel id
166 * @param pceccTunnelInfo local label info
167 */
168 void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo);
169
170 /**
Mahesh Poojary Sf920ec02016-05-17 23:16:09 +0530171 * Stores path information into failed path info store.
172 *
173 * @param failedPathInfo failed path information
174 */
175 void addFailedPathInfo(PcePathInfo failedPathInfo);
176
177 /**
Mahesh Poojary Sba827292016-05-09 11:31:12 +0530178 * Updates local label info. The first entry is created with TunnelId and TunnelConsumerId.
179 * Later this entry may be updated to store label information if it is basic PCECC case.
180 *
181 * @param tunnelId tunnel id
182 * @param lspLocalLabelInfoList list of local labels
183 * @return success or failure
184 */
185 boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList);
186
187 /**
188 * Updates tunnel info map with tunnel consumer id.
189 *
190 * @param tunnelId tunnel id
191 * @param tunnelConsumerId tunnel consumer id
192 * @return success or failure
193 */
194 boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId);
195
196 /**
197 * Removes device label from global node label store for specified device id.
198 *
199 * @param id device id
200 * @return success or failure
201 */
202 boolean removeGlobalNodeLabel(DeviceId id);
203
204 /**
205 * Removes adjacency label from adjacency label store for specified link information.
206 *
207 * @param link between nodes
208 * @return success or failure
209 */
210 boolean removeAdjLabel(Link link);
211
212 /**
213 * Removes local label info with tunnel consumer id from tunnel info store for specified tunnel id.
214 *
215 * @param tunnelId tunnel id
216 * @return success or failure
217 */
218 boolean removeTunnelInfo(TunnelId tunnelId);
Mahesh Poojary Sf920ec02016-05-17 23:16:09 +0530219
220 /**
221 * Removes path info from failed path info store.
222 *
223 * @param failedPathInfo failed path information
224 * @return success or failure
225 */
226 boolean removeFailedPathInfo(PcePathInfo failedPathInfo);
Avantika-Huawei28b53752016-06-23 17:04:49 +0530227
228 /**
229 * Adds lsrid to device id mapping.
230 *
231 * @param lsrId lsrId of the device
232 * @param deviceId device id
233 * @return success or failure
234 */
235 boolean addLsrIdDevice(String lsrId, DeviceId deviceId);
236
237 /**
238 * Removes lsrid to device id mapping.
239 *
240 * @param lsrId lsrId of the device
241 * @return success or failure
242 */
243 boolean removeLsrIdDevice(String lsrId);
244
245 /**
246 * Gets lsrid to device id mapping.
247 *
248 * @param lsrId lsrId of the device
249 * @return device id of the lsrId
250 */
251 DeviceId getLsrIdDevice(String lsrId);
252
253 /**
254 * Adds lsrId of the PCC in form of device id for the PCC for which sync is pending due to non-availability of BGP.
255 * device.
256 *
257 * @param lsrId LSR id of the PCC in form of device id
258 * @return success or failure
259 */
260 public boolean addPccLsr(DeviceId lsrId);
261
262 /**
263 * Removes lsrId of the PCC in form of device id for the PCC for which pending sync is done.
264 *
265 * @param lsrId LSR id of the PCC in form of device id
266 * @return success or failure
267 */
268 public boolean removePccLsr(DeviceId lsrId);
269
270 /**
271 * Gets lsrId of the PCC in form of device id.
272 *
273 * @param lsrId LSR id of the PCC in form of device id
274 * @return success or failure
275 */
276 public boolean hasPccLsr(DeviceId lsrId);
Mahesh Poojary Sba827292016-05-09 11:31:12 +0530277}