2 * Copyright © 2021 Nokia. 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.List;
20 import java.util.UUID;
21 import java.util.stream.Collectors;
22 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
23 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
24 import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
25 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPools;
26 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
27 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
28 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapability;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Link1;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Node1;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
39 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState;
40 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit;
41 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection;
42 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LAYERPROTOCOLQUALIFIER;
43 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName;
44 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState;
45 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState;
46 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortDirection;
47 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.PortRole;
48 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection;
49 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState;
50 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid;
51 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.TotalSizeBuilder;
52 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.AvailableCapacityBuilder;
53 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.TotalPotentialCapacityBuilder;
54 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name;
55 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder;
56 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
57 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePoint;
58 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePointBuilder;
59 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePointKey;
60 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE;
61 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN;
62 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPEGigE;
63 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0;
64 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2;
65 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ProtectionType;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RestorationPolicy;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePoint;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointBuilder;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointKey;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.ResilienceTypeBuilder;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroupBuilder;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroupKey;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointBuilder;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePoint;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointBuilder;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointKey;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.RuleBuilder;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.RuleKey;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristic;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristicBuilder;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkBuilder;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.cost.pac.CostCharacteristic;
97 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.cost.pac.CostCharacteristicBuilder;
98 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristic;
99 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristicBuilder;
100 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.validation.pac.ValidationMechanism;
101 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.validation.pac.ValidationMechanismBuilder;
102 import org.opendaylight.yangtools.yang.common.Uint16;
103 import org.opendaylight.yangtools.yang.common.Uint64;
104 import org.slf4j.Logger;
105 import org.slf4j.LoggerFactory;
108 public class ConvertORTopoToTapiFullTopo {
110 private static final String DSR = "DSR";
111 private static final String I_ODU = "iODU";
112 private static final String E_ODU = "eODU";
113 private static final String OTSI = "OTSi";
114 private static final String E_OTSI = "eOTSi";
115 private static final String I_OTSI = "iOTSi";
116 private static final String PHTNC_MEDIA = "PHOTONIC_MEDIA";
117 private static final String MC = "MEDIA_CHANNEL";
118 private static final String OTSI_MC = "OTSi_MEDIA_CHANNEL";
119 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiFullTopo.class);
120 private String ietfNodeId;
121 private OpenroadmNodeType ietfNodeType;
122 private AdminStates ietfNodeAdminState;
123 private State ietfNodeOperState;
124 private List<TerminationPoint> oorClientPortList;
125 private List<TerminationPoint> oorNetworkPortList;
126 private OduSwitchingPools oorOduSwitchingPool;
127 private Uuid tapiTopoUuid;
128 private Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
130 private Map<LinkKey, Link> tapiLinks;
131 private Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSips;
132 private Map<String, Uuid> uuidMap;
135 public ConvertORTopoToTapiFullTopo(Uuid tapiTopoUuid) {
136 this.tapiTopoUuid = tapiTopoUuid;
137 this.tapiNodes = new HashMap<>();
138 this.tapiLinks = new HashMap<>();
139 this.uuidMap = new HashMap<>();
140 this.tapiSips = new HashMap<>();
143 public void convertNode(Node ietfNode, List<String> networkPorts) {
144 this.ietfNodeId = ietfNode.getNodeId().getValue();
145 if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
149 this.ietfNodeType = ietfNode.augmentation(
150 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType();
151 this.ietfNodeAdminState = ietfNode.augmentation(
152 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
153 .getAdministrativeState();
154 this.ietfNodeOperState = ietfNode.augmentation(
155 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
156 .getOperationalState();
157 this.oorNetworkPortList = ietfNode.augmentation(
158 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
159 .getTerminationPoint().values().stream()
160 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
161 == OpenroadmTpType.XPONDERNETWORK.getIntValue()
162 && networkPorts.contains(tp.getTpId().getValue()))
163 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
164 .collect(Collectors.toList());
165 if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
166 this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
167 .values().stream().findFirst().get();
168 this.oorClientPortList = ietfNode.augmentation(
169 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
170 .getTerminationPoint().values().stream()
171 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
172 == OpenroadmTpType.XPONDERCLIENT.getIntValue())
173 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
174 .collect(Collectors.toList());
176 this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
177 List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
178 .flatMap(nbl -> nbl.getTpList().stream())
179 .collect(Collectors.toList());
180 this.oorClientPortList = ietfNode.augmentation(
181 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
182 .getTerminationPoint().values().stream()
183 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
184 == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
185 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
186 .collect(Collectors.toList());
187 this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
190 // node creation [DSR/ODU]
191 LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
192 Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, DSR))
193 .getBytes(Charset.forName("UTF-8"))).toString());
194 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR), nodeUuid);
195 Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(
196 String.join("+", this.ietfNodeId, DSR)).build();
197 List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU);
198 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
199 .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols);
200 LOG.info("DSR Node {} should have {} NEPs and {} SIPs", this.ietfNodeId,
201 this.oorClientPortList.size() + 2 * this.oorNetworkPortList.size(),
202 this.oorClientPortList.size() + this.oorNetworkPortList.size());
203 LOG.info("DSR Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
204 dsrNode.getOwnedNodeEdgePoint().values().size(), dsrNode.getOwnedNodeEdgePoint().values().stream()
205 .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
206 tapiNodes.put(dsrNode.key(), dsrNode);
208 // node creation [otsi]
209 LOG.info("creation of an OTSi node for {}", this.ietfNodeId);
210 nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI))
211 .getBytes(Charset.forName("UTF-8"))).toString());
212 this.uuidMap.put(String.join("+", this.ietfNodeId, OTSI), nodeUuid);
213 Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue(
214 String.join("+", this.ietfNodeId, OTSI)).build();
215 List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
216 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
217 .Node otsiNode = createTapiNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols);
218 LOG.info("OTSi Node {} should have {} NEPs and {} SIPs", this.ietfNodeId, 3 * this.oorNetworkPortList.size(),
219 this.oorNetworkPortList.size());
220 LOG.info("OTSi Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
221 otsiNode.getOwnedNodeEdgePoint().values().size(), otsiNode.getOwnedNodeEdgePoint().values().stream()
222 .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
223 tapiNodes.put(otsiNode.key(), otsiNode);
225 // transitional link cration between network nep of DSR/ODU node and iNep of otsi node
226 LOG.info("creation of transitional links between DSR/ODU and OTSi nodes");
227 createTapiTransitionalLinks();
230 public void convertLinks(
231 Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
232 .ietf.network.topology.rev180226.networks.network.LinkKey,
233 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
234 .ietf.network.topology.rev180226.networks.network.Link> otnLinkMap) {
235 List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
236 .Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
237 Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue()
238 .compareTo(l2.getLinkId().getValue()));
239 List<String> linksToNotConvert = new ArrayList<>();
240 LOG.info("creation of {} otn links", otnLinkMap.size() / 2);
241 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
242 .Link otnlink : otnLinkList) {
243 if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) {
244 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
245 .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
246 .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(
247 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
248 .getOppositeLink()));
249 Link tapiLink = createTapiLink(otnlink, oppositeLink);
250 linksToNotConvert.add(oppositeLink.getLinkId().getValue());
251 tapiLinks.put(tapiLink.key(), tapiLink);
256 public void convertRdmToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
257 .ietf.network.topology.rev180226.networks.network.Link> rdmTordmLinkList) {
258 List<String> linksToNotConvert = new ArrayList<>();
259 LOG.info("creation of {} roadm to roadm links", rdmTordmLinkList.size() / 2);
260 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
261 .Link link : rdmTordmLinkList) {
262 if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
263 Link tapiLink = createTapiOmsLink(link, rdmTordmLinkList.stream()
264 .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
265 .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink()))
266 .findAny().orElse(null));
267 linksToNotConvert.add(link
268 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
269 .getOppositeLink().getValue());
270 tapiLinks.put(tapiLink.key(), tapiLink);
275 public void convertRoadmNode(Node roadm, Network openroadmTopo) {
276 this.ietfNodeId = roadm.getNodeId().getValue();
277 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist = new HashMap<>();
278 // 1. Get degree and srg nodes to map TPs into NEPs
279 if (openroadmTopo.getNode() == null) {
280 LOG.warn("Openroadm-topology is null.");
285 List<Node> nodeList = new ArrayList<Node>(openroadmTopo.getNode().values());
286 for (Node node:nodeList) {
287 if (node.getSupportingNode().values().stream().noneMatch(sp -> sp.getNodeRef().getValue()
288 .equals(this.ietfNodeId))) {
289 LOG.warn("Abstracted node {} is not part of {}",
290 node.getNodeId().getValue(), this.ietfNodeId);
293 if (node.augmentation(Node1.class) == null
294 && node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
295 .ietf.network.topology.rev180226.Node1.class) == null) {
296 LOG.warn("Abstracted node {} doesnt have type of node or is not disaggregated",
297 node.getNodeId().getValue());
300 OpenroadmNodeType nodeType = node.augmentation(org.opendaylight.yang.gen.v1.http
301 .org.openroadm.common.network.rev200529.Node1.class).getNodeType();
302 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1 node1 =
303 node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
304 .ietf.network.topology.rev180226.Node1.class);
305 LOG.info("TPs of node: {}", node1.getTerminationPoint().values());
306 switch (nodeType.getIntValue()) {
308 LOG.info("Degree node");
309 // Get only external TPs of the degree
310 List<TerminationPoint> degPortList = node1.getTerminationPoint().values().stream()
311 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
312 == OpenroadmTpType.DEGREETXRXTTP.getIntValue()
313 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
314 == OpenroadmTpType.DEGREERXTTP.getIntValue()
315 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
316 == OpenroadmTpType.DEGREETXTTP.getIntValue())
317 .collect(Collectors.toList());
318 // Convert TP List in NEPs and put it in onepl
319 LOG.info("Degree port List: {}", degPortList);
320 // TODO: deg port could be sip. e.g. MDONS
321 oneplist.putAll(populateNepsForRdmNode(degPortList, false));
322 // oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), degPortList, false));
323 numNeps += degPortList.size() * 3;
326 LOG.info("SRG node");
327 // Get only external TPs of the srg
328 List<TerminationPoint> srgPortList = node1.getTerminationPoint().values().stream()
329 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
330 == OpenroadmTpType.SRGTXRXPP.getIntValue()
331 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
332 == OpenroadmTpType.SRGRXPP.getIntValue()
333 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
334 == OpenroadmTpType.SRGTXPP.getIntValue())
335 .collect(Collectors.toList());
336 // Convert TP List in NEPs and put it in onepl
337 LOG.info("Srg port List: {}", srgPortList);
338 oneplist.putAll(populateNepsForRdmNode(srgPortList, true));
339 // oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), srgPortList, true));
340 numNeps += srgPortList.size() * 3;
341 numSips += srgPortList.size();
344 LOG.error("Node {} tyoe not supported", nodeType.getName());
349 LOG.info("Creation of PHOTONIC node for {}", roadm.getNodeId().getValue());
350 Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", roadm.getNodeId().getValue(),
351 PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
353 Name nodeNames = new NameBuilder().setValueName("roadm node name")
354 .setValue(String.join("+", roadm.getNodeId().getValue(), PHTNC_MEDIA)).build();
356 List<LayerProtocolName> layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
358 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
359 .Node roadmNode = createRoadmTapiNode(nodeUuid, nodeNames, layerProtocols, oneplist);
360 // TODO add states corresponding to device config
361 LOG.info("ROADM node {} should have {} NEPs and {} SIPs", roadm.getNodeId().getValue(), numNeps, numSips);
362 LOG.info("ROADM node {} has {} NEPs and {} SIPs", roadm.getNodeId().getValue(),
363 roadmNode.getOwnedNodeEdgePoint().values().size(),
364 roadmNode.getOwnedNodeEdgePoint().values().stream()
365 .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
367 tapiNodes.put(roadmNode.key(), roadmNode);
370 private OduSwitchingPools createOduSwitchingPoolForTp100G() {
371 Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
373 for (TerminationPoint tp : this.oorNetworkPortList) {
374 TpId tpid1 = tp.getTpId();
375 TpId tpid2 = new TpId(tp.augmentation(
376 org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1.class)
377 .getAssociatedConnectionMapPort());
378 List<TpId> tpList = new ArrayList<>();
381 NonBlockingList nbl = new NonBlockingListBuilder()
382 .setNblNumber(Uint16.valueOf(count))
385 nblMap.put(nbl.key(), nbl);
388 return new OduSwitchingPoolsBuilder()
389 .setNonBlockingList(nblMap)
390 .setSwitchingPoolNumber(Uint16.valueOf(1))
394 private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
395 createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
396 Uuid nodeUuid = null;
397 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
398 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
399 Map<RuleKey, Rule> ruleList = new HashMap<>();
400 Rule rule = new RuleBuilder()
401 .setLocalId("forward")
402 .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
403 .setRuleType(RuleType.FORWARDING)
405 ruleList.put(rule.key(), rule);
406 if (layerProtocols.contains(LayerProtocolName.DSR)) {
407 nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
408 } else if (layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
409 nodeUuid = getNodeUuid4Photonic(onepl, nodeRuleGroupList, ruleList);
411 LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
412 .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
414 // Empty random creation of mandatory fields for avoiding errors....
415 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
416 .setCostAlgorithm("Restricted Shortest Path - RSP")
417 .setCostName("HOP_COUNT")
418 .setCostValue("12345678")
420 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
421 .setFixedLatencyCharacteristic("12345678")
422 .setQueingLatencyCharacteristic("12345678")
423 .setJitterCharacteristic("12345678")
424 .setWanderCharacteristic("12345678")
425 .setTrafficPropertyName("FIXED_LATENCY")
427 return new NodeBuilder()
430 .setLayerProtocolName(layerProtocols)
431 .setAdministrativeState(setTapiAdminState(this.ietfNodeAdminState))
432 .setOperationalState(setTapiOperationalState(this.ietfNodeOperState))
433 .setLifecycleState(LifecycleState.INSTALLED)
434 .setOwnedNodeEdgePoint(onepl)
435 .setNodeRuleGroup(nodeRuleGroupList)
436 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
437 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
438 .setErrorCharacteristic("error")
439 .setLossCharacteristic("loss")
440 .setRepeatDeliveryCharacteristic("repeat delivery")
441 .setDeliveryOrderCharacteristic("delivery order")
442 .setUnavailableTimeCharacteristic("unavailable time")
443 .setServerIntegrityProcessCharacteristic("server integrity process")
447 private AdministrativeState setTapiAdminState(AdminStates adminState) {
448 if (adminState == null) {
451 return adminState.equals(AdminStates.InService)
452 ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
455 private AdministrativeState setTapiAdminState(AdminStates adminState1, AdminStates adminState2) {
456 if (adminState1 == null || adminState2 == null) {
459 LOG.info("Admin state 1 = {}, andmin state 2 = {}", adminState1.getName(), adminState2.getName());
460 if (AdminStates.InService.equals(adminState1) && AdminStates.InService.equals(adminState2)) {
461 return AdministrativeState.UNLOCKED;
463 return AdministrativeState.LOCKED;
467 private OperationalState setTapiOperationalState(State operState) {
468 if (operState == null) {
471 return operState.getName().equals("inService") ? OperationalState.ENABLED : OperationalState.DISABLED;
474 private OperationalState setTapiOperationalState(State operState1, State operState2) {
475 if (operState1 == null || operState2 == null) {
478 LOG.info("Oper state 1 = {}, Oper state 2 = {}", operState1.getName(), operState2.getName());
479 if (State.InService.equals(operState1) && State.InService.equals(operState2)) {
480 return OperationalState.ENABLED;
482 return OperationalState.DISABLED;
486 private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
487 createRoadmTapiNode(Uuid nodeUuid, Name nodeNames, List<LayerProtocolName> layerProtocols,
488 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
489 // Empty random creation of mandatory fields for avoiding errors....
490 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
491 .setCostAlgorithm("Restricted Shortest Path - RSP")
492 .setCostName("HOP_COUNT")
493 .setCostValue("12345678")
495 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
496 .setFixedLatencyCharacteristic("12345678")
497 .setQueingLatencyCharacteristic("12345678")
498 .setJitterCharacteristic("12345678")
499 .setWanderCharacteristic("12345678")
500 .setTrafficPropertyName("FIXED_LATENCY")
502 return new NodeBuilder()
504 .setName(Map.of(nodeNames.key(), nodeNames))
505 .setLayerProtocolName(layerProtocols)
506 .setAdministrativeState(AdministrativeState.UNLOCKED)
507 .setOperationalState(OperationalState.ENABLED)
508 .setLifecycleState(LifecycleState.INSTALLED)
509 .setOwnedNodeEdgePoint(oneplist)
510 .setNodeRuleGroup(createNodeRuleGroupForRdmNode(nodeUuid, oneplist.values()))
511 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
512 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
513 .setErrorCharacteristic("error")
514 .setLossCharacteristic("loss")
515 .setRepeatDeliveryCharacteristic("repeat delivery")
516 .setDeliveryOrderCharacteristic("delivery order")
517 .setUnavailableTimeCharacteristic("unavailable time")
518 .setServerIntegrityProcessCharacteristic("server integrity process")
522 private Uuid getNodeUuid4Photonic(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
523 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList,
524 Map<RuleKey, Rule> ruleList) {
526 nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI));
527 // iNep creation on otsi node
528 for (int i = 0; i < oorNetworkPortList.size(); i++) {
529 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, I_OTSI,
530 oorNetworkPortList.get(i).getTpId().getValue()));
531 Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
532 (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
533 .getBytes(Charset.forName("UTF-8")))
535 this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI,
536 oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
537 Name onedName = new NameBuilder()
538 .setValueName("iNodeEdgePoint")
539 .setValue(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
542 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
543 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
544 String.join("+", this.ietfNodeId, I_OTSI));
545 onepl.put(onep.key(), onep);
547 // eNep creation on otsi node
548 for (int i = 0; i < oorNetworkPortList.size(); i++) {
549 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, E_OTSI,
550 oorNetworkPortList.get(i).getTpId().getValue()));
551 Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
552 (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
553 .getBytes(Charset.forName("UTF-8")))
555 this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI,
556 oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
557 Name onedName = new NameBuilder()
558 .setValueName("eNodeEdgePoint")
559 .setValue(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
562 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
563 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, false,
564 String.join("+", this.ietfNodeId, E_OTSI));
565 onepl.put(onep.key(), onep);
567 // Photonic Media Nep creation on otsi node
568 for (int i = 0; i < oorNetworkPortList.size(); i++) {
569 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, PHTNC_MEDIA,
570 oorNetworkPortList.get(i).getTpId().getValue()));
571 Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(
572 (String.join("+", this.ietfNodeId, PHTNC_MEDIA,
573 oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
575 this.uuidMap.put(String.join("+", this.ietfNodeId, PHTNC_MEDIA,
576 oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
577 Name onedName = new NameBuilder()
578 .setValueName("PhotMedNodeEdgePoint")
579 .setValue(String.join("+", this.ietfNodeId, PHTNC_MEDIA,
580 oorNetworkPortList.get(i).getTpId().getValue()))
583 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
584 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, false,
585 String.join("+", this.ietfNodeId, PHTNC_MEDIA));
586 onepl.put(onep.key(), onep);
588 // create NodeRuleGroup
590 LOG.info("OTSi switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
591 for (TerminationPoint tp : this.oorNetworkPortList) {
592 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
593 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
594 nepList = new HashMap<>();
595 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
596 .NodeEdgePoint inep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
597 .node.rule.group.NodeEdgePointBuilder()
598 .setTopologyUuid(tapiTopoUuid)
599 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
600 .setNodeEdgePointUuid(
601 this.uuidMap.get(String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue())))
603 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
604 .NodeEdgePoint enep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
605 .node.rule.group.NodeEdgePointBuilder()
606 .setTopologyUuid(tapiTopoUuid)
607 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
608 .setNodeEdgePointUuid(
609 this.uuidMap.get(String.join("+", this.ietfNodeId, E_OTSI, tp.getTpId().getValue())))
611 nepList.put(inep.key(), inep);
612 nepList.put(enep.key(), enep);
613 // Empty random creation of mandatory fields for avoiding errors....
614 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
615 .setCostAlgorithm("Restricted Shortest Path - RSP")
616 .setCostName("HOP_COUNT")
617 .setCostValue("12345678")
619 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
620 .setFixedLatencyCharacteristic("12345678")
621 .setQueingLatencyCharacteristic("12345678")
622 .setJitterCharacteristic("12345678")
623 .setWanderCharacteristic("12345678")
624 .setTrafficPropertyName("FIXED_LATENCY")
626 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
627 .setRiskCharacteristicName("risk characteristic")
628 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
630 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
632 UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
635 .setNodeEdgePoint(nepList)
636 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
637 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
638 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
640 nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
646 private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
647 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
649 nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR));
650 // client nep creation on DSR node
651 for (int i = 0; i < oorClientPortList.size(); i++) {
652 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, DSR,
653 oorClientPortList.get(i).getTpId().getValue()));
654 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
655 (String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()))
656 .getBytes(Charset.forName("UTF-8"))).toString());
657 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()),
659 NameBuilder nameBldr = new NameBuilder().setValue(
660 String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()));
662 if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
663 name = nameBldr.setValueName("100G-tpdr").build();
665 name = nameBldr.setValueName("NodeEdgePoint_C").build();
668 OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
669 LayerProtocolName.DSR, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
670 onepl.put(onep.key(), onep);
672 // network nep creation on I_ODU node
673 for (int i = 0; i < oorNetworkPortList.size(); i++) {
674 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, I_ODU,
675 oorNetworkPortList.get(i).getTpId().getValue()));
676 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
677 (String.join("+", this.ietfNodeId, I_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
678 .getBytes(Charset.forName("UTF-8"))).toString());
679 this.uuidMap.put(String.join("+", this.ietfNodeId, I_ODU, oorNetworkPortList.get(i).getTpId().getValue()),
681 Name onedName = new NameBuilder()
682 .setValueName("iNodeEdgePoint_N")
683 .setValue(String.join("+", this.ietfNodeId, I_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
686 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
687 LayerProtocolName.ODU, LayerProtocolName.DSR, false, String.join("+", this.ietfNodeId, I_ODU));
688 onepl.put(onep.key(), onep);
690 // network nep creation on E_ODU node
691 for (int i = 0; i < oorNetworkPortList.size(); i++) {
692 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, E_ODU,
693 oorNetworkPortList.get(i).getTpId().getValue()));
694 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
695 (String.join("+", this.ietfNodeId, E_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
696 .getBytes(Charset.forName("UTF-8"))).toString());
697 this.uuidMap.put(String.join("+", this.ietfNodeId, E_ODU, oorNetworkPortList.get(i).getTpId().getValue()),
699 Name onedName = new NameBuilder()
700 .setValueName("eNodeEdgePoint_N")
701 .setValue(String.join("+", this.ietfNodeId, E_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
704 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
705 LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, E_ODU));
706 onepl.put(onep.key(), onep);
708 // create NodeRuleGroup
710 LOG.info("ODU switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
711 for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
712 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
713 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
714 nepList = new HashMap<>();
715 LOG.info("UUidMap={}", this.uuidMap.keySet());
716 LOG.info("TP list = {}", nbl.getTpList());
717 for (TpId tp : nbl.getTpList()) {
718 LOG.info("TP={}", tp.getValue());
719 LOG.info("UuidKey={}", String.join("+", this.ietfNodeId, E_ODU, tp.getValue()));
720 if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, E_ODU, tp.getValue()))
721 || this.uuidMap.containsKey(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) {
722 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
723 nep = new org.opendaylight.yang.gen.v1.urn
724 .onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointBuilder()
725 .setTopologyUuid(tapiTopoUuid)
726 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
727 .setNodeEdgePointUuid((tp.getValue().contains("CLIENT")) ? this.uuidMap.get(String.join(
728 "+", this.ietfNodeId, DSR, tp.getValue())) : this.uuidMap.get(String.join(
729 "+", this.ietfNodeId, E_ODU, tp.getValue())))
731 nepList.put(nep.key(), nep);
734 // Empty random creation of mandatory fields for avoiding errors....
735 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
736 .setCostAlgorithm("Restricted Shortest Path - RSP")
737 .setCostName("HOP_COUNT")
738 .setCostValue("12345678")
740 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
741 .setFixedLatencyCharacteristic("12345678")
742 .setQueingLatencyCharacteristic("12345678")
743 .setJitterCharacteristic("12345678")
744 .setWanderCharacteristic("12345678")
745 .setTrafficPropertyName("FIXED_LATENCY")
747 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
748 .setRiskCharacteristicName("risk characteristic")
749 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
751 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
752 .setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count)
753 .getBytes(Charset.forName("UTF-8"))).toString()))
755 .setNodeEdgePoint(nepList)
756 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
757 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
758 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
760 nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
766 private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
767 LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
769 String key = String.join("+", keyword, oorTp.getTpId().getValue());
770 OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
771 .setUuid(this.uuidMap.get(key))
772 .setLayerProtocolName(nepProtocol)
775 onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, oorTp, keyword));
777 onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedLayerProtocolQualifier(oorTp, nodeProtocol))
778 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
779 .setLinkPortRole(PortRole.SYMMETRIC)
780 .setAdministrativeState(setTapiAdminState(
781 oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()))
782 .setOperationalState(setTapiOperationalState(
783 oorTp.augmentation(TerminationPoint1.class).getOperationalState()))
784 .setLifecycleState(LifecycleState.INSTALLED)
785 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
786 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
787 return onepBldr.build();
790 private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(List<TerminationPoint> tpList,
792 // create neps for MC and OTSiMC and Photonic Media
793 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
794 for (TerminationPoint tp:tpList) {
795 // Admin and oper state common for all tps
796 AdminStates admin = tp.augmentation(TerminationPoint1.class).getAdministrativeState();
797 State oper = tp.augmentation(TerminationPoint1.class).getOperationalState();
798 // PHOTONIC MEDIA nep
799 LOG.info("PHOTO NEP = {}", String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()));
800 Name nepName = new NameBuilder()
801 .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
802 .setValue(String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()))
805 OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
806 .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, PHTNC_MEDIA,
807 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
808 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
809 .setName(Map.of(nepName.key(), nepName))
810 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
811 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
812 .setLinkPortRole(PortRole.SYMMETRIC)
813 .setAdministrativeState(setTapiAdminState(admin))
814 .setOperationalState(setTapiOperationalState(oper))
815 .setLifecycleState(LifecycleState.INSTALLED)
816 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
817 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
819 onepMap.put(onep.key(), onep);
822 LOG.info("MC NEP = {}", String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()));
823 Name nepName1 = new NameBuilder()
824 .setValueName(MC + "NodeEdgePoint")
825 .setValue(String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()))
827 OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
828 .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, MC,
829 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
830 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
831 .setName(Map.of(nepName1.key(), nepName1))
832 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
833 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
834 .setLinkPortRole(PortRole.SYMMETRIC)
835 .setAdministrativeState(setTapiAdminState(admin))
836 .setOperationalState(setTapiOperationalState(oper))
837 .setLifecycleState(LifecycleState.INSTALLED)
838 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
839 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
841 onepBldr1.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
842 tp, String.join("+", this.ietfNodeId, MC)));
844 OwnedNodeEdgePoint onep1 = onepBldr1.build();
845 onepMap.put(onep1.key(), onep1);
848 LOG.info("OTSi NEP = {}", String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()));
849 Name nepName2 = new NameBuilder()
850 .setValueName(OTSI_MC + "NodeEdgePoint")
851 .setValue(String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()))
854 OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
855 .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI_MC,
856 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
857 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
858 .setName(Map.of(nepName2.key(), nepName2))
859 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
860 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
861 .setLinkPortRole(PortRole.SYMMETRIC)
862 .setAdministrativeState(setTapiAdminState(admin))
863 .setOperationalState(setTapiOperationalState(oper))
864 .setLifecycleState(LifecycleState.INSTALLED)
865 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
866 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
868 onepMap.put(onep2.key(), onep2);
873 private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
874 Collection<OwnedNodeEdgePoint> onepl) {
875 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
876 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
877 nepMap = new HashMap<>();
878 for (OwnedNodeEdgePoint onep : onepl) {
879 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
880 nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
881 .NodeEdgePointBuilder()
882 .setTopologyUuid(tapiTopoUuid)
883 .setNodeUuid(nodeUuid)
884 .setNodeEdgePointUuid(onep.key().getUuid())
886 nepMap.put(nep.key(), nep);
888 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
889 Map<RuleKey, Rule> ruleList = new HashMap<>();
890 Rule rule = new RuleBuilder()
891 .setLocalId("forward")
892 .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
893 .setRuleType(RuleType.FORWARDING)
895 ruleList.put(rule.key(), rule);
896 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
897 .setUuid(new Uuid(UUID.nameUUIDFromBytes((this.ietfNodeId + " node rule group")
898 .getBytes(Charset.forName("UTF-8"))).toString()))
900 .setNodeEdgePoint(nepMap)
902 nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
903 return nodeRuleGroupMap;
906 private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
907 LayerProtocolName layerProtocol,
910 // add them to SIP context
911 Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
912 for (int i = 0; i < nb; i++) {
913 LOG.info("SIP = {}", String.join("+", "SIP", nodeid, tp.getTpId().getValue()));
914 Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid,
915 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
916 MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
917 .setServiceInterfacePointUuid(sipUuid).build();
918 ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tp, nodeid);
919 this.tapiSips.put(sip.key(), sip);
920 msipl.put(msip.key(), msip);
925 private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, TerminationPoint tp,
927 // TODO: what value should be set in total capacity and available capacity??
928 // LOG.info("SIP name = {}", String.join("+", nodeid, tp.getTpId().getValue()));
929 Name sipName = new NameBuilder()
930 .setValueName("SIP name")
931 .setValue(String.join("+", nodeid, tp.getTpId().getValue()))
933 return new ServiceInterfacePointBuilder()
935 .setName(Map.of(sipName.key(), sipName))
936 .setLayerProtocolName(layerProtocol)
937 .setAdministrativeState(setTapiAdminState(
938 tp.augmentation(TerminationPoint1.class).getAdministrativeState()))
939 .setOperationalState(setTapiOperationalState(
940 tp.augmentation(TerminationPoint1.class).getOperationalState()))
941 .setLifecycleState(LifecycleState.INSTALLED)
942 .setAvailableCapacity(new AvailableCapacityBuilder().build())
943 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
944 .setSupportedLayerProtocolQualifier(createSupportedLayerProtocolQualifier(tp, layerProtocol))
948 private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(TerminationPoint tp,
949 LayerProtocolName lpn) {
950 Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
951 List<SupportedInterfaceCapability> sicList;
952 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.TerminationPoint1 tp1 =
953 tp.augmentation(org.opendaylight.yang.gen.v1.http
954 .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class);
956 return new ArrayList<>(sclpqSet);
958 if (tp1.getTpSupportedInterfaces() == null) {
959 LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue());
960 return new ArrayList<>(sclpqSet);
962 sicList = new ArrayList<>(tp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values());
963 for (SupportedInterfaceCapability sic : sicList) {
964 switch (lpn.getName()) {
967 switch (sic.getIfCapType().getSimpleName()) {
968 // TODO: it may be needed to add more cases clauses if the interface capabilities of a
969 // port are extended in the config file
971 sclpqSet.add(ODUTYPEODU0.class);
972 sclpqSet.add(DIGITALSIGNALTYPEGigE.class);
975 sclpqSet.add(ODUTYPEODU2E.class);
976 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
979 sclpqSet.add(ODUTYPEODU2.class);
980 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
983 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
986 sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
987 sclpqSet.add(ODUTYPEODU4.class);
990 sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
992 case "IfOCHOTU4ODU4":
994 sclpqSet.add(ODUTYPEODU4.class);
997 LOG.error("IfCapability type not managed");
1001 case "PHOTONIC_MEDIA":
1002 if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
1003 || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
1004 sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
1005 sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
1009 LOG.error("Layer Protocol Name is unknown");
1013 return new ArrayList<>(sclpqSet);
1016 private void createTapiTransitionalLinks() {
1017 for (TerminationPoint tp : this.oorNetworkPortList) {
1018 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1019 String sourceKey = String.join("+", this.ietfNodeId, I_ODU, tp.getTpId().getValue());
1020 Uuid sourceUuidTp = this.uuidMap.get(sourceKey);
1021 String destKey = String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue());
1022 Uuid destUuidTp = this.uuidMap.get(destKey);
1023 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1024 .setTopologyUuid(this.tapiTopoUuid)
1025 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
1026 .setNodeEdgePointUuid(sourceUuidTp)
1028 nepList.put(sourceNep.key(), sourceNep);
1029 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1030 .setTopologyUuid(this.tapiTopoUuid)
1031 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
1032 .setNodeEdgePointUuid(destUuidTp)
1034 nepList.put(destNep.key(), destNep);
1035 Name linkName = new NameBuilder().setValueName("transitional link name")
1036 .setValue(String.join("--", this.ietfNodeId, sourceKey, destKey))
1038 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1039 .setCostAlgorithm("Restricted Shortest Path - RSP")
1040 .setCostName("HOP_COUNT")
1041 .setCostValue("12345678")
1043 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1044 .setFixedLatencyCharacteristic("12345678")
1045 .setQueingLatencyCharacteristic("12345678")
1046 .setJitterCharacteristic("12345678")
1047 .setWanderCharacteristic("12345678")
1048 .setTrafficPropertyName("FIXED_LATENCY")
1050 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1051 .setRiskCharacteristicName("risk characteristic")
1052 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1054 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1055 .setValidationMechanism("validation mechanism")
1056 .setValidationRobustness("validation robustness")
1057 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1059 Link transiLink = new LinkBuilder()
1061 UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey))
1062 .getBytes(Charset.forName("UTF-8")))
1064 .setName(Map.of(linkName.key(), linkName))
1065 .setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(),
1066 LayerProtocolName.PHOTONICMEDIA.getName()))
1067 .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA))
1068 .setNodeEdgePoint(nepList)
1069 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1070 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1071 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build())
1073 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1074 .setRestorationPolicy(RestorationPolicy.NA)
1076 .setAdministrativeState(AdministrativeState.UNLOCKED)
1077 .setOperationalState(OperationalState.ENABLED)
1078 .setLifecycleState(LifecycleState.INSTALLED)
1079 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1080 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build())
1082 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1083 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1084 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1085 .setErrorCharacteristic("error")
1086 .setLossCharacteristic("loss")
1087 .setRepeatDeliveryCharacteristic("repeat delivery")
1088 .setDeliveryOrderCharacteristic("delivery order")
1089 .setUnavailableTimeCharacteristic("unavailable time")
1090 .setServerIntegrityProcessCharacteristic("server integrity process")
1091 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1093 this.tapiLinks.put(transiLink.key(), transiLink);
1097 private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1098 .ietf.network.topology.rev180226.networks.network.Link link,
1099 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1100 .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
1101 String prefix = link.getLinkId().getValue().split("-")[0];
1102 String sourceNode = link.getSource().getSourceNode().getValue();
1103 String sourceTp = link.getSource().getSourceTp().getValue();
1104 String destNode = link.getDestination().getDestNode().getValue();
1105 String destTp = link.getDestination().getDestTp().getValue();
1106 LOG.info("prefix = {}, sourceNode = {}, sourceTp = {}, destNode = {}, destTp = {}",
1107 prefix, sourceNode, sourceTp, destNode, destTp);
1108 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1110 Uuid sourceUuidNode;
1114 AdminStates oppositeLinkAdminState = null;
1115 State oppositeLinkOperState = null;
1116 if (oppositeLink != null) {
1117 oppositeLinkAdminState = oppositeLink.augmentation(
1118 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1119 .getAdministrativeState();
1120 oppositeLinkOperState = oppositeLink.augmentation(
1121 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1122 .getOperationalState();
1124 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1125 .setCostAlgorithm("Restricted Shortest Path - RSP")
1126 .setCostName("HOP_COUNT")
1127 .setCostValue("12345678")
1129 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1130 .setFixedLatencyCharacteristic("12345678")
1131 .setQueingLatencyCharacteristic("12345678")
1132 .setJitterCharacteristic("12345678")
1133 .setWanderCharacteristic("12345678")
1134 .setTrafficPropertyName("FIXED_LATENCY")
1136 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1137 .setRiskCharacteristicName("risk characteristic")
1138 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1140 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1141 .setValidationMechanism("validation mechanism")
1142 .setValidationRobustness("validation robustness")
1143 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1147 sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, I_OTSI, sourceTp));
1148 sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, OTSI));
1149 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1150 .setTopologyUuid(this.tapiTopoUuid)
1151 .setNodeUuid(sourceUuidNode)
1152 .setNodeEdgePointUuid(sourceUuidTp)
1154 nepList.put(sourceNep.key(), sourceNep);
1155 destUuidTp = this.uuidMap.get(String.join("+", destNode, I_OTSI, destTp));
1156 destUuidNode = this.uuidMap.get(String.join("+", destNode, OTSI));
1157 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1158 .setTopologyUuid(this.tapiTopoUuid)
1159 .setNodeUuid(destUuidNode)
1160 .setNodeEdgePointUuid(destUuidTp)
1162 nepList.put(destNep.key(), destNep);
1163 linkName = new NameBuilder().setValueName("otn link name")
1164 .setValue(link.getLinkId().getValue())
1166 return new LinkBuilder()
1167 .setUuid(new Uuid(UUID.nameUUIDFromBytes((link.getLinkId().getValue())
1168 .getBytes(Charset.forName("UTF-8"))).toString()))
1169 .setName(Map.of(linkName.key(), linkName))
1170 .setLayerProtocolName(Arrays.asList(LayerProtocolName.PHOTONICMEDIA))
1171 .setTransitionedLayerProtocolName(new ArrayList<>())
1172 .setAdministrativeState(setTapiAdminState(link
1174 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1175 .getAdministrativeState(), oppositeLinkAdminState))
1176 .setOperationalState(setTapiOperationalState(link
1178 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1179 .getOperationalState(), oppositeLinkOperState))
1180 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1181 .setNodeEdgePoint(nepList)
1182 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1183 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1184 .setValue(Uint64.valueOf(100)).build()).build())
1185 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1186 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1187 .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
1189 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1190 .setRestorationPolicy(RestorationPolicy.NA)
1192 .setLifecycleState(LifecycleState.INSTALLED)
1193 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1194 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1195 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1196 .setErrorCharacteristic("error")
1197 .setLossCharacteristic("loss")
1198 .setRepeatDeliveryCharacteristic("repeat delivery")
1199 .setDeliveryOrderCharacteristic("delivery order")
1200 .setUnavailableTimeCharacteristic("unavailable time")
1201 .setServerIntegrityProcessCharacteristic("server integrity process")
1202 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1205 sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, E_ODU, sourceTp));
1206 sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR));
1207 NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder()
1208 .setTopologyUuid(this.tapiTopoUuid)
1209 .setNodeUuid(sourceUuidNode)
1210 .setNodeEdgePointUuid(sourceUuidTp)
1212 nepList.put(sourceNep2.key(), sourceNep2);
1213 destUuidTp = this.uuidMap.get(String.join("+", destNode, E_ODU, destTp));
1214 destUuidNode = this.uuidMap.get(String.join("+", destNode, DSR));
1215 NodeEdgePoint destNep2 = new NodeEdgePointBuilder()
1216 .setTopologyUuid(this.tapiTopoUuid)
1217 .setNodeUuid(destUuidNode)
1218 .setNodeEdgePointUuid(destUuidTp)
1220 nepList.put(destNep2.key(), destNep2);
1221 linkName = new NameBuilder().setValueName("otn link name")
1222 .setValue(link.getLinkId().getValue())
1224 return new LinkBuilder()
1225 .setUuid(new Uuid(UUID.nameUUIDFromBytes((link.getLinkId().getValue())
1226 .getBytes(Charset.forName("UTF-8"))).toString()))
1227 .setName(Map.of(linkName.key(), linkName))
1228 .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU))
1229 .setTransitionedLayerProtocolName(new ArrayList<>())
1230 .setAdministrativeState(setTapiAdminState(link
1232 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1233 .getAdministrativeState(), oppositeLinkAdminState))
1234 .setOperationalState(setTapiOperationalState(link
1236 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1237 .getOperationalState(), oppositeLinkOperState))
1238 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1239 .setNodeEdgePoint(nepList)
1240 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1241 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1242 .setValue(Uint64.valueOf(100)).build()).build())
1243 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1244 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1245 .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
1247 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1248 .setRestorationPolicy(RestorationPolicy.NA)
1250 .setLifecycleState(LifecycleState.INSTALLED)
1251 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1252 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1253 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1254 .setErrorCharacteristic("error")
1255 .setLossCharacteristic("loss")
1256 .setRepeatDeliveryCharacteristic("repeat delivery")
1257 .setDeliveryOrderCharacteristic("delivery order")
1258 .setUnavailableTimeCharacteristic("unavailable time")
1259 .setServerIntegrityProcessCharacteristic("server integrity process")
1260 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1263 LOG.error("OTN link of type {} not managed yet", prefix);
1268 private Link createTapiOmsLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1269 .ietf.network.topology.rev180226.networks.network.Link link,
1270 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1271 .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
1272 String sourceNode = getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue());
1273 String sourceTp = link.getSource().getSourceTp().getValue();
1274 String destNode = getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue());
1275 String destTp = link.getDestination().getDestTp().getValue();
1276 AdminStates oppositeLinkAdminState = null;
1277 State oppositeLinkOperState = null;
1278 if (oppositeLink != null) {
1279 oppositeLinkAdminState = oppositeLink.augmentation(
1280 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1281 .getAdministrativeState();
1282 oppositeLinkOperState = oppositeLink.augmentation(
1283 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1284 .getOperationalState();
1286 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1287 Uuid sourceUuidNode = new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode,
1288 PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
1289 Uuid sourceUuidTp = new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode, PHTNC_MEDIA, sourceTp))
1290 .getBytes(Charset.forName("UTF-8"))).toString());
1291 Uuid destUuidNode = new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode,
1292 PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
1293 Uuid destUuidTp = new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode, PHTNC_MEDIA, destTp))
1294 .getBytes(Charset.forName("UTF-8"))).toString());
1295 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1296 .setTopologyUuid(this.tapiTopoUuid)
1297 .setNodeUuid(sourceUuidNode)
1298 .setNodeEdgePointUuid(sourceUuidTp)
1300 nepList.put(sourceNep.key(), sourceNep);
1301 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1302 .setTopologyUuid(this.tapiTopoUuid)
1303 .setNodeUuid(destUuidNode)
1304 .setNodeEdgePointUuid(destUuidTp)
1306 nepList.put(destNep.key(), destNep);
1307 Name linkName = new NameBuilder().setValueName("OMS link name")
1308 .setValue(link.getLinkId().getValue())
1310 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1311 .setCostAlgorithm("Restricted Shortest Path - RSP")
1312 .setCostName("HOP_COUNT")
1313 .setCostValue("12345678")
1315 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1316 .setFixedLatencyCharacteristic("12345678")
1317 .setQueingLatencyCharacteristic("12345678")
1318 .setJitterCharacteristic("12345678")
1319 .setWanderCharacteristic("12345678")
1320 .setTrafficPropertyName("FIXED_LATENCY")
1322 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1323 .setRiskCharacteristicName("risk characteristic")
1324 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1326 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1327 .setValidationMechanism("validation mechanism")
1328 .setValidationRobustness("validation robustness")
1329 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1331 return new LinkBuilder()
1333 UUID.nameUUIDFromBytes((link.getLinkId().getValue()).getBytes(Charset.forName("UTF-8")))
1335 .setName(Map.of(linkName.key(), linkName))
1336 .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
1337 .setTransitionedLayerProtocolName(new ArrayList<>())
1338 .setNodeEdgePoint(nepList)
1339 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1340 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1341 .setRestorationPolicy(RestorationPolicy.NA)
1343 .setAdministrativeState(setTapiAdminState(link
1345 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1346 .getAdministrativeState(), oppositeLinkAdminState))
1347 .setOperationalState(setTapiOperationalState(link
1349 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1350 .getOperationalState(), oppositeLinkOperState))
1351 .setLifecycleState(LifecycleState.INSTALLED)
1352 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1353 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1354 .setValue(Uint64.valueOf(100)).build()).build())
1355 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1356 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1357 .setValue(Uint64.valueOf(100)).build())
1359 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1360 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1361 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1362 .setErrorCharacteristic("error")
1363 .setLossCharacteristic("loss")
1364 .setRepeatDeliveryCharacteristic("repeat delivery")
1365 .setDeliveryOrderCharacteristic("delivery order")
1366 .setUnavailableTimeCharacteristic("unavailable time")
1367 .setServerIntegrityProcessCharacteristic("server integrity process")
1368 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1372 public void convertXpdrToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1373 .ietf.network.topology.rev180226.networks.network.Link> xpdrRdmLinkList) {
1374 List<String> linksToNotConvert = new ArrayList<>();
1375 LOG.info("creation of {} xpdr to roadm links", xpdrRdmLinkList.size() / 2);
1376 // LOG.info("Link list = {}", xpdrRdmLinkList.toString());
1377 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1378 .ietf.network.topology.rev180226.networks.network.Link link:xpdrRdmLinkList) {
1379 if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
1380 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1381 .ietf.network.topology.rev180226.networks.network.Link oppositeLink = xpdrRdmLinkList.stream()
1382 .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
1383 .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink())).findAny().orElse(null);
1385 AdminStates oppositeLinkAdminState = null;
1386 State oppositeLinkOperState = null;
1387 if (oppositeLink != null) {
1388 oppositeLinkAdminState = oppositeLink.augmentation(
1389 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1390 .getAdministrativeState();
1391 oppositeLinkOperState = oppositeLink.augmentation(
1392 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1393 .getOperationalState();
1396 String sourceNode = (link.getSource().getSourceNode().getValue().contains("ROADM"))
1397 ? getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue())
1398 : link.getSource().getSourceNode().getValue();
1399 String sourceTp = link.getSource().getSourceTp().getValue();
1400 String destNode = (link.getDestination().getDestNode().getValue().contains("ROADM"))
1401 ? getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue())
1402 : link.getDestination().getDestNode().getValue();
1403 String destTp = link.getDestination().getDestTp().getValue();
1404 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1405 Uuid sourceUuidNode = (sourceNode.contains("ROADM")) ? new Uuid(UUID.nameUUIDFromBytes((
1406 String.join("+", sourceNode, PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString())
1407 : new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode, OTSI))
1408 .getBytes(Charset.forName("UTF-8"))).toString());
1409 Uuid sourceUuidTp = new Uuid(UUID.nameUUIDFromBytes(
1410 (String.join("+", sourceNode, PHTNC_MEDIA, sourceTp))
1411 .getBytes(Charset.forName("UTF-8"))).toString());
1412 Uuid destUuidNode = (destNode.contains("ROADM")) ? new Uuid(UUID.nameUUIDFromBytes((
1413 String.join("+", destNode, PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString())
1414 : new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode, OTSI))
1415 .getBytes(Charset.forName("UTF-8"))).toString());
1416 Uuid destUuidTp = new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode,
1417 PHTNC_MEDIA, destTp)).getBytes(Charset.forName("UTF-8"))).toString());
1418 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1419 .setTopologyUuid(this.tapiTopoUuid)
1420 .setNodeUuid(sourceUuidNode)
1421 .setNodeEdgePointUuid(sourceUuidTp)
1423 nepList.put(sourceNep.key(), sourceNep);
1424 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1425 .setTopologyUuid(this.tapiTopoUuid)
1426 .setNodeUuid(destUuidNode)
1427 .setNodeEdgePointUuid(destUuidTp)
1429 nepList.put(destNep.key(), destNep);
1430 Name linkName = new NameBuilder().setValueName("XPDR-RDM link name")
1431 .setValue(link.getLinkId().getValue())
1433 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1434 .setCostAlgorithm("Restricted Shortest Path - RSP")
1435 .setCostName("HOP_COUNT")
1436 .setCostValue("12345678")
1438 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1439 .setFixedLatencyCharacteristic("12345678")
1440 .setQueingLatencyCharacteristic("12345678")
1441 .setJitterCharacteristic("12345678")
1442 .setWanderCharacteristic("12345678")
1443 .setTrafficPropertyName("FIXED_LATENCY")
1445 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1446 .setRiskCharacteristicName("risk characteristic")
1447 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1449 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1450 .setValidationMechanism("validation mechanism")
1451 .setValidationRobustness("validation robustness")
1452 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1454 Link tapiLink = new LinkBuilder()
1456 UUID.nameUUIDFromBytes((link.getLinkId().getValue()).getBytes(Charset.forName("UTF-8")))
1458 .setName(Map.of(linkName.key(), linkName))
1459 .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
1460 .setTransitionedLayerProtocolName(new ArrayList<>())
1461 .setNodeEdgePoint(nepList)
1462 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1463 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1464 .setRestorationPolicy(RestorationPolicy.NA)
1466 .setAdministrativeState(setTapiAdminState(link
1468 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1469 .getAdministrativeState(), oppositeLinkAdminState))
1470 .setOperationalState(setTapiOperationalState(link
1472 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1473 .getOperationalState(), oppositeLinkOperState))
1474 .setLifecycleState(LifecycleState.INSTALLED)
1475 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1476 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1477 .setValue(Uint64.valueOf(100)).build()).build())
1478 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1479 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1480 .setValue(Uint64.valueOf(100)).build())
1482 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1483 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1484 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1485 .setErrorCharacteristic("error")
1486 .setLossCharacteristic("loss")
1487 .setRepeatDeliveryCharacteristic("repeat delivery")
1488 .setDeliveryOrderCharacteristic("delivery order")
1489 .setUnavailableTimeCharacteristic("unavailable time")
1490 .setServerIntegrityProcessCharacteristic("server integrity process")
1491 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1493 linksToNotConvert.add(link
1494 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1495 .getOppositeLink().getValue());
1496 this.tapiLinks.put(tapiLink.key(), tapiLink);
1501 private String getIdBasedOnModelVersion(String linknodeid) {
1502 if (linknodeid.matches("[A-Z]{5}-[A-Z0-9]{2}-.*")) {
1503 LOG.info("OpenROADM version > 1.2.1 {}", linknodeid);
1504 return String.join("-", linknodeid.split("-")[0], linknodeid.split("-")[1]);
1506 LOG.info("OpenROADM version <= 1.2.1 {}", linknodeid);
1507 return linknodeid.split("-")[0];
1511 public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
1516 public Map<LinkKey, Link> getTapiLinks() {
1520 public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getTapiSips() {