blob: c732f259299d66abe10a52deb5fc93352c1be752 [file] [log] [blame]
Avantika-Huawei9e848e82016-09-01 12:12:42 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Avantika-Huawei9e848e82016-09-01 12:12:42 +05303 *
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.pcelabelstore.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 java.util.Map;
25
26/**
27 * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
28 */
29public interface PceLabelStore {
30 /**
31 * Checks whether device id is present in global node label store.
32 *
33 * @param id device id
34 * @return success of failure
35 */
36 boolean existsGlobalNodeLabel(DeviceId id);
37
38 /**
39 * Checks whether link is present in adjacency label store.
40 *
41 * @param link link between devices
42 * @return success of failure
43 */
44 boolean existsAdjLabel(Link link);
45
46 /**
47 * Checks whether tunnel id is present in tunnel info store.
48 *
49 * @param tunnelId tunnel id
50 * @return success of failure
51 */
52 boolean existsTunnelInfo(TunnelId tunnelId);
53
54 /**
55 * Retrieves the node label count.
56 *
57 * @return node label count
58 */
59 int getGlobalNodeLabelCount();
60
61 /**
62 * Retrieves the adjacency label count.
63 *
64 * @return adjacency label count
65 */
66 int getAdjLabelCount();
67
68 /**
69 * Retrieves the tunnel info count.
70 *
71 * @return tunnel info count
72 */
73 int getTunnelInfoCount();
74
75 /**
76 * Retrieves device id and label pairs collection from global node label store.
77 *
78 * @return collection of device id and label pairs
79 */
80 Map<DeviceId, LabelResourceId> getGlobalNodeLabels();
81
82 /**
83 * Retrieves link and label pairs collection from adjacency label store.
84 *
85 * @return collection of link and label pairs
86 */
87 Map<Link, LabelResourceId> getAdjLabels();
88
89 /**
90 * Retrieves tunnel id and pcecc tunnel info pairs collection from tunnel info store.
91 *
92 * @return collection of tunnel id and pcecc tunnel info pairs
93 */
94 Map<TunnelId, List<LspLocalLabelInfo>> getTunnelInfos();
95
96 /**
97 * Retrieves node label for specified device id.
98 *
99 * @param id device id
100 * @return node label
101 */
102 LabelResourceId getGlobalNodeLabel(DeviceId id);
103
104 /**
105 * Retrieves adjacency label for specified link.
106 *
107 * @param link between devices
108 * @return adjacency label
109 */
110 LabelResourceId getAdjLabel(Link link);
111
112 /**
113 * Retrieves local label info with tunnel consumer id from tunnel info store.
114 *
115 * @param tunnelId tunnel id
116 * @return pcecc tunnel info
117 */
118 List<LspLocalLabelInfo> getTunnelInfo(TunnelId tunnelId);
119
120 /**
121 * Stores node label into global node label store.
122 *
123 * @param deviceId device id
124 * @param labelId node label id
125 */
126 void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId);
127
128 /**
129 * Stores adjacency label into adjacency label store.
130 *
131 * @param link link between nodes
132 * @param labelId link label id
133 */
134 void addAdjLabel(Link link, LabelResourceId labelId);
135
136 /**
137 * Stores local label info with tunnel consumer id into tunnel info store for specified tunnel id.
138 *
139 * @param tunnelId tunnel id
140 * @param lspLocalLabelInfoList local label info
141 */
142 void addTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList);
143
144 /**
145 * Removes device label from global node label store for specified device id.
146 *
147 * @param id device id
148 * @return success or failure
149 */
150 boolean removeGlobalNodeLabel(DeviceId id);
151
152 /**
153 * Removes adjacency label from adjacency label store for specified link information.
154 *
155 * @param link between nodes
156 * @return success or failure
157 */
158 boolean removeAdjLabel(Link link);
159
160 /**
161 * Removes local label info with tunnel consumer id from tunnel info store for specified tunnel id.
162 *
163 * @param tunnelId tunnel id
164 * @return success or failure
165 */
166 boolean removeTunnelInfo(TunnelId tunnelId);
167
168 /**
169 * Adds lsrid to device id mapping.
170 *
171 * @param lsrId lsrId of the device
172 * @param deviceId device id
173 * @return success or failure
174 */
175 boolean addLsrIdDevice(String lsrId, DeviceId deviceId);
176
177 /**
178 * Removes lsrid to device id mapping.
179 *
180 * @param lsrId lsrId of the device
181 * @return success or failure
182 */
183 boolean removeLsrIdDevice(String lsrId);
184
185 /**
186 * Gets lsrid to device id mapping.
187 *
188 * @param lsrId lsrId of the device
189 * @return device id of the lsrId
190 */
191 DeviceId getLsrIdDevice(String lsrId);
192
193 /**
194 * Adds lsrId of the PCC in form of device id for the PCC for which sync is pending due to non-availability of BGP.
195 * device.
196 *
197 * @param lsrId LSR id of the PCC in form of device id
198 * @return success or failure
199 */
200 public boolean addPccLsr(DeviceId lsrId);
201
202 /**
203 * Removes lsrId of the PCC in form of device id for the PCC for which pending sync is done.
204 *
205 * @param lsrId LSR id of the PCC in form of device id
206 * @return success or failure
207 */
208 public boolean removePccLsr(DeviceId lsrId);
209
210 /**
211 * Gets lsrId of the PCC in form of device id.
212 *
213 * @param lsrId LSR id of the PCC in form of device id
214 * @return success or failure
215 */
216 public boolean hasPccLsr(DeviceId lsrId);
217}