2 * Copyright © 2017 AT&T and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.renderer;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.ArrayList;
12 import java.util.Iterator;
13 import java.util.List;
15 import java.util.Optional;
16 import java.util.TreeMap;
17 import java.util.stream.Collectors;
18 import org.opendaylight.transportpce.common.NodeIdPair;
19 import org.opendaylight.transportpce.common.StringConstants;
20 import org.opendaylight.transportpce.common.fixedflex.GridConstant;
21 import org.opendaylight.transportpce.common.fixedflex.GridUtils;
22 import org.opendaylight.transportpce.common.mapping.PortMappingUtils;
23 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.Action;
24 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathInput;
25 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathInputBuilder;
26 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.ServicePathInput;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.ServicePathInputBuilder;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.otn.service.path.input.AEndApiInfo;
29 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.otn.service.path.input.AEndApiInfoBuilder;
30 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.otn.service.path.input.ZEndApiInfo;
31 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.otn.service.path.input.ZEndApiInfoBuilder;
32 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput;
33 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInputBuilder;
34 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput;
35 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutputBuilder;
36 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestInput;
37 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestOutput;
38 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceImplementationRequestOutputBuilder;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyGHz;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyTHz;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev181130.OpucnTribSlotDef;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput;
46 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.PathDescription;
47 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
48 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
49 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
50 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ztoa.direction.ZToA;
51 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.Resource;
52 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.Link;
53 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint;
54 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.optical.renderer.nodes.Nodes;
55 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.optical.renderer.nodes.NodesBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.optical.renderer.nodes.NodesKey;
57 import org.opendaylight.yangtools.yang.common.RpcResult;
58 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
59 import org.opendaylight.yangtools.yang.common.Uint32;
60 import org.slf4j.Logger;
61 import org.slf4j.LoggerFactory;
64 public final class ModelMappingUtils {
66 private static final Logger LOG = LoggerFactory.getLogger(ModelMappingUtils.class);
67 private static final String TERMINATION_POINT = "TerminationPoint";
68 private static final String LINK = "Link";
70 private ModelMappingUtils() {
73 public static ServicePowerSetupInput createServicePowerSetupInput(List<Nodes> olmList,
74 ServiceImplementationRequestInput input) {
75 ServicePowerSetupInputBuilder olmSetupBldr = new ServicePowerSetupInputBuilder().setNodes(olmList);
76 if (input != null && input.getPathDescription() != null
77 && input.getPathDescription().getAToZDirection() != null) {
78 AToZDirection atoZDirection = input.getPathDescription().getAToZDirection();
79 olmSetupBldr.setWaveNumber(atoZDirection.getAToZWavelengthNumber());
80 if (atoZDirection.getAToZMinFrequency() != null) {
81 olmSetupBldr.setLowerSpectralSlotNumber(Uint32
83 .getLowerSpectralIndexFromFrequency(atoZDirection.getAToZMinFrequency().getValue())));
85 if (atoZDirection.getAToZMaxFrequency() != null) {
86 olmSetupBldr.setHigherSpectralSlotNumber(Uint32
88 .getHigherSpectralIndexFromFrequency(atoZDirection.getAToZMaxFrequency().getValue())));
91 return olmSetupBldr.build();
94 public static ServiceImplementationRequestOutput createServiceImplResponse(String responseCode, String message) {
95 return new ServiceImplementationRequestOutputBuilder()
96 .setConfigurationResponseCommon(createCommonResponse(responseCode, message))
100 public static ServiceDeleteOutput createServiceDeleteResponse(String responseCode, String message) {
101 return new ServiceDeleteOutputBuilder()
102 .setConfigurationResponseCommon(createCommonResponse(responseCode, message))
106 public static ConfigurationResponseCommon createCommonResponse(String responseCode, String message) {
107 return new ConfigurationResponseCommonBuilder()
108 .setResponseMessage(message)
109 .setResponseCode(responseCode)
113 public static ListenableFuture<RpcResult<ServiceImplementationRequestOutput>>
114 createServiceImplementationRpcResponse(ServiceImplementationRequestOutput payload) {
115 return RpcResultBuilder.success(payload).buildFuture();
118 public static ListenableFuture<RpcResult<ServiceDeleteOutput>>
119 createServiceDeleteRpcResponse(ServiceDeleteOutput payload) {
120 return RpcResultBuilder.success(payload).buildFuture();
123 public static ServicePathInputData rendererCreateServiceInputAToZ(String serviceName,
124 PathDescription pathDescription, Action operation) {
125 int scale = GridConstant.FIXED_GRID_FREQUENCY_PRECISION;
126 AToZDirection atoZDirection = pathDescription.getAToZDirection();
127 LOG.info("Building ServicePathInputData for a to z direction {}", atoZDirection);
128 NodeLists nodeLists = getNodesListAToZ(atoZDirection.nonnullAToZ().values().iterator());
129 ServicePathInputBuilder servicePathInputBuilder = new ServicePathInputBuilder()
130 .setServiceName(serviceName)
131 .setOperation(operation)
132 .setNodes(nodeLists.getRendererNodeList())
133 .setWidth(new FrequencyGHz(GridConstant.WIDTH_40));
134 if (atoZDirection.getAToZWavelengthNumber() != null) {
135 servicePathInputBuilder
136 .setWaveNumber(atoZDirection.getAToZWavelengthNumber());
138 if (Uint32.valueOf(GridConstant.IRRELEVANT_WAVELENGTH_NUMBER)
139 .equals(atoZDirection.getAToZWavelengthNumber())) {
140 scale = GridConstant.FLEX_GRID_FREQUENCY_PRECISION;
142 if (atoZDirection.getAToZMinFrequency() != null) {
143 servicePathInputBuilder.setMinFreq(new FrequencyTHz(atoZDirection.getAToZMinFrequency().getValue()));
144 servicePathInputBuilder.setLowerSpectralSlotNumber(Uint32
146 .getLowerSpectralIndexFromFrequency(atoZDirection.getAToZMinFrequency().getValue())));
148 if (atoZDirection.getAToZMaxFrequency() != null) {
149 servicePathInputBuilder.setMaxFreq(new FrequencyTHz(atoZDirection.getAToZMaxFrequency().getValue()));
150 servicePathInputBuilder.setHigherSpectralSlotNumber(
151 Uint32.valueOf(GridUtils
152 .getHigherSpectralIndexFromFrequency(atoZDirection.getAToZMaxFrequency().getValue())));
154 if (atoZDirection.getAToZMinFrequency() != null && atoZDirection.getAToZMaxFrequency() != null) {
155 servicePathInputBuilder.setCenterFreq(
156 GridUtils.getCentralFrequencyWithPrecision(atoZDirection.getAToZMinFrequency().getValue(),
157 atoZDirection.getAToZMaxFrequency().getValue(), scale));
159 if (atoZDirection.getRate() != null && atoZDirection.getModulationFormat() != null) {
160 Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
161 .forName(atoZDirection.getModulationFormat());
162 if (optionalModulationFormat.isPresent()
163 && GridConstant.FREQUENCY_WIDTH_TABLE
164 .contains(atoZDirection.getRate(), optionalModulationFormat.get())) {
165 servicePathInputBuilder
166 .setWidth(FrequencyGHz
167 .getDefaultInstance(GridConstant.FREQUENCY_WIDTH_TABLE.get(atoZDirection.getRate(),
168 optionalModulationFormat.get())));
171 servicePathInputBuilder.setModulationFormat(atoZDirection.getModulationFormat());
172 return new ServicePathInputData(servicePathInputBuilder.build(), nodeLists);
175 public static ServicePathInputData rendererCreateServiceInputZToA(String serviceName,
176 PathDescription pathDescription, Action operation) {
177 int scale = GridConstant.FIXED_GRID_FREQUENCY_PRECISION;
178 ZToADirection ztoADirection = pathDescription.getZToADirection();
179 LOG.info("Building ServicePathInputData for z to a direction {}", ztoADirection);
180 NodeLists nodeLists = getNodesListZtoA(pathDescription.getZToADirection().nonnullZToA().values().iterator());
181 ServicePathInputBuilder servicePathInputBuilder = new ServicePathInputBuilder()
182 .setOperation(operation)
183 .setServiceName(serviceName)
184 .setNodes(nodeLists.getRendererNodeList())
185 .setWidth(new FrequencyGHz(GridConstant.WIDTH_40));
186 if (ztoADirection.getZToAWavelengthNumber() != null) {
187 servicePathInputBuilder
188 .setWaveNumber(ztoADirection.getZToAWavelengthNumber());
190 if (Uint32.valueOf(GridConstant.IRRELEVANT_WAVELENGTH_NUMBER)
191 .equals(ztoADirection.getZToAWavelengthNumber())) {
192 scale = GridConstant.FLEX_GRID_FREQUENCY_PRECISION;
194 if (ztoADirection.getZToAMinFrequency() != null) {
195 servicePathInputBuilder.setMinFreq(new FrequencyTHz(ztoADirection.getZToAMinFrequency().getValue()));
196 servicePathInputBuilder.setLowerSpectralSlotNumber(Uint32
198 .getLowerSpectralIndexFromFrequency(ztoADirection.getZToAMinFrequency().getValue())));
200 if (ztoADirection.getZToAMaxFrequency() != null) {
201 servicePathInputBuilder.setMaxFreq(new FrequencyTHz(ztoADirection.getZToAMaxFrequency().getValue()));
202 servicePathInputBuilder.setHigherSpectralSlotNumber(
203 Uint32.valueOf(GridUtils
204 .getHigherSpectralIndexFromFrequency(ztoADirection.getZToAMaxFrequency().getValue())));
206 if (ztoADirection.getZToAMinFrequency() != null && ztoADirection.getZToAMaxFrequency() != null) {
207 servicePathInputBuilder.setCenterFreq(
208 GridUtils.getCentralFrequencyWithPrecision(ztoADirection.getZToAMinFrequency().getValue(),
209 ztoADirection.getZToAMaxFrequency().getValue(), scale));
211 if (ztoADirection.getRate() != null && ztoADirection.getModulationFormat() != null) {
212 Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
213 .forName(ztoADirection.getModulationFormat());
214 if (optionalModulationFormat.isPresent()
215 && GridConstant.FREQUENCY_WIDTH_TABLE
216 .contains(ztoADirection.getRate(), optionalModulationFormat.get())) {
217 servicePathInputBuilder.setWidth(FrequencyGHz
218 .getDefaultInstance(GridConstant.FREQUENCY_WIDTH_TABLE.get(ztoADirection.getRate(),
219 optionalModulationFormat.get())));
222 servicePathInputBuilder.setModulationFormat(ztoADirection.getModulationFormat());
223 return new ServicePathInputData(servicePathInputBuilder.build(), nodeLists);
226 // Adding createOtnServiceInputpath for A-Z and Z-A directions as one method
227 public static OtnServicePathInput rendererCreateOtnServiceInput(String serviceName, Action operation,
228 String serviceFormat, Uint32 serviceRate, PathDescription pathDescription, boolean asideToZside) {
229 // If atoZ is set true use A-to-Z direction otherwise use Z-to-A
230 List<org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.otn.renderer.nodes.Nodes> nodes =
232 NodeLists nodeLists =
234 ? getNodesListAToZ(pathDescription.getAToZDirection().nonnullAToZ().values().iterator())
235 : getNodesListZtoA(pathDescription.getZToADirection().nonnullZToA().values().iterator());
236 LOG.info("These are node-lists {}, {}", nodeLists.getRendererNodeList(), nodeLists.getOlmNodeList());
237 for (Nodes node: nodeLists.getRendererNodeList()) {
238 org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.otn.renderer.nodes.NodesBuilder nb
239 = new org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.otn.renderer.nodes
240 .NodesBuilder().setNodeId(node.getNodeId()).setNetworkTp(node.getDestTp());
241 if (node.getSrcTp() != null && node.getSrcTp().contains("NETWORK")) {
242 nb.setNetwork2Tp(node.getSrcTp());
244 nb.setClientTp(node.getSrcTp());
246 nodes.add(nb.build());
248 OtnServicePathInputBuilder otnServicePathInputBuilder = new OtnServicePathInputBuilder()
249 .setServiceName(serviceName)
250 .setOperation(operation)
251 .setServiceFormat(serviceFormat)
252 .setServiceRate(serviceRate)
254 .setAEndApiInfo(createAendApiInfo(pathDescription))
255 .setZEndApiInfo(createZendApiInfo(pathDescription));
257 // set the trib-slots and trib-ports for the lower oder odu
258 if (serviceRate.intValue() == 1 || (serviceRate.intValue() == 10)) {
259 Short tribPort = Short.valueOf(pathDescription.getAToZDirection().getMinTribSlot().getValue()
261 Short minTribSlot = Short.valueOf(pathDescription.getAToZDirection().getMinTribSlot().getValue()
263 otnServicePathInputBuilder
264 .setTribPortNumber(tribPort)
265 .setTribSlot(minTribSlot);
267 if (serviceRate.intValue() == 100) {
268 List<OpucnTribSlotDef> opucnTribSlotDefList = new ArrayList<>();
269 opucnTribSlotDefList.add(pathDescription.getAToZDirection().getMinTribSlot());
270 opucnTribSlotDefList.add(pathDescription.getAToZDirection().getMaxTribSlot());
271 otnServicePathInputBuilder.setOpucnTribSlots(opucnTribSlotDefList);
273 return otnServicePathInputBuilder.build();
276 public static ServicePathInput rendererDeleteServiceInput(String serviceName,
277 ServiceDeleteInput serviceDeleteInput) {
278 //TODO: finish model-model mapping
279 return new ServicePathInputBuilder().setServiceName(serviceName).build();
282 public static List<String> getLinksFromServicePathDescription(PathDescription pathDescription) {
283 List<String> linkidList = new ArrayList<>();
284 pathDescription.getAToZDirection().getAToZ().values().stream()
285 .filter(lk -> "Link".equals(lk.getResource().getResource().implementedInterface().getSimpleName()))
287 Link link = (Link) rsc.getResource().getResource();
288 linkidList.add(link.getLinkId());
290 pathDescription.getZToADirection().getZToA().values().stream()
291 .filter(lk -> "Link".equals(lk.getResource().getResource().implementedInterface().getSimpleName()))
293 Link link = (Link) rsc.getResource().getResource();
294 linkidList.add(link.getLinkId());
299 private static NodeLists getNodesListZtoA(Iterator<ZToA> iterator) {
300 Map<Integer, NodeIdPair> treeMap = new TreeMap<>();
301 List<Nodes> olmList = new ArrayList<>();
302 List<Nodes> list = new ArrayList<>();
304 while (iterator.hasNext()) {
305 ZToA pathDesObj = iterator.next();
307 populateTreeMap(treeMap, pathDesObj.getResource().getResource(), pathDesObj.getId(), "ZtoA");
308 } catch (IllegalArgumentException | SecurityException e) {
309 //TODO: Auto-generated catch block
310 LOG.error("Did not find the getResource method", e);
313 populateNodeLists(treeMap, list, olmList, false);
314 return new NodeLists(olmList, list);
317 private static NodeLists getNodesListAToZ(Iterator<AToZ> iterator) {
318 Map<Integer, NodeIdPair> treeMap = new TreeMap<>();
319 List<Nodes> list = new ArrayList<>();
320 List<Nodes> olmList = new ArrayList<>();
322 while (iterator.hasNext()) {
323 AToZ pathDesObj = iterator.next();
325 populateTreeMap(treeMap, pathDesObj.getResource().getResource(), pathDesObj.getId(), "AtoZ");
326 } catch (IllegalArgumentException | SecurityException e) {
327 //TODO: Auto-generated catch block
328 LOG.error("Did not find the getResource method", e);
331 populateNodeLists(treeMap, list, olmList, true);
332 return new NodeLists(olmList, list);
335 private static void populateTreeMap(Map<Integer, NodeIdPair> treeMap, Resource rsrc, String sortId,
337 String resourceType = rsrc.implementedInterface().getSimpleName();
338 LOG.info("Inside {} {}", direction, resourceType);
339 switch (resourceType) {
340 case TERMINATION_POINT:
341 TerminationPoint tp = (TerminationPoint) rsrc;
342 LOG.info(" TP is {} {}", tp.getTpId(), tp.getTpNodeId());
343 String tpID = tp.getTpId();
345 //TODO: do not rely on ID to be in certain format
346 if (tpID.contains("CTP") || tpID.contains("CP")) {
350 if (tpID.contains(StringConstants.TTP_TOKEN)) {
351 nodeID = tp.getTpNodeId().split("-DEG")[0];
352 } else if (tpID.contains(StringConstants.PP_TOKEN)) {
353 nodeID = tp.getTpNodeId().split("-SRG")[0];
354 } else if (tpID.contains(StringConstants.NETWORK_TOKEN)
355 || tpID.contains(StringConstants.CLIENT_TOKEN) || tpID.isEmpty()) {
356 nodeID = tp.getTpNodeId().split("-XPDR")[0];
360 int id = Integer.parseInt(sortId);
361 treeMap.put(id, new NodeIdPair(nodeID, tpID));
364 LOG.info("The type is link");
367 LOG.info("The type is not identified: {}", resourceType);
372 @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
373 value = {"NP_LOAD_OF_KNOWN_NULL_VALUE","RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"},
374 justification = "loop when value is not always null - "
375 + "TODO: check if something exists in Java lib")
376 private static void populateNodeLists(Map<Integer, NodeIdPair> treeMap, List<Nodes> list, List<Nodes> olmList,
380 LOG.info("treeMap values = {}", treeMap.values());
381 for (NodeIdPair values : treeMap.values()) {
383 srcID = values.getTpID();
384 } else if (desID == null) {
385 desID = values.getTpID();
386 NodesBuilder olmNb = new NodesBuilder()
387 .setNodeId(values.getNodeID())
390 olmList.add(olmNb.build());
391 if (srcID.isEmpty()) {
394 if (desID.isEmpty()) {
395 desID = new StringBuilder(srcID).toString();
399 NodesBuilder nb = new NodesBuilder()
400 .withKey(new NodesKey(values.getNodeID()))
403 if (srcID != null && desID != null && srcID.contains(StringConstants.NETWORK_TOKEN)) {
404 nb.setDestTp(srcID).setSrcTp(desID);
406 list.add(nb.build());
408 if (srcID != null && desID != null && !srcID.contains(StringConstants.NETWORK_TOKEN)
409 && !desID.contains(StringConstants.NETWORK_TOKEN)) {
410 NodesBuilder nb = new NodesBuilder()
411 .withKey(new NodesKey(values.getNodeID()))
414 list.add(nb.build());
420 LOG.warn("both, the source and destination id are not null!");
425 private static AEndApiInfo createAendApiInfo(PathDescription pathDescription) {
426 String anodeId = extractAendFromPathDescription(pathDescription).get("nodeId");
427 String sapi = PortMappingUtils.fnv1size64(
428 String.join("-", anodeId, extractAendFromPathDescription(pathDescription).get("tpid")));
429 String dapi = PortMappingUtils.fnv1size64(
430 String.join("-", extractZendFromPathDescription(pathDescription).get("nodeId"),
431 extractZendFromPathDescription(pathDescription).get("tpid")));
432 return new AEndApiInfoBuilder()
434 .setExpectedDapi(sapi)
436 .setExpectedSapi(dapi)
441 private static ZEndApiInfo createZendApiInfo(PathDescription pathDescription) {
442 String znodeId = extractZendFromPathDescription(pathDescription).get("nodeId");
443 String sapi = PortMappingUtils.fnv1size64(
444 String.join("-", znodeId, extractZendFromPathDescription(pathDescription).get("tpid")));
445 String dapi = PortMappingUtils.fnv1size64(
446 String.join("-", extractAendFromPathDescription(pathDescription).get("nodeId"),
447 extractAendFromPathDescription(pathDescription).get("tpid")));
448 return new ZEndApiInfoBuilder()
450 .setExpectedDapi(sapi)
452 .setExpectedSapi(dapi)
457 private static Map<String, String> extractAendFromPathDescription(PathDescription pathDescription) {
458 List<AToZ> tpList = pathDescription.getAToZDirection().getAToZ().values().stream()
459 .filter(az -> TERMINATION_POINT.equals(az.getResource().getResource().implementedInterface()
461 .collect(Collectors.toList());
462 for (AToZ atoZ : tpList) {
463 TerminationPoint tp = (TerminationPoint) atoZ.getResource().getResource();
464 if (!tp.getTpId().isEmpty() && !tp.getTpNodeId().isEmpty()) {
465 String nodeId = tp.getTpNodeId();
466 String lcp = tp.getTpId();
467 return Map.of("nodeId", nodeId, "tpid", lcp);
473 private static Map<String, String> extractZendFromPathDescription(PathDescription pathDescription) {
474 List<ZToA> tpList = pathDescription.getZToADirection().getZToA().values().stream()
475 .filter(az -> TERMINATION_POINT.equals(az.getResource().getResource().implementedInterface()
477 .collect(Collectors.toList());
478 for (ZToA ztoA : tpList) {
479 TerminationPoint tp = (TerminationPoint) ztoA.getResource().getResource();
480 if (!tp.getTpId().isEmpty() && !tp.getTpNodeId().isEmpty()) {
481 String nodeId = tp.getTpNodeId();
482 String lcp = tp.getTpId();
483 return Map.of("nodeId", nodeId, "tpid", lcp);