blob: 912330cf2cc09c243912f24db53380235f9f22dc [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;
26
27import java.util.Map;
28
29/**
30 * Abstraction of an entity providing pool of available labels to devices, links and tunnels.
31 */
32public interface PceStore {
33 /**
34 * Checks whether device id is present in global node label store.
35 *
36 * @param id device id
37 * @return success of failure
38 */
39 boolean existsGlobalNodeLabel(DeviceId id);
40
41 /**
42 * Checks whether link is present in adjacency label store.
43 *
44 * @param link link between devices
45 * @return success of failure
46 */
47 boolean existsAdjLabel(Link link);
48
49 /**
50 * Checks whether tunnel id is present in tunnel info store.
51 *
52 * @param tunnelId tunnel id
53 * @return success of failure
54 */
55 boolean existsTunnelInfo(TunnelId tunnelId);
56
57 /**
58 * Retrieves the node label count.
59 *
60 * @return node label count
61 */
62 int getGlobalNodeLabelCount();
63
64 /**
65 * Retrieves the adjacency label count.
66 *
67 * @return adjacency label count
68 */
69 int getAdjLabelCount();
70
71 /**
72 * Retrieves the tunnel info count.
73 *
74 * @return tunnel info count
75 */
76 int getTunnelInfoCount();
77
78 /**
79 * Retrieves device id and label pairs collection from global node label store.
80 *
81 * @return collection of device id and label pairs
82 */
83 Map<DeviceId, LabelResourceId> getGlobalNodeLabels();
84
85 /**
86 * Retrieves link and label pairs collection from adjacency label store.
87 *
88 * @return collection of link and label pairs
89 */
90 Map<Link, LabelResourceId> getAdjLabels();
91
92 /**
93 * Retrieves tunnel id and pcecc tunnel info pairs collection from tunnel info store.
94 *
95 * @return collection of tunnel id and pcecc tunnel info pairs
96 */
97 Map<TunnelId, PceccTunnelInfo> getTunnelInfos();
98
99 /**
100 * Retrieves node label for specified device id.
101 *
102 * @param id device id
103 * @return node label
104 */
105 LabelResourceId getGlobalNodeLabel(DeviceId id);
106
107 /**
108 * Retrieves adjacency label for specified link.
109 *
110 * @param link between devices
111 * @return adjacency label
112 */
113 LabelResourceId getAdjLabel(Link link);
114
115 /**
116 * Retrieves local label info with tunnel consumer id from tunnel info store.
117 *
118 * @param tunnelId tunnel id
119 * @return pcecc tunnel info
120 */
121 PceccTunnelInfo getTunnelInfo(TunnelId tunnelId);
122
123 /**
124 * Stores node label into global node label store.
125 *
126 * @param deviceId device id
127 * @param labelId node label id
128 */
129 void addGlobalNodeLabel(DeviceId deviceId, LabelResourceId labelId);
130
131 /**
132 * Stores adjacency label into adjacency label store.
133 *
134 * @param link link between nodes
135 * @param labelId link label id
136 */
137 void addAdjLabel(Link link, LabelResourceId labelId);
138
139 /**
140 * Stores local label info with tunnel consumer id into tunnel info store for specified tunnel id.
141 *
142 * @param tunnelId tunnel id
143 * @param pceccTunnelInfo local label info
144 */
145 void addTunnelInfo(TunnelId tunnelId, PceccTunnelInfo pceccTunnelInfo);
146
147 /**
148 * Updates local label info. The first entry is created with TunnelId and TunnelConsumerId.
149 * Later this entry may be updated to store label information if it is basic PCECC case.
150 *
151 * @param tunnelId tunnel id
152 * @param lspLocalLabelInfoList list of local labels
153 * @return success or failure
154 */
155 boolean updateTunnelInfo(TunnelId tunnelId, List<LspLocalLabelInfo> lspLocalLabelInfoList);
156
157 /**
158 * Updates tunnel info map with tunnel consumer id.
159 *
160 * @param tunnelId tunnel id
161 * @param tunnelConsumerId tunnel consumer id
162 * @return success or failure
163 */
164 boolean updateTunnelInfo(TunnelId tunnelId, ResourceConsumer tunnelConsumerId);
165
166 /**
167 * Removes device label from global node label store for specified device id.
168 *
169 * @param id device id
170 * @return success or failure
171 */
172 boolean removeGlobalNodeLabel(DeviceId id);
173
174 /**
175 * Removes adjacency label from adjacency label store for specified link information.
176 *
177 * @param link between nodes
178 * @return success or failure
179 */
180 boolean removeAdjLabel(Link link);
181
182 /**
183 * Removes local label info with tunnel consumer id from tunnel info store for specified tunnel id.
184 *
185 * @param tunnelId tunnel id
186 * @return success or failure
187 */
188 boolean removeTunnelInfo(TunnelId tunnelId);
189}