Committed by
Gerrit Code Review
Remove deprecated Optical provider
Change-Id: Ifaa67ec9a5eb93a8b6b16fda3351db381ac47590
Showing
8 changed files
with
0 additions
and
1069 deletions
apps/optical/src/main/java/org/onosproject/optical/cfg/OpticalConfigProvider.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
19 | -import com.fasterxml.jackson.core.JsonParseException; | ||
20 | -import com.fasterxml.jackson.databind.JsonMappingException; | ||
21 | -import com.fasterxml.jackson.databind.JsonNode; | ||
22 | -import com.fasterxml.jackson.databind.ObjectMapper; | ||
23 | -import org.onlab.packet.ChassisId; | ||
24 | -import org.onosproject.net.ConnectPoint; | ||
25 | -import org.onosproject.net.DefaultAnnotations; | ||
26 | -import org.onosproject.net.Device; | ||
27 | -import org.onosproject.net.DeviceId; | ||
28 | -import org.onosproject.net.Link; | ||
29 | -import org.onosproject.net.MastershipRole; | ||
30 | -import org.onosproject.net.PortNumber; | ||
31 | -import org.onosproject.net.device.DefaultDeviceDescription; | ||
32 | -import org.onosproject.net.device.DeviceDescription; | ||
33 | -import org.onosproject.net.device.DeviceProvider; | ||
34 | -import org.onosproject.net.device.DeviceProviderRegistry; | ||
35 | -import org.onosproject.net.device.DeviceProviderService; | ||
36 | -import org.onosproject.net.link.DefaultLinkDescription; | ||
37 | -import org.onosproject.net.link.LinkProvider; | ||
38 | -import org.onosproject.net.link.LinkProviderRegistry; | ||
39 | -import org.onosproject.net.link.LinkProviderService; | ||
40 | -import org.onosproject.net.provider.AbstractProvider; | ||
41 | -import org.onosproject.net.provider.ProviderId; | ||
42 | -import org.slf4j.Logger; | ||
43 | -import org.slf4j.LoggerFactory; | ||
44 | - | ||
45 | -import java.io.File; | ||
46 | -import java.io.IOException; | ||
47 | -import java.util.ArrayList; | ||
48 | -import java.util.Iterator; | ||
49 | -import java.util.List; | ||
50 | -import java.util.Map; | ||
51 | -import java.util.Set; | ||
52 | - | ||
53 | -import static org.onosproject.net.DeviceId.deviceId; | ||
54 | - | ||
55 | -/** | ||
56 | - * OpticalConfigProvider emulates the SB network provider for optical switches, | ||
57 | - * optical links and any other state that needs to be configured for correct network | ||
58 | - * operations. | ||
59 | - * | ||
60 | - * @deprecated in Cardinal Release | ||
61 | - */ | ||
62 | -@Deprecated | ||
63 | -@JsonIgnoreProperties(ignoreUnknown = true) | ||
64 | -//@Component(immediate = true) | ||
65 | -public class OpticalConfigProvider extends AbstractProvider implements DeviceProvider, LinkProvider { | ||
66 | - | ||
67 | - protected static final Logger log = LoggerFactory | ||
68 | - .getLogger(OpticalConfigProvider.class); | ||
69 | - | ||
70 | - // TODO: fix hard coded file path later. | ||
71 | - private static final String DEFAULT_CONFIG_FILE = | ||
72 | - "config/demo-3-roadm-2-ps.json"; | ||
73 | - private String configFileName = DEFAULT_CONFIG_FILE; | ||
74 | - | ||
75 | -// @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
76 | - protected LinkProviderRegistry linkProviderRegistry; | ||
77 | - | ||
78 | -// @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
79 | - protected DeviceProviderRegistry deviceProviderRegistry; | ||
80 | - | ||
81 | - private static final String OPTICAL_ANNOTATION = "optical."; | ||
82 | - | ||
83 | - private LinkProviderService linkProviderService; | ||
84 | - private DeviceProviderService deviceProviderService; | ||
85 | - | ||
86 | - private static final List<Roadm> RAW_ROADMS = new ArrayList<>(); | ||
87 | - private static final List<WdmLink> RAW_WDMLINKS = new ArrayList<>(); | ||
88 | - private static final List<PktOptLink> RAW_PKTOPTLINKS = new ArrayList<>(); | ||
89 | - | ||
90 | - private static final String ROADM = "Roadm"; | ||
91 | - private static final String WDM_LINK = "wdmLink"; | ||
92 | - private static final String PKT_OPT_LINK = "pktOptLink"; | ||
93 | - | ||
94 | - protected OpticalNetworkConfig opticalNetworkConfig; | ||
95 | - | ||
96 | - public OpticalConfigProvider() { | ||
97 | - super(new ProviderId("optical", "org.onosproject.provider" + | ||
98 | - ".opticalConfig")); | ||
99 | - } | ||
100 | - | ||
101 | -// @Activate | ||
102 | - protected void activate() { | ||
103 | - linkProviderService = linkProviderRegistry.register(this); | ||
104 | - deviceProviderService = deviceProviderRegistry.register(this); | ||
105 | - log.info("Starting optical network configuration process..."); | ||
106 | - log.info("Optical config file set to {}", configFileName); | ||
107 | - | ||
108 | - loadOpticalConfig(); | ||
109 | - parseOpticalConfig(); | ||
110 | - publishOpticalConfig(); | ||
111 | - } | ||
112 | - | ||
113 | -// @Deactivate | ||
114 | - protected void deactivate() { | ||
115 | - linkProviderRegistry.unregister(this); | ||
116 | - linkProviderService = null; | ||
117 | - deviceProviderRegistry.unregister(this); | ||
118 | - deviceProviderService = null; | ||
119 | - RAW_ROADMS.clear(); | ||
120 | - RAW_WDMLINKS.clear(); | ||
121 | - RAW_PKTOPTLINKS.clear(); | ||
122 | - log.info("Stopped"); | ||
123 | - } | ||
124 | - | ||
125 | - private void loadOpticalConfig() { | ||
126 | - ObjectMapper mapper = new ObjectMapper(); | ||
127 | - opticalNetworkConfig = new OpticalNetworkConfig(); | ||
128 | - try { | ||
129 | - opticalNetworkConfig = mapper.readValue(new File(configFileName), OpticalNetworkConfig.class); | ||
130 | - } catch (JsonParseException e) { | ||
131 | - String err = String.format("JsonParseException while loading network " | ||
132 | - + "config from file: %s: %s", configFileName, e.getMessage()); | ||
133 | - log.error(err, e); | ||
134 | - } catch (JsonMappingException e) { | ||
135 | - String err = String.format( | ||
136 | - "JsonMappingException while loading network config " | ||
137 | - + "from file: %s: %s", configFileName, e.getMessage()); | ||
138 | - log.error(err, e); | ||
139 | - } catch (IOException e) { | ||
140 | - String err = String.format("IOException while loading network config " | ||
141 | - + "from file: %s %s", configFileName, e.getMessage()); | ||
142 | - log.error(err, e); | ||
143 | - } | ||
144 | - } | ||
145 | - | ||
146 | - private void parseOpticalConfig() { | ||
147 | - List<OpticalSwitchDescription> swList = opticalNetworkConfig.getOpticalSwitches(); | ||
148 | - List<OpticalLinkDescription> lkList = opticalNetworkConfig.getOpticalLinks(); | ||
149 | - | ||
150 | - for (OpticalSwitchDescription sw : swList) { | ||
151 | - String swtype = sw.getType(); | ||
152 | - boolean allow = sw.isAllowed(); | ||
153 | - if (swtype.equals(ROADM) && allow) { | ||
154 | - int regNum = 0; | ||
155 | - Set<Map.Entry<String, JsonNode>> m = sw.params.entrySet(); | ||
156 | - for (Map.Entry<String, JsonNode> e : m) { | ||
157 | - String key = e.getKey(); | ||
158 | - JsonNode j = e.getValue(); | ||
159 | - if (key.equals("numRegen")) { | ||
160 | - regNum = j.asInt(); | ||
161 | - } | ||
162 | - } | ||
163 | - | ||
164 | - Roadm newRoadm = new Roadm(); | ||
165 | - newRoadm.setName(sw.name); | ||
166 | - newRoadm.setNodeId(sw.nodeDpid); | ||
167 | - newRoadm.setLongtitude(sw.longitude); | ||
168 | - newRoadm.setLatitude(sw.latitude); | ||
169 | - newRoadm.setRegenNum(regNum); | ||
170 | - | ||
171 | - RAW_ROADMS.add(newRoadm); | ||
172 | - log.info(newRoadm.toString()); | ||
173 | - } | ||
174 | - } | ||
175 | - | ||
176 | - for (OpticalLinkDescription lk : lkList) { | ||
177 | - String lktype = lk.getType(); | ||
178 | - switch (lktype) { | ||
179 | - case WDM_LINK: | ||
180 | - WdmLink newWdmLink = new WdmLink(); | ||
181 | - newWdmLink.setSrcNodeId(lk.getNodeDpid1()); | ||
182 | - newWdmLink.setSnkNodeId(lk.getNodeDpid2()); | ||
183 | - newWdmLink.setAdminWeight(1000); // default weight for each WDM link. | ||
184 | - Set<Map.Entry<String, JsonNode>> m = lk.params.entrySet(); | ||
185 | - for (Map.Entry<String, JsonNode> e : m) { | ||
186 | - String key = e.getKey(); | ||
187 | - JsonNode j = e.getValue(); | ||
188 | - if (key.equals("nodeName1")) { | ||
189 | - newWdmLink.setSrcNodeName(j.asText()); | ||
190 | - } else if (key.equals("nodeName2")) { | ||
191 | - newWdmLink.setSnkNodeName(j.asText()); | ||
192 | - } else if (key.equals("port1")) { | ||
193 | - newWdmLink.setSrcPort(j.asInt()); | ||
194 | - } else if (key.equals("port2")) { | ||
195 | - newWdmLink.setSnkPort(j.asInt()); | ||
196 | - } else if (key.equals("distKms")) { | ||
197 | - newWdmLink.setDistance(j.asDouble()); | ||
198 | - } else if (key.equals("numWaves")) { | ||
199 | - newWdmLink.setWavelengthNumber(j.asInt()); | ||
200 | - } else { | ||
201 | - log.error("error found"); | ||
202 | - // TODO add exception processing; | ||
203 | - } | ||
204 | - } | ||
205 | - RAW_WDMLINKS.add(newWdmLink); | ||
206 | - log.info(newWdmLink.toString()); | ||
207 | - | ||
208 | - break; | ||
209 | - | ||
210 | - case PKT_OPT_LINK: | ||
211 | - PktOptLink newPktOptLink = new PktOptLink(); | ||
212 | - newPktOptLink.setSrcNodeId(lk.getNodeDpid1()); | ||
213 | - newPktOptLink.setSnkNodeId(lk.getNodeDpid2()); | ||
214 | - newPktOptLink.setAdminWeight(10); // default weight for each packet-optical link. | ||
215 | - Set<Map.Entry<String, JsonNode>> ptm = lk.params.entrySet(); | ||
216 | - for (Map.Entry<String, JsonNode> e : ptm) { | ||
217 | - String key = e.getKey(); | ||
218 | - JsonNode j = e.getValue(); | ||
219 | - if (key.equals("nodeName1")) { | ||
220 | - newPktOptLink.setSrcNodeName(j.asText()); | ||
221 | - } else if (key.equals("nodeName2")) { | ||
222 | - newPktOptLink.setSnkNodeName(j.asText()); | ||
223 | - } else if (key.equals("port1")) { | ||
224 | - newPktOptLink.setSrcPort(j.asInt()); | ||
225 | - } else if (key.equals("port2")) { | ||
226 | - newPktOptLink.setSnkPort(j.asInt()); | ||
227 | - } else if (key.equals("bandWidth")) { | ||
228 | - newPktOptLink.setBandwdith(j.asDouble()); | ||
229 | - } else { | ||
230 | - log.error("error found"); | ||
231 | - // TODO add exception processing; | ||
232 | - } | ||
233 | - } | ||
234 | - | ||
235 | - RAW_PKTOPTLINKS.add(newPktOptLink); | ||
236 | - log.info(newPktOptLink.toString()); | ||
237 | - break; | ||
238 | - default: | ||
239 | - } | ||
240 | - } | ||
241 | - } | ||
242 | - | ||
243 | - private void publishOpticalConfig() { | ||
244 | - if (deviceProviderService == null || linkProviderService == null) { | ||
245 | - return; | ||
246 | - } | ||
247 | - | ||
248 | - // Discover the optical ROADM objects | ||
249 | - Iterator<Roadm> iterWdmNode = RAW_ROADMS.iterator(); | ||
250 | - while (iterWdmNode.hasNext()) { | ||
251 | - Roadm value = iterWdmNode.next(); | ||
252 | - DeviceId did = deviceId("of:" + value.getNodeId().replace(":", "")); | ||
253 | - ChassisId cid = new ChassisId(); | ||
254 | - DefaultAnnotations extendedAttributes = DefaultAnnotations.builder() | ||
255 | - .set(OPTICAL_ANNOTATION + "switchType", "ROADM") | ||
256 | - .set(OPTICAL_ANNOTATION + "switchName", value.getName()) | ||
257 | - .set(OPTICAL_ANNOTATION + "latitude", Double.toString(value.getLatitude())) | ||
258 | - .set(OPTICAL_ANNOTATION + "longtitude", Double.toString(value.getLongtitude())) | ||
259 | - .set(OPTICAL_ANNOTATION + "regNum", Integer.toString(value.getRegenNum())) | ||
260 | - .build(); | ||
261 | - | ||
262 | - DeviceDescription description = | ||
263 | - new DefaultDeviceDescription(did.uri(), | ||
264 | - Device.Type.SWITCH, | ||
265 | - "", | ||
266 | - "", | ||
267 | - "", | ||
268 | - "", | ||
269 | - cid, | ||
270 | - extendedAttributes); | ||
271 | - deviceProviderService.deviceConnected(did, description); | ||
272 | - } | ||
273 | - | ||
274 | - // Discover the optical WDM link objects | ||
275 | - Iterator<WdmLink> iterWdmlink = RAW_WDMLINKS.iterator(); | ||
276 | - while (iterWdmlink.hasNext()) { | ||
277 | - WdmLink value = iterWdmlink.next(); | ||
278 | - | ||
279 | - DeviceId srcNodeId = deviceId("of:" + value.getSrcNodeId().replace(":", "")); | ||
280 | - DeviceId snkNodeId = deviceId("of:" + value.getSnkNodeId().replace(":", "")); | ||
281 | - | ||
282 | - PortNumber srcPort = PortNumber.portNumber(value.getSrcPort()); | ||
283 | - PortNumber snkPort = PortNumber.portNumber(value.getSnkPort()); | ||
284 | - | ||
285 | - ConnectPoint srcPoint = new ConnectPoint(srcNodeId, srcPort); | ||
286 | - ConnectPoint snkPoint = new ConnectPoint(snkNodeId, snkPort); | ||
287 | - | ||
288 | - DefaultAnnotations extendedAttributes = DefaultAnnotations.builder() | ||
289 | - .set(OPTICAL_ANNOTATION + "linkType", "WDM") | ||
290 | - .set(OPTICAL_ANNOTATION + "distance", Double.toString(value.getDistance())) | ||
291 | - .set(OPTICAL_ANNOTATION + "cost", Double.toString(value.getDistance())) | ||
292 | - .set(OPTICAL_ANNOTATION + "adminWeight", Double.toString(value.getAdminWeight())) | ||
293 | - .set(OPTICAL_ANNOTATION + "wavelengthNum", Integer.toString(value.getWavelengthNumber())) | ||
294 | - .build(); | ||
295 | - | ||
296 | - DefaultLinkDescription linkDescription = | ||
297 | - new DefaultLinkDescription(srcPoint, | ||
298 | - snkPoint, | ||
299 | - Link.Type.OPTICAL, | ||
300 | - extendedAttributes); | ||
301 | - | ||
302 | - linkProviderService.linkDetected(linkDescription); | ||
303 | - log.info(String.format("WDM link: %s : %s", | ||
304 | - linkDescription.src().toString(), linkDescription.dst().toString())); | ||
305 | - | ||
306 | - | ||
307 | - DefaultLinkDescription linkDescriptionReverse = | ||
308 | - new DefaultLinkDescription(snkPoint, | ||
309 | - srcPoint, | ||
310 | - Link.Type.OPTICAL, | ||
311 | - extendedAttributes); | ||
312 | - | ||
313 | - linkProviderService.linkDetected(linkDescriptionReverse); | ||
314 | - log.info(String.format("WDM link: %s : %s", | ||
315 | - linkDescriptionReverse.src().toString(), linkDescriptionReverse.dst().toString())); | ||
316 | - } | ||
317 | - | ||
318 | - // Discover the packet optical link objects | ||
319 | - Iterator<PktOptLink> iterPktOptlink = RAW_PKTOPTLINKS.iterator(); | ||
320 | - while (iterPktOptlink.hasNext()) { | ||
321 | - PktOptLink value = iterPktOptlink.next(); | ||
322 | - DeviceId srcNodeId = deviceId("of:" + value.getSrcNodeId().replace(":", "")); | ||
323 | - DeviceId snkNodeId = deviceId("of:" + value.getSnkNodeId().replace(":", "")); | ||
324 | - | ||
325 | - PortNumber srcPort = PortNumber.portNumber(value.getSrcPort()); | ||
326 | - PortNumber snkPort = PortNumber.portNumber(value.getSnkPort()); | ||
327 | - | ||
328 | - ConnectPoint srcPoint = new ConnectPoint(srcNodeId, srcPort); | ||
329 | - ConnectPoint snkPoint = new ConnectPoint(snkNodeId, snkPort); | ||
330 | - | ||
331 | - DefaultAnnotations extendedAttributes = DefaultAnnotations.builder() | ||
332 | - .set(OPTICAL_ANNOTATION + "linkType", "PktOptLink") | ||
333 | - .set(OPTICAL_ANNOTATION + "bandwidth", Double.toString(value.getBandwidth())) | ||
334 | - .set(OPTICAL_ANNOTATION + "cost", Double.toString(value.getBandwidth())) | ||
335 | - .set(OPTICAL_ANNOTATION + "adminWeight", Double.toString(value.getAdminWeight())) | ||
336 | - .build(); | ||
337 | - | ||
338 | - DefaultLinkDescription linkDescription = | ||
339 | - new DefaultLinkDescription(srcPoint, | ||
340 | - snkPoint, | ||
341 | - Link.Type.OPTICAL, | ||
342 | - extendedAttributes); | ||
343 | - | ||
344 | - linkProviderService.linkDetected(linkDescription); | ||
345 | - log.info(String.format("Packet-optical link: %s : %s", | ||
346 | - linkDescription.src().toString(), linkDescription.dst().toString())); | ||
347 | - | ||
348 | - DefaultLinkDescription linkDescriptionReverse = | ||
349 | - new DefaultLinkDescription(snkPoint, | ||
350 | - srcPoint, | ||
351 | - Link.Type.OPTICAL, | ||
352 | - extendedAttributes); | ||
353 | - | ||
354 | - linkProviderService.linkDetected(linkDescriptionReverse); | ||
355 | - log.info(String.format("Packet-optical link: %s : %s", | ||
356 | - linkDescriptionReverse.src().toString(), linkDescriptionReverse.dst().toString())); | ||
357 | - } | ||
358 | - | ||
359 | - } | ||
360 | - | ||
361 | - @Override | ||
362 | - public void triggerProbe(DeviceId deviceId) { | ||
363 | - // TODO We may want to consider re-reading config files and publishing them based on this event. | ||
364 | - } | ||
365 | - | ||
366 | - @Override | ||
367 | - public void roleChanged(DeviceId device, MastershipRole newRole) { | ||
368 | - } | ||
369 | - | ||
370 | - @Override | ||
371 | - public boolean isReachable(DeviceId device) { | ||
372 | - return false; | ||
373 | - } | ||
374 | -} |
apps/optical/src/main/java/org/onosproject/optical/cfg/OpticalLinkDescription.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.databind.JsonNode; | ||
19 | -import org.onlab.util.HexString; | ||
20 | - | ||
21 | -import java.util.Map; | ||
22 | - | ||
23 | -/** | ||
24 | - * Public class corresponding to JSON described data model. | ||
25 | - * | ||
26 | - * @deprecated in Cardinal Release | ||
27 | - */ | ||
28 | -@Deprecated | ||
29 | -public class OpticalLinkDescription { | ||
30 | - protected String type; | ||
31 | - protected Boolean allowed; | ||
32 | - protected long dpid1; | ||
33 | - protected long dpid2; | ||
34 | - protected String nodeDpid1; | ||
35 | - protected String nodeDpid2; | ||
36 | - protected Map<String, JsonNode> params; | ||
37 | - protected Map<String, String> publishAttributes; | ||
38 | - | ||
39 | - public String getType() { | ||
40 | - return type; | ||
41 | - } | ||
42 | - | ||
43 | - public void setType(String type) { | ||
44 | - this.type = type; | ||
45 | - } | ||
46 | - | ||
47 | - public Boolean isAllowed() { | ||
48 | - return allowed; | ||
49 | - } | ||
50 | - | ||
51 | - public void setAllowed(Boolean allowed) { | ||
52 | - this.allowed = allowed; | ||
53 | - } | ||
54 | - | ||
55 | - public String getNodeDpid1() { | ||
56 | - return nodeDpid1; | ||
57 | - } | ||
58 | - | ||
59 | - public void setNodeDpid1(String nodeDpid1) { | ||
60 | - this.nodeDpid1 = nodeDpid1; | ||
61 | - this.dpid1 = HexString.toLong(nodeDpid1); | ||
62 | - } | ||
63 | - | ||
64 | - public String getNodeDpid2() { | ||
65 | - return nodeDpid2; | ||
66 | - } | ||
67 | - | ||
68 | - public void setNodeDpid2(String nodeDpid2) { | ||
69 | - this.nodeDpid2 = nodeDpid2; | ||
70 | - this.dpid2 = HexString.toLong(nodeDpid2); | ||
71 | - } | ||
72 | - | ||
73 | - public long getDpid1() { | ||
74 | - return dpid1; | ||
75 | - } | ||
76 | - | ||
77 | - public void setDpid1(long dpid1) { | ||
78 | - this.dpid1 = dpid1; | ||
79 | - this.nodeDpid1 = HexString.toHexString(dpid1); | ||
80 | - } | ||
81 | - | ||
82 | - public long getDpid2() { | ||
83 | - return dpid2; | ||
84 | - } | ||
85 | - | ||
86 | - public void setDpid2(long dpid2) { | ||
87 | - this.dpid2 = dpid2; | ||
88 | - this.nodeDpid2 = HexString.toHexString(dpid2); | ||
89 | - } | ||
90 | - | ||
91 | - public Map<String, JsonNode> getParams() { | ||
92 | - return params; | ||
93 | - } | ||
94 | - | ||
95 | - public void setParams(Map<String, JsonNode> params) { | ||
96 | - this.params = params; | ||
97 | - } | ||
98 | - | ||
99 | - public Map<String, String> getPublishAttributes() { | ||
100 | - return publishAttributes; | ||
101 | - } | ||
102 | - | ||
103 | - public void setPublishAttributes(Map<String, String> publishAttributes) { | ||
104 | - this.publishAttributes = publishAttributes; | ||
105 | - } | ||
106 | - | ||
107 | -} | ||
108 | - |
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -import java.util.ArrayList; | ||
19 | -import java.util.List; | ||
20 | - | ||
21 | -import org.slf4j.Logger; | ||
22 | -import org.slf4j.LoggerFactory; | ||
23 | - | ||
24 | -/** | ||
25 | - * Public class corresponding to JSON described data model. | ||
26 | - * | ||
27 | - * @deprecated in Cardinal Release | ||
28 | - */ | ||
29 | -@Deprecated | ||
30 | -public class OpticalNetworkConfig { | ||
31 | - protected static final Logger log = LoggerFactory.getLogger(OpticalNetworkConfig.class); | ||
32 | - | ||
33 | - private List<OpticalSwitchDescription> opticalSwitches; | ||
34 | - private List<OpticalLinkDescription> opticalLinks; | ||
35 | - | ||
36 | - public OpticalNetworkConfig() { | ||
37 | - opticalSwitches = new ArrayList<>(); | ||
38 | - opticalLinks = new ArrayList<>(); | ||
39 | - } | ||
40 | - | ||
41 | - public List<OpticalSwitchDescription> getOpticalSwitches() { | ||
42 | - return opticalSwitches; | ||
43 | - } | ||
44 | - | ||
45 | - public void setOpticalSwitches(List<OpticalSwitchDescription> switches) { | ||
46 | - this.opticalSwitches = switches; | ||
47 | - } | ||
48 | - | ||
49 | - public List<OpticalLinkDescription> getOpticalLinks() { | ||
50 | - return opticalLinks; | ||
51 | - } | ||
52 | - | ||
53 | - public void setOpticalLinks(List<OpticalLinkDescription> links) { | ||
54 | - this.opticalLinks = links; | ||
55 | - } | ||
56 | - | ||
57 | -} | ||
58 | - |
apps/optical/src/main/java/org/onosproject/optical/cfg/OpticalSwitchDescription.java
deleted
100644 → 0
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -import com.fasterxml.jackson.annotation.JsonProperty; | ||
19 | -import com.fasterxml.jackson.databind.JsonNode; | ||
20 | -import org.onlab.util.HexString; | ||
21 | - | ||
22 | -import java.util.Map; | ||
23 | - | ||
24 | -/** | ||
25 | - * Public class corresponding to JSON described data model. | ||
26 | - * | ||
27 | - * @deprecated in Cardinal Release | ||
28 | - */ | ||
29 | -@Deprecated | ||
30 | -public class OpticalSwitchDescription { | ||
31 | - protected String name; | ||
32 | - protected long dpid; | ||
33 | - protected String nodeDpid; | ||
34 | - protected String type; | ||
35 | - protected double latitude; | ||
36 | - protected double longitude; | ||
37 | - protected boolean allowed; | ||
38 | - protected Map<String, JsonNode> params; | ||
39 | - protected Map<String, String> publishAttributes; | ||
40 | - | ||
41 | - public String getName() { | ||
42 | - return name; | ||
43 | - } | ||
44 | - @JsonProperty("name") | ||
45 | - public void setName(String name) { | ||
46 | - this.name = name; | ||
47 | - } | ||
48 | - | ||
49 | - public long getDpid() { | ||
50 | - return dpid; | ||
51 | - } | ||
52 | - @JsonProperty("dpid") | ||
53 | - public void setDpid(long dpid) { | ||
54 | - this.dpid = dpid; | ||
55 | - this.nodeDpid = HexString.toHexString(dpid); | ||
56 | - } | ||
57 | - | ||
58 | - public String getNodeDpid() { | ||
59 | - return nodeDpid; | ||
60 | - } | ||
61 | - | ||
62 | - public String getHexDpid() { | ||
63 | - return nodeDpid; | ||
64 | - } | ||
65 | - | ||
66 | - public void setNodeDpid(String nodeDpid) { | ||
67 | - this.nodeDpid = nodeDpid; | ||
68 | - this.dpid = HexString.toLong(nodeDpid); | ||
69 | - } | ||
70 | - | ||
71 | - public String getType() { | ||
72 | - return type; | ||
73 | - } | ||
74 | - | ||
75 | - public void setType(String type) { | ||
76 | - this.type = type; | ||
77 | - } | ||
78 | - | ||
79 | - public double getLatitude() { | ||
80 | - return latitude; | ||
81 | - } | ||
82 | - | ||
83 | - public void setLatitude(double latitude) { | ||
84 | - this.latitude = latitude; | ||
85 | - } | ||
86 | - | ||
87 | - public double getLongitude() { | ||
88 | - return longitude; | ||
89 | - } | ||
90 | - | ||
91 | - public void setLongitude(double longitude) { | ||
92 | - this.longitude = longitude; | ||
93 | - } | ||
94 | - | ||
95 | - public boolean isAllowed() { | ||
96 | - return allowed; | ||
97 | - } | ||
98 | - | ||
99 | - public void setAllowed(boolean allowed) { | ||
100 | - this.allowed = allowed; | ||
101 | - } | ||
102 | - | ||
103 | - public Map<String, JsonNode> getParams() { | ||
104 | - return params; | ||
105 | - } | ||
106 | - | ||
107 | - public void setParams(Map<String, JsonNode> params) { | ||
108 | - this.params = params; | ||
109 | - } | ||
110 | - | ||
111 | - public Map<String, String> getPublishAttributes() { | ||
112 | - return publishAttributes; | ||
113 | - } | ||
114 | - | ||
115 | - public void setPublishAttributes(Map<String, String> publishAttributes) { | ||
116 | - this.publishAttributes = publishAttributes; | ||
117 | - } | ||
118 | - | ||
119 | -} |
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -/** | ||
19 | - * Packet-optical link Java data object. | ||
20 | - * | ||
21 | - * @deprecated in Cardinal Release | ||
22 | - */ | ||
23 | -@Deprecated | ||
24 | -class PktOptLink { | ||
25 | - private String srcNodeName; | ||
26 | - private String snkNodeName; | ||
27 | - private String srcNodeId; | ||
28 | - private String snkNodeId; | ||
29 | - private int srcPort; | ||
30 | - private int snkPort; | ||
31 | - private double bandwidth; | ||
32 | - private double cost; | ||
33 | - private long adminWeight; | ||
34 | - | ||
35 | - public PktOptLink(String srcName, String snkName) { | ||
36 | - this.srcNodeName = srcName; | ||
37 | - this.snkNodeName = snkName; | ||
38 | - } | ||
39 | - | ||
40 | - public PktOptLink() { | ||
41 | - } | ||
42 | - | ||
43 | - public void setSrcNodeName(String name) { | ||
44 | - this.srcNodeName = name; | ||
45 | - } | ||
46 | - | ||
47 | - public String getSrcNodeName() { | ||
48 | - return this.srcNodeName; | ||
49 | - } | ||
50 | - | ||
51 | - public void setSnkNodeName(String name) { | ||
52 | - this.snkNodeName = name; | ||
53 | - } | ||
54 | - | ||
55 | - public String getSnkNodeName() { | ||
56 | - return this.snkNodeName; | ||
57 | - } | ||
58 | - | ||
59 | - public void setSrcNodeId(String nodeId) { | ||
60 | - this.srcNodeId = nodeId; | ||
61 | - } | ||
62 | - | ||
63 | - public String getSrcNodeId() { | ||
64 | - return this.srcNodeId; | ||
65 | - } | ||
66 | - | ||
67 | - public void setSnkNodeId(String nodeId) { | ||
68 | - this.snkNodeId = nodeId; | ||
69 | - } | ||
70 | - | ||
71 | - public String getSnkNodeId() { | ||
72 | - return this.snkNodeId; | ||
73 | - } | ||
74 | - | ||
75 | - public void setSrcPort(int port) { | ||
76 | - this.srcPort = port; | ||
77 | - } | ||
78 | - | ||
79 | - public int getSrcPort() { | ||
80 | - return this.srcPort; | ||
81 | - } | ||
82 | - | ||
83 | - public void setSnkPort(int port) { | ||
84 | - this.snkPort = port; | ||
85 | - } | ||
86 | - | ||
87 | - public int getSnkPort() { | ||
88 | - return this.snkPort; | ||
89 | - } | ||
90 | - | ||
91 | - public void setBandwdith(double x) { | ||
92 | - this.bandwidth = x; | ||
93 | - } | ||
94 | - | ||
95 | - public double getBandwidth() { | ||
96 | - return this.bandwidth; | ||
97 | - } | ||
98 | - | ||
99 | - public void setCost(double x) { | ||
100 | - this.cost = x; | ||
101 | - } | ||
102 | - | ||
103 | - public double getCost() { | ||
104 | - return this.cost; | ||
105 | - } | ||
106 | - | ||
107 | - public void setAdminWeight(long x) { | ||
108 | - this.adminWeight = x; | ||
109 | - } | ||
110 | - | ||
111 | - public long getAdminWeight() { | ||
112 | - return this.adminWeight; | ||
113 | - } | ||
114 | - | ||
115 | - @Override | ||
116 | - public String toString() { | ||
117 | - return new StringBuilder(" srcNodeName: ").append(this.srcNodeName) | ||
118 | - .append(" snkNodeName: ").append(this.snkNodeName) | ||
119 | - .append(" srcNodeId: ").append(this.srcNodeId) | ||
120 | - .append(" snkNodeId: ").append(this.snkNodeId) | ||
121 | - .append(" srcPort: ").append(this.srcPort) | ||
122 | - .append(" snkPort: ").append(this.snkPort) | ||
123 | - .append(" bandwidth: ").append(this.bandwidth) | ||
124 | - .append(" cost: ").append(this.cost) | ||
125 | - .append(" adminWeight: ").append(this.adminWeight).toString(); | ||
126 | - } | ||
127 | -} |
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -/** | ||
19 | - * ROADM java data object converted from a JSON file. | ||
20 | - * | ||
21 | - * @deprecated in Cardinal Release | ||
22 | - */ | ||
23 | -@Deprecated | ||
24 | -class Roadm { | ||
25 | - private String name; | ||
26 | - private String nodeID; | ||
27 | - private double longtitude; | ||
28 | - private double latitude; | ||
29 | - private int regenNum; | ||
30 | - | ||
31 | - //TODO use the following attributes when needed for configurations | ||
32 | - private int tPort10G; | ||
33 | - private int tPort40G; | ||
34 | - private int tPort100G; | ||
35 | - private int wPort; | ||
36 | - | ||
37 | - public Roadm() { | ||
38 | - } | ||
39 | - | ||
40 | - public Roadm(String name) { | ||
41 | - this.name = name; | ||
42 | - } | ||
43 | - | ||
44 | - public void setName(String name) { | ||
45 | - this.name = name; | ||
46 | - } | ||
47 | - | ||
48 | - public String getName() { | ||
49 | - return this.name; | ||
50 | - } | ||
51 | - | ||
52 | - public void setNodeId(String nameId) { | ||
53 | - this.nodeID = nameId; | ||
54 | - } | ||
55 | - | ||
56 | - public String getNodeId() { | ||
57 | - return this.nodeID; | ||
58 | - } | ||
59 | - | ||
60 | - public void setLongtitude(double x) { | ||
61 | - this.longtitude = x; | ||
62 | - } | ||
63 | - | ||
64 | - public double getLongtitude() { | ||
65 | - return this.longtitude; | ||
66 | - } | ||
67 | - | ||
68 | - public void setLatitude(double y) { | ||
69 | - this.latitude = y; | ||
70 | - } | ||
71 | - | ||
72 | - public double getLatitude() { | ||
73 | - return this.latitude; | ||
74 | - } | ||
75 | - | ||
76 | - public void setRegenNum(int num) { | ||
77 | - this.regenNum = num; | ||
78 | - } | ||
79 | - public int getRegenNum() { | ||
80 | - return this.regenNum; | ||
81 | - } | ||
82 | - | ||
83 | - public void setTport10GNum(int num) { | ||
84 | - this.tPort10G = num; | ||
85 | - } | ||
86 | - public int getTport10GNum() { | ||
87 | - return this.tPort10G; | ||
88 | - } | ||
89 | - | ||
90 | - public void setTport40GNum(int num) { | ||
91 | - this.tPort40G = num; | ||
92 | - } | ||
93 | - public int getTport40GNum() { | ||
94 | - return this.tPort40G; | ||
95 | - } | ||
96 | - | ||
97 | - public void setTport100GNum(int num) { | ||
98 | - this.tPort100G = num; | ||
99 | - } | ||
100 | - public int getTport100GNum() { | ||
101 | - return this.tPort100G; | ||
102 | - } | ||
103 | - | ||
104 | - public void setWportNum(int num) { | ||
105 | - this.wPort = num; | ||
106 | - } | ||
107 | - public int getWportNum() { | ||
108 | - return this.wPort; | ||
109 | - } | ||
110 | - | ||
111 | - @Override | ||
112 | - public String toString() { | ||
113 | - return new StringBuilder(" ROADM Name: ").append(this.name) | ||
114 | - .append(" nodeID: ").append(this.nodeID) | ||
115 | - .append(" longtitude: ").append(this.longtitude) | ||
116 | - .append(" latitude: ").append(this.latitude) | ||
117 | - .append(" regenNum: ").append(this.regenNum) | ||
118 | - .append(" 10GTportNum: ").append(this.tPort10G) | ||
119 | - .append(" 40GTportNum: ").append(this.tPort40G) | ||
120 | - .append(" 100GTportNum: ").append(this.tPort100G) | ||
121 | - .append(" WportNum: ").append(this.wPort).toString(); | ||
122 | - } | ||
123 | -} | ||
124 | - |
1 | -/* | ||
2 | - * Copyright 2014 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 | -package org.onosproject.optical.cfg; | ||
17 | - | ||
18 | -/** | ||
19 | - * WDM Link Java data object converted from a JSON file. | ||
20 | - * | ||
21 | - * @deprecated in Cardinal Release | ||
22 | - */ | ||
23 | -@Deprecated | ||
24 | -class WdmLink { | ||
25 | - private String srcNodeName; | ||
26 | - private String snkNodeName; | ||
27 | - private String srcNodeId; | ||
28 | - private String snkNodeId; | ||
29 | - private int srcPort; | ||
30 | - private int snkPort; | ||
31 | - private double distance; | ||
32 | - private double cost; | ||
33 | - private int wavelengthNumber; | ||
34 | - private long adminWeight; | ||
35 | - | ||
36 | - public WdmLink(String name1, String name2) { | ||
37 | - this.srcNodeName = name1; | ||
38 | - this.snkNodeName = name2; | ||
39 | - } | ||
40 | - | ||
41 | - public WdmLink() { | ||
42 | - } | ||
43 | - | ||
44 | - public void setSrcNodeName(String name) { | ||
45 | - this.srcNodeName = name; | ||
46 | - } | ||
47 | - | ||
48 | - public String getSrcNodeName() { | ||
49 | - return this.srcNodeName; | ||
50 | - } | ||
51 | - | ||
52 | - public void setSnkNodeName(String name) { | ||
53 | - this.snkNodeName = name; | ||
54 | - } | ||
55 | - | ||
56 | - public String getSnkNodeName() { | ||
57 | - return this.snkNodeName; | ||
58 | - } | ||
59 | - | ||
60 | - public void setSrcNodeId(String nodeId) { | ||
61 | - this.srcNodeId = nodeId; | ||
62 | - } | ||
63 | - | ||
64 | - public String getSrcNodeId() { | ||
65 | - return this.srcNodeId; | ||
66 | - } | ||
67 | - | ||
68 | - public void setSnkNodeId(String nodeId) { | ||
69 | - this.snkNodeId = nodeId; | ||
70 | - } | ||
71 | - | ||
72 | - public String getSnkNodeId() { | ||
73 | - return this.snkNodeId; | ||
74 | - } | ||
75 | - | ||
76 | - public void setSrcPort(int port) { | ||
77 | - this.srcPort = port; | ||
78 | - } | ||
79 | - | ||
80 | - public int getSrcPort() { | ||
81 | - return this.srcPort; | ||
82 | - } | ||
83 | - | ||
84 | - public void setSnkPort(int port) { | ||
85 | - this.snkPort = port; | ||
86 | - } | ||
87 | - | ||
88 | - public int getSnkPort() { | ||
89 | - return this.snkPort; | ||
90 | - } | ||
91 | - | ||
92 | - public void setDistance(double x) { | ||
93 | - this.distance = x; | ||
94 | - } | ||
95 | - | ||
96 | - public double getDistance() { | ||
97 | - return this.distance; | ||
98 | - } | ||
99 | - | ||
100 | - public void setCost(double x) { | ||
101 | - this.cost = x; | ||
102 | - } | ||
103 | - | ||
104 | - public double getCost() { | ||
105 | - return this.cost; | ||
106 | - } | ||
107 | - | ||
108 | - public void setWavelengthNumber(int x) { | ||
109 | - this.wavelengthNumber = x; | ||
110 | - } | ||
111 | - | ||
112 | - public int getWavelengthNumber() { | ||
113 | - return this.wavelengthNumber; | ||
114 | - } | ||
115 | - | ||
116 | - public void setAdminWeight(long x) { | ||
117 | - this.adminWeight = x; | ||
118 | - } | ||
119 | - | ||
120 | - public long getAdminWeight() { | ||
121 | - return this.adminWeight; | ||
122 | - } | ||
123 | - | ||
124 | - @Override | ||
125 | - public String toString() { | ||
126 | - return new StringBuilder(" srcNodeName: ").append(this.srcNodeName) | ||
127 | - .append(" snkNodeName: ").append(this.snkNodeName) | ||
128 | - .append(" srcNodeId: ").append(this.srcNodeId) | ||
129 | - .append(" snkNodeId: ").append(this.snkNodeId) | ||
130 | - .append(" srcPort: ").append(this.srcPort) | ||
131 | - .append(" snkPort: ").append(this.snkPort) | ||
132 | - .append(" distance: ").append(this.distance) | ||
133 | - .append(" cost: ").append(this.cost) | ||
134 | - .append(" wavelengthNumber: ").append(this.wavelengthNumber) | ||
135 | - .append(" adminWeight: ").append(this.adminWeight).toString(); | ||
136 | - } | ||
137 | -} | ||
138 | - |
1 | -/* | ||
2 | - * Copyright 2014 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 | - | ||
17 | -/** | ||
18 | - * Packet/Optical configuration. | ||
19 | - */ | ||
20 | -@Deprecated | ||
21 | -package org.onosproject.optical.cfg; |
-
Please register or login to post a comment