2 * Copyright © 2019 Orange, Inc. 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.tapi.topology;
10 import java.nio.charset.Charset;
11 import java.util.ArrayList;
12 import java.util.Arrays;
13 import java.util.Collection;
14 import java.util.Collections;
15 import java.util.HashMap;
16 import java.util.HashSet;
17 import java.util.Iterator;
18 import java.util.List;
20 import java.util.Map.Entry;
22 import java.util.UUID;
23 import java.util.stream.Collectors;
24 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
25 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
26 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
27 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPools;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Link1;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Node1;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
40 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
41 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
42 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
43 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LAYERPROTOCOLQUALIFIER;
44 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
45 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
46 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
47 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
48 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
49 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
50 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
51 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
52 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.TotalSizeBuilder;
53 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.AvailableCapacityBuilder;
54 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.TotalPotentialCapacityBuilder;
55 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
56 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder;
57 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
58 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
59 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
60 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
61 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
62 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
63 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
64 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
65 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePoint;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointBuilder;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointKey;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroupBuilder;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroupKey;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointBuilder;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePoint;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointBuilder;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointKey;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.RuleBuilder;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.RuleKey;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkBuilder;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey;
87 import org.opendaylight.yangtools.yang.common.Uint16;
88 import org.opendaylight.yangtools.yang.common.Uint64;
89 import org.slf4j.Logger;
90 import org.slf4j.LoggerFactory;
93 public class ConvertORTopoToTapiTopo {
95 private static final String DSR = "DSR";
96 private static final String OTSI = "OTSi";
97 private static final String E_OTSI = "eOTSi";
98 private static final String I_OTSI = "iOTSi";
99 private static final String RDM_INFRA = "ROADM-infra";
100 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopo.class);
101 private String ietfNodeId;
102 private OpenroadmNodeType ietfNodeType;
103 private AdminStates ietfNodeAdminState;
104 private State ietfNodeOperState;
105 private List<TerminationPoint> oorClientPortList;
106 private List<TerminationPoint> oorNetworkPortList;
107 private OduSwitchingPools oorOduSwitchingPool;
108 private Uuid tapiTopoUuid;
109 private Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
111 private Map<LinkKey, Link> tapiLinks;
112 private Map<String, Uuid> uuidMap;
115 public ConvertORTopoToTapiTopo(Uuid tapiTopoUuid) {
116 this.tapiTopoUuid = tapiTopoUuid;
117 this.tapiNodes = new HashMap<>();
118 this.tapiLinks = new HashMap<>();
119 this.uuidMap = new HashMap<>();
122 public void convertNode(Node ietfNode, List<String> networkPorts) {
123 this.ietfNodeId = ietfNode.getNodeId().getValue();
124 if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
128 this.ietfNodeType = ietfNode.augmentation(
129 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType();
130 this.ietfNodeAdminState = ietfNode.augmentation(
131 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
132 .getAdministrativeState();
133 this.ietfNodeOperState = ietfNode.augmentation(
134 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
135 .getOperationalState();
136 this.oorNetworkPortList = ietfNode.augmentation(
137 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
138 .getTerminationPoint().values().stream()
139 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
140 == OpenroadmTpType.XPONDERNETWORK.getIntValue()
141 && networkPorts.contains(tp.getTpId().getValue()))
142 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
143 .collect(Collectors.toList());
144 if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
145 this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
146 .values().stream().findFirst().get();
147 this.oorClientPortList = ietfNode.augmentation(
148 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
149 .getTerminationPoint().values().stream()
150 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
151 == OpenroadmTpType.XPONDERCLIENT.getIntValue())
152 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
153 .collect(Collectors.toList());
155 this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
156 List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
157 .flatMap(nbl -> nbl.getTpList().stream())
158 .collect(Collectors.toList());
159 this.oorClientPortList = ietfNode.augmentation(
160 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
161 .getTerminationPoint().values().stream()
162 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
163 == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
164 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
165 .collect(Collectors.toList());
166 this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
169 // node creation [DSR/ODU]
170 LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
171 Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, DSR))
172 .getBytes(Charset.forName("UTF-8"))).toString());
173 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR), nodeUuid);
174 Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(this.ietfNodeId).build();
175 List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU);
176 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
177 .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols);
178 tapiNodes.put(dsrNode.key(), dsrNode);
180 // node creation [otsi]
181 LOG.info("creation of an OTSi node for {}", this.ietfNodeId);
182 nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI))
183 .getBytes(Charset.forName("UTF-8"))).toString());
184 this.uuidMap.put(String.join("+", this.ietfNodeId, OTSI), nodeUuid);
185 Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue(this.ietfNodeId).build();
186 List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
187 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
188 .Node otsiNode = createTapiNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols);
189 tapiNodes.put(otsiNode.key(), otsiNode);
191 // transitional link cration between network nep of DSR/ODU node and iNep of otsi node
192 LOG.info("creation of transitional links between DSR/ODU and OTSi nodes");
193 createTapiTransitionalLinks();
196 public void convertLinks(Map<
197 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
199 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
201 List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
202 .Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
203 Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue()
204 .compareTo(l2.getLinkId().getValue()));
205 List<String> linksToNotConvert = new ArrayList<>();
206 LOG.info("creation of {} otn links", otnLinkMap.size() / 2);
207 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
208 .Link otnlink : otnLinkList) {
209 if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) {
210 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
211 .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
212 .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(
213 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
214 .getOppositeLink()));
215 Link tapiLink = createTapiLink(otnlink, oppositeLink);
216 linksToNotConvert.add(oppositeLink.getLinkId().getValue());
217 tapiLinks.put(tapiLink.key(), tapiLink);
222 public void convertRoadmInfrastructure() {
223 LOG.info("abstraction of the ROADM infrastructure towards a photonic node");
224 Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(RDM_INFRA.getBytes(Charset.forName("UTF-8"))).toString());
225 Name nodeName = new NameBuilder().setValueName("otsi node name").setValue(RDM_INFRA).build();
226 List<LayerProtocolName> nodeLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
228 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
229 = pruneTapiPhotonicNodes();
230 Map<String, String> photonicNepUuisMap = convertListNodeWithListNepToMapForUuidAndName(tapiPhotonicNodes);
231 // nep creation for rdm infra abstraction node
232 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = createNepForRdmNode(photonicNepUuisMap.size());
233 // node rule group creation
234 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList
235 = createNodeRuleGroupForRdmNode(nodeUuid, onepMap.values());
236 // build RDM infra node abstraction
237 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node rdmNode = new NodeBuilder()
239 .setName(Map.of(nodeName.key(), nodeName))
240 .setLayerProtocolName(nodeLayerProtocols)
241 .setAdministrativeState(AdministrativeState.UNLOCKED)
242 .setOperationalState(OperationalState.ENABLED)
243 .setLifecycleState(LifecycleState.INSTALLED)
244 .setOwnedNodeEdgePoint(onepMap)
245 .setNodeRuleGroup(nodeRuleGroupList)
247 tapiNodes.put(rdmNode.key(), rdmNode);
249 // OMS link creation between photonoci nodes and RDM infra abstraction node
250 Map<String, String> rdmInfraNepUuisMap = convertListNodeWithListNepToMapForUuidAndName(List.of(rdmNode));
251 if (photonicNepUuisMap.size() != rdmInfraNepUuisMap.size()) {
252 LOG.warn("Unable to build OMS links between photonics nodes and RDM infrasctructure abstraction");
254 createTapiOmsLinks(photonicNepUuisMap, rdmInfraNepUuisMap);
258 private OduSwitchingPools createOduSwitchingPoolForTp100G() {
259 Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
261 for (TerminationPoint tp : this.oorNetworkPortList) {
262 TpId tpid1 = tp.getTpId();
263 TpId tpid2 = new TpId(tp.augmentation(
264 org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1.class)
265 .getAssociatedConnectionMapPort());
266 List<TpId> tpList = new ArrayList<>();
269 NonBlockingList nbl = new NonBlockingListBuilder()
270 .setNblNumber(Uint16.valueOf(count))
273 nblMap.put(nbl.key(), nbl);
276 return new OduSwitchingPoolsBuilder()
277 .setNonBlockingList(nblMap)
278 .setSwitchingPoolNumber(Uint16.valueOf(1))
282 private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
283 pruneTapiPhotonicNodes() {
284 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
285 prunedTapiPhotonicNodes = new ArrayList<>();
286 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
287 = this.tapiNodes.values().stream()
288 .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().get(0)))
289 .collect(Collectors.toList());
290 for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node
291 : tapiPhotonicNodes) {
292 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepM = new HashMap<>();
293 for (Map.Entry<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> entry : node.getOwnedNodeEdgePoint().entrySet()) {
294 if (entry.getValue().getName().values().stream()
295 .filter(name -> name.getValueName().startsWith("eNodeEdgePoint")).count() > 0) {
296 onepM.put(entry.getKey(), entry.getValue());
299 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node prunedNode
300 = new NodeBuilder(node).setOwnedNodeEdgePoint(onepM).build();
301 prunedTapiPhotonicNodes.add(prunedNode);
303 return prunedTapiPhotonicNodes;
306 private Map<String, String> convertListNodeWithListNepToMapForUuidAndName(
307 List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> nodes) {
308 Map<String, String> uuidNameMap = new HashMap<>();
309 for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node : nodes) {
310 for (OwnedNodeEdgePoint nep : node.nonnullOwnedNodeEdgePoint().values()) {
311 String nodeUuid = node.getUuid().getValue();
312 String nepUuid = nep.getUuid().getValue();
313 String nodeName = node.getName().get(new NameKey("otsi node name")).getValue();
314 String nepName = nep.getName().get(new NameKey(nep.getName().keySet().stream().findFirst().get()))
316 uuidNameMap.put(String.join("--", nodeUuid, nepUuid), String.join("--", nodeName, nepName));
322 private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
323 createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
324 Uuid nodeUuid = null;
325 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
326 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
327 Map<RuleKey, Rule> ruleList = new HashMap<>();
328 Rule rule = new RuleBuilder()
329 .setLocalId("forward")
330 .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
331 .setRuleType(RuleType.FORWARDING)
333 ruleList.put(rule.key(), rule);
334 if (layerProtocols.contains(LayerProtocolName.DSR)) {
335 nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
336 } else if (layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
337 nodeUuid = getNodeUuid4Photonic(onepl, nodeRuleGroupList, ruleList);
339 LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
340 .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
342 return new NodeBuilder()
345 .setLayerProtocolName(layerProtocols)
346 .setAdministrativeState(setTapiAdminState(this.ietfNodeAdminState))
347 .setOperationalState(setTapiOperationalState(this.ietfNodeOperState))
348 .setLifecycleState(LifecycleState.INSTALLED)
349 .setOwnedNodeEdgePoint(onepl)
350 .setNodeRuleGroup(nodeRuleGroupList)
354 private AdministrativeState setTapiAdminState(AdminStates adminState) {
355 if (adminState == null) {
358 return adminState.equals(AdminStates.InService) ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
361 private AdministrativeState setTapiAdminState(AdminStates adminState1, AdminStates adminState2) {
362 if (adminState1 == null || adminState2 == null) {
365 if (AdminStates.InService.equals(adminState1) && AdminStates.InService.equals(adminState2)) {
366 return AdministrativeState.UNLOCKED;
368 return AdministrativeState.LOCKED;
372 private OperationalState setTapiOperationalState(State operState) {
373 if (operState == null) {
376 return operState.getName().equals("inService") ? OperationalState.ENABLED : OperationalState.DISABLED;
379 private OperationalState setTapiOperationalState(State operState1, State operState2) {
380 if (operState1 == null || operState2 == null) {
383 if (State.InService.equals(operState1) && State.InService.equals(operState2)) {
384 return OperationalState.ENABLED;
386 return OperationalState.DISABLED;
390 private Uuid getNodeUuid4Photonic(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
391 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
393 nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI));
394 // iNep creation on otsi node
395 for (int i = 0; i < oorNetworkPortList.size(); i++) {
396 Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
397 (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
398 .getBytes(Charset.forName("UTF-8")))
400 this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
402 Name onedName = new NameBuilder()
403 .setValueName("iNodeEdgePoint")
404 .setValue(oorNetworkPortList.get(i).getTpId().getValue())
407 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
408 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
409 String.join("+", this.ietfNodeId, I_OTSI));
410 onepl.put(onep.key(), onep);
412 // eNep creation on otsi node
413 for (int i = 0; i < oorNetworkPortList.size(); i++) {
414 Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
415 (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
416 .getBytes(Charset.forName("UTF-8")))
418 this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
420 Name onedName = new NameBuilder()
421 .setValueName("eNodeEdgePoint")
422 .setValue(oorNetworkPortList.get(i).getTpId().getValue())
425 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
426 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
427 String.join("+", this.ietfNodeId, E_OTSI));
428 onepl.put(onep.key(), onep);
430 // create NodeRuleGroup
432 for (TerminationPoint tp : this.oorNetworkPortList) {
433 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
434 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
435 nepList = new HashMap<>();
436 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
437 .NodeEdgePoint inep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
438 .node.rule.group.NodeEdgePointBuilder()
439 .setTopologyUuid(tapiTopoUuid)
440 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
441 .setNodeEdgePointUuid(
442 this.uuidMap.get(String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue())))
444 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
445 .NodeEdgePoint enep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
446 .node.rule.group.NodeEdgePointBuilder()
447 .setTopologyUuid(tapiTopoUuid)
448 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
449 .setNodeEdgePointUuid(
450 this.uuidMap.get(String.join("+", this.ietfNodeId, E_OTSI, tp.getTpId().getValue())))
452 nepList.put(inep.key(), inep);
453 nepList.put(enep.key(), enep);
454 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
456 UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
459 .setNodeEdgePoint(nepList)
461 nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
467 private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
468 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
470 nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR));
471 // client nep creation on DSR/ODU node
472 for (int i = 0; i < oorClientPortList.size(); i++) {
473 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
474 (String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()))
475 .getBytes(Charset.forName("UTF-8"))).toString());
476 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()),
478 NameBuilder nameBldr = new NameBuilder().setValue(oorClientPortList.get(i).getTpId().getValue());
480 if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
481 name = nameBldr.setValueName("100G-tpdr").build();
483 name = nameBldr.setValueName("NodeEdgePoint_C").build();
486 OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
487 LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
488 onepl.put(onep.key(), onep);
490 // network nep creation on DSR/ODU node
491 for (int i = 0; i < oorNetworkPortList.size(); i++) {
492 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
493 (String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()))
494 .getBytes(Charset.forName("UTF-8"))).toString());
495 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()),
497 Name onedName = new NameBuilder()
498 .setValueName("NodeEdgePoint_N")
499 .setValue(oorNetworkPortList.get(i).getTpId().getValue())
502 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
503 LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
504 onepl.put(onep.key(), onep);
506 // create NodeRuleGroup
508 for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
509 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
510 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
511 nepList = new HashMap<>();
512 for (TpId tp : nbl.getTpList()) {
513 if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) {
514 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
515 nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
516 .NodeEdgePointBuilder()
517 .setTopologyUuid(tapiTopoUuid)
518 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
519 .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR, tp.getValue())))
521 nepList.put(nep.key(), nep);
524 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
526 UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
529 .setNodeEdgePoint(nepList)
531 nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
537 private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
538 LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
539 String key = String.join("+", keyword, oorTp.getTpId().getValue());
540 OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
541 .setUuid(this.uuidMap.get(key))
542 .setLayerProtocolName(nepProtocol)
545 onepBldr.setMappedServiceInterfacePoint(createSIP(this.uuidMap.get(key), 1));
547 onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol))
548 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
549 .setLinkPortRole(PortRole.SYMMETRIC)
550 .setAdministrativeState(setTapiAdminState(
551 oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()))
552 .setOperationalState(setTapiOperationalState(
553 oorTp.augmentation(TerminationPoint1.class).getOperationalState()))
554 .setLifecycleState(LifecycleState.INSTALLED)
555 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
556 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
557 return onepBldr.build();
560 private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> createNepForRdmNode(int nbNep) {
561 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
562 for (int i = 1; i <= nbNep; i++) {
563 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "roadm node", "nep", String.valueOf(i)))
564 .getBytes(Charset.forName("UTF-8"))).toString());
565 Name nepName = new NameBuilder()
566 .setValueName("NodeEdgePoint name")
567 .setValue(new StringBuilder("NodeEdgePoint_").append(i).toString())
569 OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
571 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
572 .setName(Map.of(nepName.key(), nepName))
573 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
574 .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
575 .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
576 .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
577 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
579 onepMap.put(onep.key(), onep);
584 private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
585 Collection<OwnedNodeEdgePoint> onepl) {
586 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
587 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
588 nepMap = new HashMap<>();
589 for (OwnedNodeEdgePoint onep : onepl) {
590 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
591 nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
592 .NodeEdgePointBuilder()
593 .setTopologyUuid(tapiTopoUuid)
594 .setNodeUuid(nodeUuid)
595 .setNodeEdgePointUuid(onep.key().getUuid())
597 nepMap.put(nep.key(), nep);
599 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
600 Map<RuleKey, Rule> ruleList = new HashMap<>();
601 Rule rule = new RuleBuilder()
602 .setLocalId("forward")
603 .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
604 .setRuleType(RuleType.FORWARDING)
606 ruleList.put(rule.key(), rule);
607 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
608 .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group").getBytes(Charset.forName("UTF-8")))
611 .setNodeEdgePoint(nepMap)
613 nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
614 return nodeRuleGroupMap;
617 private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(Uuid nepUuid, int nb) {
618 Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
619 for (int i = 0; i < nb; i++) {
620 MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
621 .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes(nepUuid.getValue()
622 .getBytes(Charset.forName("UTF-8"))).toString()))
624 msipl.put(msip.key(), msip);
629 private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedCepLayerProtocolQualifier(TerminationPoint tp,
630 LayerProtocolName lpn) {
631 Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
632 List<SupportedInterfaceCapability> sicList = new ArrayList<>(
633 tp.augmentation(org.opendaylight.yang.gen.v1.http
634 .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class).getTpSupportedInterfaces()
635 .getSupportedInterfaceCapability().values());
636 for (SupportedInterfaceCapability sic : sicList) {
637 switch (lpn.getName()) {
639 switch (sic.getIfCapType().getSimpleName()) {
641 sclpqSet.add(ODUTYPEODU2E.class);
642 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
645 sclpqSet.add(ODUTYPEODU2.class);
646 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
649 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
652 sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
653 sclpqSet.add(ODUTYPEODU4.class);
656 sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
658 case "IfOCHOTU4ODU4":
660 sclpqSet.add(ODUTYPEODU4.class);
663 LOG.error("IfCapability type not managed");
667 case "PHOTONIC_MEDIA":
668 if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
669 || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
670 sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
671 sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
675 LOG.error("Layer Protocol Name is unknown");
679 return new ArrayList<>(sclpqSet);
682 private void createTapiTransitionalLinks() {
683 for (TerminationPoint tp : this.oorNetworkPortList) {
684 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
685 String sourceKey = String.join("+", this.ietfNodeId, DSR, tp.getTpId().getValue());
686 Uuid sourceUuidTp = this.uuidMap.get(sourceKey);
687 String destKey = String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue());
688 Uuid destUuidTp = this.uuidMap.get(destKey);
689 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
690 .setTopologyUuid(this.tapiTopoUuid)
691 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
692 .setNodeEdgePointUuid(sourceUuidTp)
694 nepList.put(sourceNep.key(), sourceNep);
695 NodeEdgePoint destNep = new NodeEdgePointBuilder()
696 .setTopologyUuid(this.tapiTopoUuid)
697 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
698 .setNodeEdgePointUuid(destUuidTp)
700 nepList.put(destNep.key(), destNep);
701 Name linkName = new NameBuilder().setValueName("transitional link name")
702 .setValue(String.join("--", this.ietfNodeId, sourceKey, destKey))
704 Link transiLink = new LinkBuilder()
706 UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey))
707 .getBytes(Charset.forName("UTF-8")))
709 .setName(Map.of(linkName.key(), linkName))
710 .setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(),
711 LayerProtocolName.PHOTONICMEDIA.getName()))
712 .setNodeEdgePoint(nepList)
713 .setDirection(ForwardingDirection.BIDIRECTIONAL)
714 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
715 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build()).build())
717 this.tapiLinks.put(transiLink.key(), transiLink);
721 private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
722 .ietf.network.topology.rev180226.networks.network.Link link,
723 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
724 .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
725 String prefix = link.getLinkId().getValue().split("-")[0];
726 String sourceNode = link.getSource().getSourceNode().getValue();
727 String sourceTp = link.getSource().getSourceTp().toString();
728 String destNode = link.getDestination().getDestNode().getValue();
729 String destTp = link.getDestination().getDestTp().toString();
730 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
736 AdminStates oppositeLinkAdminState = null;
737 State oppositeLinkOperState = null;
738 if (oppositeLink != null) {
739 oppositeLinkAdminState = oppositeLink.augmentation(
740 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
741 .getAdministrativeState();
742 oppositeLinkOperState = oppositeLink.augmentation(
743 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
744 .getOperationalState();
748 sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, I_OTSI, sourceTp));
749 sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, OTSI));
750 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
751 .setTopologyUuid(this.tapiTopoUuid)
752 .setNodeUuid(sourceUuidNode)
753 .setNodeEdgePointUuid(sourceUuidTp)
755 nepList.put(sourceNep.key(), sourceNep);
756 destUuidTp = this.uuidMap.get(String.join("+", destNode, I_OTSI, destTp));
757 destUuidNode = this.uuidMap.get(String.join("+", destNode, OTSI));
758 NodeEdgePoint destNep = new NodeEdgePointBuilder()
759 .setTopologyUuid(this.tapiTopoUuid)
760 .setNodeUuid(destUuidNode)
761 .setNodeEdgePointUuid(destUuidTp)
763 nepList.put(destNep.key(), destNep);
764 linkName = new NameBuilder().setValueName("otn link name")
765 .setValue(link.getLinkId().getValue())
767 return new LinkBuilder()
769 UUID.nameUUIDFromBytes((link.getLinkId().getValue())
770 .getBytes(Charset.forName("UTF-8")))
772 .setName(Map.of(linkName.key(), linkName))
773 .setLayerProtocolName(Arrays.asList(LayerProtocolName.PHOTONICMEDIA))
774 .setAdministrativeState(setTapiAdminState(link
775 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
776 .getAdministrativeState(), oppositeLinkAdminState))
777 .setOperationalState(setTapiOperationalState(link
778 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
779 .getOperationalState(), oppositeLinkOperState))
780 .setDirection(ForwardingDirection.BIDIRECTIONAL)
781 .setNodeEdgePoint(nepList)
782 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
783 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
784 .setValue(Uint64.valueOf(100)).build()).build())
785 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
786 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
787 .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
791 sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, DSR, sourceTp));
792 sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR));
793 NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder()
794 .setTopologyUuid(this.tapiTopoUuid)
795 .setNodeUuid(sourceUuidNode)
796 .setNodeEdgePointUuid(sourceUuidTp)
798 nepList.put(sourceNep2.key(), sourceNep2);
799 destUuidTp = this.uuidMap.get(String.join("+", destNode, DSR, destTp));
800 destUuidNode = this.uuidMap.get(String.join("+", destNode, DSR));
801 NodeEdgePoint destNep2 = new NodeEdgePointBuilder()
802 .setTopologyUuid(this.tapiTopoUuid)
803 .setNodeUuid(destUuidNode)
804 .setNodeEdgePointUuid(destUuidTp)
806 nepList.put(destNep2.key(), destNep2);
807 linkName = new NameBuilder().setValueName("otn link name")
808 .setValue(link.getLinkId().getValue())
810 return new LinkBuilder()
811 .setUuid(new Uuid(UUID.nameUUIDFromBytes((link.getLinkId().getValue())
812 .getBytes(Charset.forName("UTF-8")))
814 .setName(Map.of(linkName.key(), linkName))
815 .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU))
816 .setAdministrativeState(setTapiAdminState(link
817 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
818 .getAdministrativeState(), oppositeLinkAdminState))
819 .setOperationalState(setTapiOperationalState(link
820 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
821 .getOperationalState(), oppositeLinkOperState))
822 .setDirection(ForwardingDirection.BIDIRECTIONAL)
823 .setNodeEdgePoint(nepList)
824 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
825 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
826 .setValue(Uint64.valueOf(100)).build()).build())
827 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
828 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
829 .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
833 LOG.error("OTN link of type {} not managed yet", prefix);
838 private void createTapiOmsLinks(Map<String, String> photonicNepUuisMap, Map<String, String> rdmInfraNepUuisMap) {
839 Iterator<Entry<String, String>> it1 = photonicNepUuisMap.entrySet().iterator();
840 Iterator<Entry<String, String>> it2 = rdmInfraNepUuisMap.entrySet().iterator();
841 while (it1.hasNext()) {
842 Map<NodeEdgePointKey, NodeEdgePoint> nepMap = new HashMap<>();
843 Map.Entry<String, String> photonicEntry = it1.next();
844 Map.Entry<String, String> rdmEntry = it2.next();
845 Uuid sourceUuidTp = new Uuid(photonicEntry.getKey().split("--")[1]);
846 Uuid sourceUuidNode = new Uuid(photonicEntry.getKey().split("--")[0]);
847 Uuid destUuidTp = new Uuid(rdmEntry.getKey().split("--")[1]);
848 Uuid destUuidNode = new Uuid(rdmEntry.getKey().split("--")[0]);
849 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
850 .setTopologyUuid(this.tapiTopoUuid)
851 .setNodeUuid(sourceUuidNode)
852 .setNodeEdgePointUuid(sourceUuidTp)
854 nepMap.put(sourceNep.key(), sourceNep);
855 NodeEdgePoint destNep = new NodeEdgePointBuilder()
856 .setTopologyUuid(this.tapiTopoUuid)
857 .setNodeUuid(destUuidNode)
858 .setNodeEdgePointUuid(destUuidTp)
860 nepMap.put(destNep.key(), destNep);
861 Name linkName = new NameBuilder().setValueName("OMS link name")
862 .setValue(String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
864 Link omsLink = new LinkBuilder()
866 UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
867 .getBytes(Charset.forName("UTF-8")))
869 .setName(Map.of(linkName.key(), linkName))
870 .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
871 .setNodeEdgePoint(nepMap)
872 .setDirection(ForwardingDirection.BIDIRECTIONAL)
874 this.tapiLinks.put(omsLink.key(), omsLink);
878 public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
883 public Map<LinkKey, Link> getTapiLinks() {