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.odu.rev181210.ODUTYPEODU2;
63 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
64 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
65 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
66 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi;
67 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule;
68 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ProtectionType;
69 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RestorationPolicy;
70 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType;
71 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePoint;
72 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointBuilder;
73 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.NodeEdgePointKey;
74 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.link.ResilienceTypeBuilder;
75 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup;
76 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroupBuilder;
77 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroupKey;
78 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint;
79 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointBuilder;
80 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey;
81 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePoint;
82 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointBuilder;
83 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.edge.point.MappedServiceInterfacePointKey;
84 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.Rule;
85 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.RuleBuilder;
86 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.RuleKey;
87 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristic;
88 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristicBuilder;
89 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link;
90 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkBuilder;
91 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey;
92 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder;
93 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey;
94 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.cost.pac.CostCharacteristic;
95 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.cost.pac.CostCharacteristicBuilder;
96 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristic;
97 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristicBuilder;
98 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.validation.pac.ValidationMechanism;
99 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.validation.pac.ValidationMechanismBuilder;
100 import org.opendaylight.yangtools.yang.common.Uint16;
101 import org.opendaylight.yangtools.yang.common.Uint64;
102 import org.slf4j.Logger;
103 import org.slf4j.LoggerFactory;
106 public class ConvertORTopoToTapiFullTopo {
108 private static final String DSR = "DSR";
109 private static final String I_ODU = "iODU";
110 private static final String E_ODU = "eODU";
111 private static final String OTSI = "OTSi";
112 private static final String E_OTSI = "eOTSi";
113 private static final String I_OTSI = "iOTSi";
114 private static final String PHTNC_MEDIA = "PHOTONIC_MEDIA";
115 private static final String MC = "MEDIA_CHANNEL";
116 private static final String OTSI_MC = "OTSi_MEDIA_CHANNEL";
117 private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiFullTopo.class);
118 private String ietfNodeId;
119 private OpenroadmNodeType ietfNodeType;
120 private AdminStates ietfNodeAdminState;
121 private State ietfNodeOperState;
122 private List<TerminationPoint> oorClientPortList;
123 private List<TerminationPoint> oorNetworkPortList;
124 private OduSwitchingPools oorOduSwitchingPool;
125 private Uuid tapiTopoUuid;
126 private Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
128 private Map<LinkKey, Link> tapiLinks;
129 private Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSips;
130 private Map<String, Uuid> uuidMap;
133 public ConvertORTopoToTapiFullTopo(Uuid tapiTopoUuid) {
134 this.tapiTopoUuid = tapiTopoUuid;
135 this.tapiNodes = new HashMap<>();
136 this.tapiLinks = new HashMap<>();
137 this.uuidMap = new HashMap<>();
138 this.tapiSips = new HashMap<>();
141 public void convertNode(Node ietfNode, List<String> networkPorts) {
142 this.ietfNodeId = ietfNode.getNodeId().getValue();
143 if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
147 this.ietfNodeType = ietfNode.augmentation(
148 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType();
149 this.ietfNodeAdminState = ietfNode.augmentation(
150 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
151 .getAdministrativeState();
152 this.ietfNodeOperState = ietfNode.augmentation(
153 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
154 .getOperationalState();
155 this.oorNetworkPortList = ietfNode.augmentation(
156 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
157 .getTerminationPoint().values().stream()
158 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
159 == OpenroadmTpType.XPONDERNETWORK.getIntValue()
160 && networkPorts.contains(tp.getTpId().getValue()))
161 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
162 .collect(Collectors.toList());
163 if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
164 this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools()
165 .values().stream().findFirst().get();
166 this.oorClientPortList = ietfNode.augmentation(
167 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
168 .getTerminationPoint().values().stream()
169 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
170 == OpenroadmTpType.XPONDERCLIENT.getIntValue())
171 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
172 .collect(Collectors.toList());
174 this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
175 List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
176 .flatMap(nbl -> nbl.getTpList().stream())
177 .collect(Collectors.toList());
178 this.oorClientPortList = ietfNode.augmentation(
179 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
180 .getTerminationPoint().values().stream()
181 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
182 == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId()))
183 .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
184 .collect(Collectors.toList());
185 this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId()));
188 // node creation [DSR/ODU]
189 LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId);
190 Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, DSR))
191 .getBytes(Charset.forName("UTF-8"))).toString());
192 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR), nodeUuid);
193 Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(
194 String.join("+", this.ietfNodeId, DSR)).build();
195 List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU);
196 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
197 .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols);
198 LOG.info("DSR Node {} should have {} NEPs and {} SIPs", this.ietfNodeId,
199 this.oorClientPortList.size() + 2 * this.oorNetworkPortList.size(),
200 this.oorClientPortList.size() + this.oorNetworkPortList.size());
201 LOG.info("DSR Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
202 dsrNode.getOwnedNodeEdgePoint().values().size(), dsrNode.getOwnedNodeEdgePoint().values().stream()
203 .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
204 tapiNodes.put(dsrNode.key(), dsrNode);
206 // node creation [otsi]
207 LOG.info("creation of an OTSi node for {}", this.ietfNodeId);
208 nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI))
209 .getBytes(Charset.forName("UTF-8"))).toString());
210 this.uuidMap.put(String.join("+", this.ietfNodeId, OTSI), nodeUuid);
211 Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue(
212 String.join("+", this.ietfNodeId, OTSI)).build();
213 List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
214 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
215 .Node otsiNode = createTapiNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols);
216 LOG.info("OTSi Node {} should have {} NEPs and {} SIPs", this.ietfNodeId, 3 * this.oorNetworkPortList.size(),
217 this.oorNetworkPortList.size());
218 LOG.info("OTSi Node {} has {} NEPs and {} SIPs", this.ietfNodeId,
219 otsiNode.getOwnedNodeEdgePoint().values().size(), otsiNode.getOwnedNodeEdgePoint().values().stream()
220 .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
221 tapiNodes.put(otsiNode.key(), otsiNode);
223 // transitional link cration between network nep of DSR/ODU node and iNep of otsi node
224 LOG.info("creation of transitional links between DSR/ODU and OTSi nodes");
225 createTapiTransitionalLinks();
228 public void convertLinks(
229 Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
230 .ietf.network.topology.rev180226.networks.network.LinkKey,
231 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
232 .ietf.network.topology.rev180226.networks.network.Link> otnLinkMap) {
233 List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
234 .Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
235 Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue()
236 .compareTo(l2.getLinkId().getValue()));
237 List<String> linksToNotConvert = new ArrayList<>();
238 LOG.info("creation of {} otn links", otnLinkMap.size() / 2);
239 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
240 .Link otnlink : otnLinkList) {
241 if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) {
242 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
243 .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
244 .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(
245 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
246 .getOppositeLink()));
247 Link tapiLink = createTapiLink(otnlink, oppositeLink);
248 linksToNotConvert.add(oppositeLink.getLinkId().getValue());
249 tapiLinks.put(tapiLink.key(), tapiLink);
254 public void convertRdmToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
255 .ietf.network.topology.rev180226.networks.network.Link> rdmTordmLinkList) {
256 List<String> linksToNotConvert = new ArrayList<>();
257 LOG.info("creation of {} roadm to roadm links", rdmTordmLinkList.size() / 2);
258 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
259 .Link link : rdmTordmLinkList) {
260 if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
261 Link tapiLink = createTapiOmsLink(link, rdmTordmLinkList.stream()
262 .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
263 .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink()))
264 .findAny().orElse(null));
265 linksToNotConvert.add(link
266 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
267 .getOppositeLink().getValue());
268 tapiLinks.put(tapiLink.key(), tapiLink);
273 public void convertRoadmNode(Node roadm, Network openroadmTopo) {
274 this.ietfNodeId = roadm.getNodeId().getValue();
275 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist = new HashMap<>();
276 // 1. Get degree and srg nodes to map TPs into NEPs
277 if (openroadmTopo.getNode() == null) {
278 LOG.warn("Openroadm-topology is null.");
283 List<Node> nodeList = new ArrayList<Node>(openroadmTopo.getNode().values());
284 for (Node node:nodeList) {
285 if (node.getSupportingNode().values().stream().noneMatch(sp -> sp.getNodeRef().getValue()
286 .equals(this.ietfNodeId))) {
287 LOG.warn("Abstracted node {} is not part of {}",
288 node.getNodeId().getValue(), this.ietfNodeId);
291 if (node.augmentation(Node1.class) == null
292 && node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
293 .ietf.network.topology.rev180226.Node1.class) == null) {
294 LOG.warn("Abstracted node {} doesnt have type of node or is not disaggregated",
295 node.getNodeId().getValue());
298 OpenroadmNodeType nodeType = node.augmentation(org.opendaylight.yang.gen.v1.http
299 .org.openroadm.common.network.rev200529.Node1.class).getNodeType();
300 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1 node1 =
301 node.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
302 .ietf.network.topology.rev180226.Node1.class);
303 LOG.info("TPs of node: {}", node1.getTerminationPoint().values());
304 switch (nodeType.getIntValue()) {
306 LOG.info("Degree node");
307 // Get only external TPs of the degree
308 List<TerminationPoint> degPortList = node1.getTerminationPoint().values().stream()
309 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
310 == OpenroadmTpType.DEGREETXRXTTP.getIntValue()
311 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
312 == OpenroadmTpType.DEGREERXTTP.getIntValue()
313 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
314 == OpenroadmTpType.DEGREETXTTP.getIntValue())
315 .collect(Collectors.toList());
316 // Convert TP List in NEPs and put it in onepl
317 LOG.info("Degree port List: {}", degPortList);
318 // TODO: deg port could be sip. e.g. MDONS
319 oneplist.putAll(populateNepsForRdmNode(degPortList, false));
320 // oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), degPortList, false));
321 numNeps += degPortList.size() * 3;
324 LOG.info("SRG node");
325 // Get only external TPs of the srg
326 List<TerminationPoint> srgPortList = node1.getTerminationPoint().values().stream()
327 .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
328 == OpenroadmTpType.SRGTXRXPP.getIntValue()
329 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
330 == OpenroadmTpType.SRGRXPP.getIntValue()
331 || tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
332 == OpenroadmTpType.SRGTXPP.getIntValue())
333 .collect(Collectors.toList());
334 // Convert TP List in NEPs and put it in onepl
335 LOG.info("Srg port List: {}", srgPortList);
336 oneplist.putAll(populateNepsForRdmNode(srgPortList, true));
337 // oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), srgPortList, true));
338 numNeps += srgPortList.size() * 3;
339 numSips += srgPortList.size();
342 LOG.error("Node {} tyoe not supported", nodeType.getName());
347 LOG.info("Creation of PHOTONIC node for {}", roadm.getNodeId().getValue());
348 Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", roadm.getNodeId().getValue(),
349 PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
351 Name nodeNames = new NameBuilder().setValueName("roadm node name")
352 .setValue(String.join("+", roadm.getNodeId().getValue(), PHTNC_MEDIA)).build();
354 List<LayerProtocolName> layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
356 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
357 .Node roadmNode = createRoadmTapiNode(nodeUuid, nodeNames, layerProtocols, oneplist);
358 // TODO add states corresponding to device config
359 LOG.info("ROADM node {} should have {} NEPs and {} SIPs", roadm.getNodeId().getValue(), numNeps, numSips);
360 LOG.info("ROADM node {} has {} NEPs and {} SIPs", roadm.getNodeId().getValue(),
361 roadmNode.getOwnedNodeEdgePoint().values().size(),
362 roadmNode.getOwnedNodeEdgePoint().values().stream()
363 .filter(nep -> nep.getMappedServiceInterfacePoint() != null).count());
365 tapiNodes.put(roadmNode.key(), roadmNode);
368 private OduSwitchingPools createOduSwitchingPoolForTp100G() {
369 Map<NonBlockingListKey, NonBlockingList> nblMap = new HashMap<>();
371 for (TerminationPoint tp : this.oorNetworkPortList) {
372 TpId tpid1 = tp.getTpId();
373 TpId tpid2 = new TpId(tp.augmentation(
374 org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1.class)
375 .getAssociatedConnectionMapPort());
376 List<TpId> tpList = new ArrayList<>();
379 NonBlockingList nbl = new NonBlockingListBuilder()
380 .setNblNumber(Uint16.valueOf(count))
383 nblMap.put(nbl.key(), nbl);
386 return new OduSwitchingPoolsBuilder()
387 .setNonBlockingList(nblMap)
388 .setSwitchingPoolNumber(Uint16.valueOf(1))
392 private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
393 createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
394 Uuid nodeUuid = null;
395 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
396 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
397 Map<RuleKey, Rule> ruleList = new HashMap<>();
398 Rule rule = new RuleBuilder()
399 .setLocalId("forward")
400 .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
401 .setRuleType(RuleType.FORWARDING)
403 ruleList.put(rule.key(), rule);
404 if (layerProtocols.contains(LayerProtocolName.DSR)) {
405 nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, ruleList);
406 } else if (layerProtocols.contains(LayerProtocolName.PHOTONICMEDIA)) {
407 nodeUuid = getNodeUuid4Photonic(onepl, nodeRuleGroupList, ruleList);
409 LOG.error("Undefined LayerProtocolName for {} node {}", nodeNames.get(nodeNames.keySet().iterator().next())
410 .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
412 // Empty random creation of mandatory fields for avoiding errors....
413 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
414 .setCostAlgorithm("Restricted Shortest Path - RSP")
415 .setCostName("HOP_COUNT")
416 .setCostValue("12345678")
418 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
419 .setFixedLatencyCharacteristic("12345678")
420 .setQueingLatencyCharacteristic("12345678")
421 .setJitterCharacteristic("12345678")
422 .setWanderCharacteristic("12345678")
423 .setTrafficPropertyName("FIXED_LATENCY")
425 return new NodeBuilder()
428 .setLayerProtocolName(layerProtocols)
429 .setAdministrativeState(setTapiAdminState(this.ietfNodeAdminState))
430 .setOperationalState(setTapiOperationalState(this.ietfNodeOperState))
431 .setLifecycleState(LifecycleState.INSTALLED)
432 .setOwnedNodeEdgePoint(onepl)
433 .setNodeRuleGroup(nodeRuleGroupList)
434 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
435 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
436 .setErrorCharacteristic("error")
437 .setLossCharacteristic("loss")
438 .setRepeatDeliveryCharacteristic("repeat delivery")
439 .setDeliveryOrderCharacteristic("delivery order")
440 .setUnavailableTimeCharacteristic("unavailable time")
441 .setServerIntegrityProcessCharacteristic("server integrity process")
445 private AdministrativeState setTapiAdminState(AdminStates adminState) {
446 if (adminState == null) {
449 return adminState.equals(AdminStates.InService)
450 ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
453 private AdministrativeState setTapiAdminState(AdminStates adminState1, AdminStates adminState2) {
454 if (adminState1 == null || adminState2 == null) {
457 LOG.info("Admin state 1 = {}, andmin state 2 = {}", adminState1.getName(), adminState2.getName());
458 if (AdminStates.InService.equals(adminState1) && AdminStates.InService.equals(adminState2)) {
459 return AdministrativeState.UNLOCKED;
461 return AdministrativeState.LOCKED;
465 private OperationalState setTapiOperationalState(State operState) {
466 if (operState == null) {
469 return operState.getName().equals("inService") ? OperationalState.ENABLED : OperationalState.DISABLED;
472 private OperationalState setTapiOperationalState(State operState1, State operState2) {
473 if (operState1 == null || operState2 == null) {
476 LOG.info("Oper state 1 = {}, Oper state 2 = {}", operState1.getName(), operState2.getName());
477 if (State.InService.equals(operState1) && State.InService.equals(operState2)) {
478 return OperationalState.ENABLED;
480 return OperationalState.DISABLED;
484 private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
485 createRoadmTapiNode(Uuid nodeUuid, Name nodeNames, List<LayerProtocolName> layerProtocols,
486 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
487 // Empty random creation of mandatory fields for avoiding errors....
488 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
489 .setCostAlgorithm("Restricted Shortest Path - RSP")
490 .setCostName("HOP_COUNT")
491 .setCostValue("12345678")
493 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
494 .setFixedLatencyCharacteristic("12345678")
495 .setQueingLatencyCharacteristic("12345678")
496 .setJitterCharacteristic("12345678")
497 .setWanderCharacteristic("12345678")
498 .setTrafficPropertyName("FIXED_LATENCY")
500 return new NodeBuilder()
502 .setName(Map.of(nodeNames.key(), nodeNames))
503 .setLayerProtocolName(layerProtocols)
504 .setAdministrativeState(AdministrativeState.UNLOCKED)
505 .setOperationalState(OperationalState.ENABLED)
506 .setLifecycleState(LifecycleState.INSTALLED)
507 .setOwnedNodeEdgePoint(oneplist)
508 .setNodeRuleGroup(createNodeRuleGroupForRdmNode(nodeUuid, oneplist.values()))
509 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
510 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
511 .setErrorCharacteristic("error")
512 .setLossCharacteristic("loss")
513 .setRepeatDeliveryCharacteristic("repeat delivery")
514 .setDeliveryOrderCharacteristic("delivery order")
515 .setUnavailableTimeCharacteristic("unavailable time")
516 .setServerIntegrityProcessCharacteristic("server integrity process")
520 private Uuid getNodeUuid4Photonic(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
521 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList,
522 Map<RuleKey, Rule> ruleList) {
524 nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI));
525 // iNep creation on otsi node
526 for (int i = 0; i < oorNetworkPortList.size(); i++) {
527 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, I_OTSI,
528 oorNetworkPortList.get(i).getTpId().getValue()));
529 Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
530 (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
531 .getBytes(Charset.forName("UTF-8")))
533 this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI,
534 oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1);
535 Name onedName = new NameBuilder()
536 .setValueName("iNodeEdgePoint")
537 .setValue(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
540 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
541 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true,
542 String.join("+", this.ietfNodeId, I_OTSI));
543 onepl.put(onep.key(), onep);
545 // eNep creation on otsi node
546 for (int i = 0; i < oorNetworkPortList.size(); i++) {
547 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, E_OTSI,
548 oorNetworkPortList.get(i).getTpId().getValue()));
549 Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
550 (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
551 .getBytes(Charset.forName("UTF-8")))
553 this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI,
554 oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2);
555 Name onedName = new NameBuilder()
556 .setValueName("eNodeEdgePoint")
557 .setValue(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
560 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
561 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, false,
562 String.join("+", this.ietfNodeId, E_OTSI));
563 onepl.put(onep.key(), onep);
565 // Photonic Media Nep creation on otsi node
566 for (int i = 0; i < oorNetworkPortList.size(); i++) {
567 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, PHTNC_MEDIA,
568 oorNetworkPortList.get(i).getTpId().getValue()));
569 Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes(
570 (String.join("+", this.ietfNodeId, PHTNC_MEDIA,
571 oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8")))
573 this.uuidMap.put(String.join("+", this.ietfNodeId, PHTNC_MEDIA,
574 oorNetworkPortList.get(i).getTpId().getValue()), nepUuid3);
575 Name onedName = new NameBuilder()
576 .setValueName("PhotMedNodeEdgePoint")
577 .setValue(String.join("+", this.ietfNodeId, PHTNC_MEDIA,
578 oorNetworkPortList.get(i).getTpId().getValue()))
581 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
582 LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, false,
583 String.join("+", this.ietfNodeId, PHTNC_MEDIA));
584 onepl.put(onep.key(), onep);
586 // create NodeRuleGroup
588 LOG.info("OTSi switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
589 for (TerminationPoint tp : this.oorNetworkPortList) {
590 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
591 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
592 nepList = new HashMap<>();
593 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
594 .NodeEdgePoint inep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
595 .node.rule.group.NodeEdgePointBuilder()
596 .setTopologyUuid(tapiTopoUuid)
597 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
598 .setNodeEdgePointUuid(
599 this.uuidMap.get(String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue())))
601 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
602 .NodeEdgePoint enep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
603 .node.rule.group.NodeEdgePointBuilder()
604 .setTopologyUuid(tapiTopoUuid)
605 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
606 .setNodeEdgePointUuid(
607 this.uuidMap.get(String.join("+", this.ietfNodeId, E_OTSI, tp.getTpId().getValue())))
609 nepList.put(inep.key(), inep);
610 nepList.put(enep.key(), enep);
611 // Empty random creation of mandatory fields for avoiding errors....
612 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
613 .setCostAlgorithm("Restricted Shortest Path - RSP")
614 .setCostName("HOP_COUNT")
615 .setCostValue("12345678")
617 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
618 .setFixedLatencyCharacteristic("12345678")
619 .setQueingLatencyCharacteristic("12345678")
620 .setJitterCharacteristic("12345678")
621 .setWanderCharacteristic("12345678")
622 .setTrafficPropertyName("FIXED_LATENCY")
624 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
625 .setRiskCharacteristicName("risk characteristic")
626 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
628 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
630 UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
633 .setNodeEdgePoint(nepList)
634 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
635 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
636 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
638 nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
644 private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
645 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
647 nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR));
648 // client nep creation on DSR node
649 for (int i = 0; i < oorClientPortList.size(); i++) {
650 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, DSR,
651 oorClientPortList.get(i).getTpId().getValue()));
652 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
653 (String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()))
654 .getBytes(Charset.forName("UTF-8"))).toString());
655 this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()),
657 NameBuilder nameBldr = new NameBuilder().setValue(
658 String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()));
660 if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
661 name = nameBldr.setValueName("100G-tpdr").build();
663 name = nameBldr.setValueName("NodeEdgePoint_C").build();
666 OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name),
667 LayerProtocolName.DSR, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR));
668 onepl.put(onep.key(), onep);
670 // network nep creation on I_ODU node
671 for (int i = 0; i < oorNetworkPortList.size(); i++) {
672 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, I_ODU,
673 oorNetworkPortList.get(i).getTpId().getValue()));
674 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
675 (String.join("+", this.ietfNodeId, I_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
676 .getBytes(Charset.forName("UTF-8"))).toString());
677 this.uuidMap.put(String.join("+", this.ietfNodeId, I_ODU, oorNetworkPortList.get(i).getTpId().getValue()),
679 Name onedName = new NameBuilder()
680 .setValueName("iNodeEdgePoint_N")
681 .setValue(String.join("+", this.ietfNodeId, I_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
684 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
685 LayerProtocolName.ODU, LayerProtocolName.DSR, false, String.join("+", this.ietfNodeId, I_ODU));
686 onepl.put(onep.key(), onep);
688 // network nep creation on E_ODU node
689 for (int i = 0; i < oorNetworkPortList.size(); i++) {
690 LOG.info("NEP = {}", String.join("+", this.ietfNodeId, E_ODU,
691 oorNetworkPortList.get(i).getTpId().getValue()));
692 Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
693 (String.join("+", this.ietfNodeId, E_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
694 .getBytes(Charset.forName("UTF-8"))).toString());
695 this.uuidMap.put(String.join("+", this.ietfNodeId, E_ODU, oorNetworkPortList.get(i).getTpId().getValue()),
697 Name onedName = new NameBuilder()
698 .setValueName("eNodeEdgePoint_N")
699 .setValue(String.join("+", this.ietfNodeId, E_ODU, oorNetworkPortList.get(i).getTpId().getValue()))
702 OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName),
703 LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, E_ODU));
704 onepl.put(onep.key(), onep);
706 // create NodeRuleGroup
708 LOG.info("ODU switching pool = {}", this.oorOduSwitchingPool.nonnullNonBlockingList().values());
709 for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) {
710 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
711 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
712 nepList = new HashMap<>();
713 LOG.info("UUidMap={}", this.uuidMap.keySet());
714 LOG.info("TP list = {}", nbl.getTpList());
715 for (TpId tp : nbl.getTpList()) {
716 LOG.info("TP={}", tp.getValue());
717 LOG.info("UuidKey={}", String.join("+", this.ietfNodeId, E_ODU, tp.getValue()));
718 if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, E_ODU, tp.getValue()))
719 || this.uuidMap.containsKey(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) {
720 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
721 nep = new org.opendaylight.yang.gen.v1.urn
722 .onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointBuilder()
723 .setTopologyUuid(tapiTopoUuid)
724 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
725 .setNodeEdgePointUuid((tp.getValue().contains("CLIENT")) ? this.uuidMap.get(String.join(
726 "+", this.ietfNodeId, DSR, tp.getValue())) : this.uuidMap.get(String.join(
727 "+", this.ietfNodeId, E_ODU, tp.getValue())))
729 nepList.put(nep.key(), nep);
732 // Empty random creation of mandatory fields for avoiding errors....
733 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
734 .setCostAlgorithm("Restricted Shortest Path - RSP")
735 .setCostName("HOP_COUNT")
736 .setCostValue("12345678")
738 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
739 .setFixedLatencyCharacteristic("12345678")
740 .setQueingLatencyCharacteristic("12345678")
741 .setJitterCharacteristic("12345678")
742 .setWanderCharacteristic("12345678")
743 .setTrafficPropertyName("FIXED_LATENCY")
745 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
746 .setRiskCharacteristicName("risk characteristic")
747 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
749 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
750 .setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count)
751 .getBytes(Charset.forName("UTF-8"))).toString()))
753 .setNodeEdgePoint(nepList)
754 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
755 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
756 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
758 nodeRuleGroupList.put(nodeRuleGroup.key(), nodeRuleGroup);
764 private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
765 LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip,
767 String key = String.join("+", keyword, oorTp.getTpId().getValue());
768 OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
769 .setUuid(this.uuidMap.get(key))
770 .setLayerProtocolName(nepProtocol)
773 onepBldr.setMappedServiceInterfacePoint(createMSIP(1, nepProtocol, oorTp, keyword));
775 onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedLayerProtocolQualifier(oorTp, nodeProtocol))
776 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
777 .setLinkPortRole(PortRole.SYMMETRIC)
778 .setAdministrativeState(setTapiAdminState(
779 oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()))
780 .setOperationalState(setTapiOperationalState(
781 oorTp.augmentation(TerminationPoint1.class).getOperationalState()))
782 .setLifecycleState(LifecycleState.INSTALLED)
783 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
784 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
785 return onepBldr.build();
788 private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(List<TerminationPoint> tpList,
790 // create neps for MC and OTSiMC and Photonic Media
791 Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
792 for (TerminationPoint tp:tpList) {
793 // Admin and oper state common for all tps
794 AdminStates admin = tp.augmentation(TerminationPoint1.class).getAdministrativeState();
795 State oper = tp.augmentation(TerminationPoint1.class).getOperationalState();
796 // PHOTONIC MEDIA nep
797 LOG.info("PHOTO NEP = {}", String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()));
798 Name nepName = new NameBuilder()
799 .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
800 .setValue(String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()))
803 OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
804 .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, PHTNC_MEDIA,
805 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
806 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
807 .setName(Map.of(nepName.key(), nepName))
808 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
809 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
810 .setLinkPortRole(PortRole.SYMMETRIC)
811 .setAdministrativeState(setTapiAdminState(admin))
812 .setOperationalState(setTapiOperationalState(oper))
813 .setLifecycleState(LifecycleState.INSTALLED)
814 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
815 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
817 onepMap.put(onep.key(), onep);
820 LOG.info("MC NEP = {}", String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()));
821 Name nepName1 = new NameBuilder()
822 .setValueName(MC + "NodeEdgePoint")
823 .setValue(String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()))
825 OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
826 .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, MC,
827 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
828 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
829 .setName(Map.of(nepName1.key(), nepName1))
830 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
831 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
832 .setLinkPortRole(PortRole.SYMMETRIC)
833 .setAdministrativeState(setTapiAdminState(admin))
834 .setOperationalState(setTapiOperationalState(oper))
835 .setLifecycleState(LifecycleState.INSTALLED)
836 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
837 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
839 onepBldr1.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
840 tp, String.join("+", this.ietfNodeId, MC)));
842 OwnedNodeEdgePoint onep1 = onepBldr1.build();
843 onepMap.put(onep1.key(), onep1);
846 LOG.info("OTSi NEP = {}", String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()));
847 Name nepName2 = new NameBuilder()
848 .setValueName(OTSI_MC + "NodeEdgePoint")
849 .setValue(String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()))
852 OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
853 .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI_MC,
854 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
855 .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
856 .setName(Map.of(nepName2.key(), nepName2))
857 .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
858 .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
859 .setLinkPortRole(PortRole.SYMMETRIC)
860 .setAdministrativeState(setTapiAdminState(admin))
861 .setOperationalState(setTapiOperationalState(oper))
862 .setLifecycleState(LifecycleState.INSTALLED)
863 .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
864 .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
866 onepMap.put(onep2.key(), onep2);
871 private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
872 Collection<OwnedNodeEdgePoint> onepl) {
873 Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
874 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
875 nepMap = new HashMap<>();
876 for (OwnedNodeEdgePoint onep : onepl) {
877 org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint
878 nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group
879 .NodeEdgePointBuilder()
880 .setTopologyUuid(tapiTopoUuid)
881 .setNodeUuid(nodeUuid)
882 .setNodeEdgePointUuid(onep.key().getUuid())
884 nepMap.put(nep.key(), nep);
886 Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupMap = new HashMap<>();
887 Map<RuleKey, Rule> ruleList = new HashMap<>();
888 Rule rule = new RuleBuilder()
889 .setLocalId("forward")
890 .setForwardingRule(ForwardingRule.MAYFORWARDACROSSGROUP)
891 .setRuleType(RuleType.FORWARDING)
893 ruleList.put(rule.key(), rule);
894 NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
895 .setUuid(new Uuid(UUID.nameUUIDFromBytes((this.ietfNodeId + " node rule group")
896 .getBytes(Charset.forName("UTF-8"))).toString()))
898 .setNodeEdgePoint(nepMap)
900 nodeRuleGroupMap.put(nodeRuleGroup.key(), nodeRuleGroup);
901 return nodeRuleGroupMap;
904 private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(int nb,
905 LayerProtocolName layerProtocol,
908 // add them to SIP context
909 Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
910 for (int i = 0; i < nb; i++) {
911 LOG.info("SIP = {}", String.join("+", "SIP", nodeid, tp.getTpId().getValue()));
912 Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid,
913 tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString());
914 MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
915 .setServiceInterfacePointUuid(sipUuid).build();
916 ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tp, nodeid);
917 this.tapiSips.put(sip.key(), sip);
918 msipl.put(msip.key(), msip);
923 private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, TerminationPoint tp,
925 // TODO: what value should be set in total capacity and available capacity??
926 // LOG.info("SIP name = {}", String.join("+", nodeid, tp.getTpId().getValue()));
927 Name sipName = new NameBuilder()
928 .setValueName("SIP name")
929 .setValue(String.join("+", nodeid, tp.getTpId().getValue()))
931 return new ServiceInterfacePointBuilder()
933 .setName(Map.of(sipName.key(), sipName))
934 .setLayerProtocolName(layerProtocol)
935 .setAdministrativeState(setTapiAdminState(
936 tp.augmentation(TerminationPoint1.class).getAdministrativeState()))
937 .setOperationalState(setTapiOperationalState(
938 tp.augmentation(TerminationPoint1.class).getOperationalState()))
939 .setLifecycleState(LifecycleState.INSTALLED)
940 .setAvailableCapacity(new AvailableCapacityBuilder().build())
941 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
942 .setSupportedLayerProtocolQualifier(createSupportedLayerProtocolQualifier(tp, layerProtocol))
946 private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(TerminationPoint tp,
947 LayerProtocolName lpn) {
948 Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
949 List<SupportedInterfaceCapability> sicList;
950 org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.TerminationPoint1 tp1 =
951 tp.augmentation(org.opendaylight.yang.gen.v1.http
952 .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class);
954 return new ArrayList<>(sclpqSet);
956 if (tp1.getTpSupportedInterfaces() == null) {
957 LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue());
958 return new ArrayList<>(sclpqSet);
960 sicList = new ArrayList<>(tp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values());
961 for (SupportedInterfaceCapability sic : sicList) {
962 switch (lpn.getName()) {
964 switch (sic.getIfCapType().getSimpleName()) {
966 sclpqSet.add(ODUTYPEODU2E.class);
967 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
970 sclpqSet.add(ODUTYPEODU2.class);
971 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
974 sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
977 sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
978 sclpqSet.add(ODUTYPEODU4.class);
981 sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
983 case "IfOCHOTU4ODU4":
985 sclpqSet.add(ODUTYPEODU4.class);
988 LOG.error("IfCapability type not managed");
992 case "PHOTONIC_MEDIA":
993 if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
994 || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
995 sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
996 sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
1000 LOG.error("Layer Protocol Name is unknown");
1004 return new ArrayList<>(sclpqSet);
1007 private void createTapiTransitionalLinks() {
1008 for (TerminationPoint tp : this.oorNetworkPortList) {
1009 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1010 String sourceKey = String.join("+", this.ietfNodeId, I_ODU, tp.getTpId().getValue());
1011 Uuid sourceUuidTp = this.uuidMap.get(sourceKey);
1012 String destKey = String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue());
1013 Uuid destUuidTp = this.uuidMap.get(destKey);
1014 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1015 .setTopologyUuid(this.tapiTopoUuid)
1016 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)))
1017 .setNodeEdgePointUuid(sourceUuidTp)
1019 nepList.put(sourceNep.key(), sourceNep);
1020 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1021 .setTopologyUuid(this.tapiTopoUuid)
1022 .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)))
1023 .setNodeEdgePointUuid(destUuidTp)
1025 nepList.put(destNep.key(), destNep);
1026 Name linkName = new NameBuilder().setValueName("transitional link name")
1027 .setValue(String.join("--", this.ietfNodeId, sourceKey, destKey))
1029 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1030 .setCostAlgorithm("Restricted Shortest Path - RSP")
1031 .setCostName("HOP_COUNT")
1032 .setCostValue("12345678")
1034 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1035 .setFixedLatencyCharacteristic("12345678")
1036 .setQueingLatencyCharacteristic("12345678")
1037 .setJitterCharacteristic("12345678")
1038 .setWanderCharacteristic("12345678")
1039 .setTrafficPropertyName("FIXED_LATENCY")
1041 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1042 .setRiskCharacteristicName("risk characteristic")
1043 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1045 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1046 .setValidationMechanism("validation mechanism")
1047 .setValidationRobustness("validation robustness")
1048 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1050 Link transiLink = new LinkBuilder()
1052 UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey))
1053 .getBytes(Charset.forName("UTF-8")))
1055 .setName(Map.of(linkName.key(), linkName))
1056 .setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(),
1057 LayerProtocolName.PHOTONICMEDIA.getName()))
1058 .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA))
1059 .setNodeEdgePoint(nepList)
1060 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1061 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1062 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build())
1064 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1065 .setRestorationPolicy(RestorationPolicy.NA)
1067 .setAdministrativeState(AdministrativeState.UNLOCKED)
1068 .setOperationalState(OperationalState.ENABLED)
1069 .setLifecycleState(LifecycleState.INSTALLED)
1070 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1071 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build())
1073 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1074 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1075 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1076 .setErrorCharacteristic("error")
1077 .setLossCharacteristic("loss")
1078 .setRepeatDeliveryCharacteristic("repeat delivery")
1079 .setDeliveryOrderCharacteristic("delivery order")
1080 .setUnavailableTimeCharacteristic("unavailable time")
1081 .setServerIntegrityProcessCharacteristic("server integrity process")
1082 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1084 this.tapiLinks.put(transiLink.key(), transiLink);
1088 private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1089 .ietf.network.topology.rev180226.networks.network.Link link,
1090 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1091 .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
1092 String prefix = link.getLinkId().getValue().split("-")[0];
1093 String sourceNode = link.getSource().getSourceNode().getValue();
1094 String sourceTp = link.getSource().getSourceTp().getValue();
1095 String destNode = link.getDestination().getDestNode().getValue();
1096 String destTp = link.getDestination().getDestTp().getValue();
1097 LOG.info("prefix = {}, sourceNode = {}, sourceTp = {}, destNode = {}, destTp = {}",
1098 prefix, sourceNode, sourceTp, destNode, destTp);
1099 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1101 Uuid sourceUuidNode;
1105 AdminStates oppositeLinkAdminState = null;
1106 State oppositeLinkOperState = null;
1107 if (oppositeLink != null) {
1108 oppositeLinkAdminState = oppositeLink.augmentation(
1109 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1110 .getAdministrativeState();
1111 oppositeLinkOperState = oppositeLink.augmentation(
1112 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1113 .getOperationalState();
1115 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1116 .setCostAlgorithm("Restricted Shortest Path - RSP")
1117 .setCostName("HOP_COUNT")
1118 .setCostValue("12345678")
1120 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1121 .setFixedLatencyCharacteristic("12345678")
1122 .setQueingLatencyCharacteristic("12345678")
1123 .setJitterCharacteristic("12345678")
1124 .setWanderCharacteristic("12345678")
1125 .setTrafficPropertyName("FIXED_LATENCY")
1127 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1128 .setRiskCharacteristicName("risk characteristic")
1129 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1131 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1132 .setValidationMechanism("validation mechanism")
1133 .setValidationRobustness("validation robustness")
1134 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1138 sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, I_OTSI, sourceTp));
1139 sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, OTSI));
1140 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1141 .setTopologyUuid(this.tapiTopoUuid)
1142 .setNodeUuid(sourceUuidNode)
1143 .setNodeEdgePointUuid(sourceUuidTp)
1145 nepList.put(sourceNep.key(), sourceNep);
1146 destUuidTp = this.uuidMap.get(String.join("+", destNode, I_OTSI, destTp));
1147 destUuidNode = this.uuidMap.get(String.join("+", destNode, OTSI));
1148 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1149 .setTopologyUuid(this.tapiTopoUuid)
1150 .setNodeUuid(destUuidNode)
1151 .setNodeEdgePointUuid(destUuidTp)
1153 nepList.put(destNep.key(), destNep);
1154 linkName = new NameBuilder().setValueName("otn link name")
1155 .setValue(link.getLinkId().getValue())
1157 return new LinkBuilder()
1158 .setUuid(new Uuid(UUID.nameUUIDFromBytes((link.getLinkId().getValue())
1159 .getBytes(Charset.forName("UTF-8"))).toString()))
1160 .setName(Map.of(linkName.key(), linkName))
1161 .setLayerProtocolName(Arrays.asList(LayerProtocolName.PHOTONICMEDIA))
1162 .setTransitionedLayerProtocolName(new ArrayList<>())
1163 .setAdministrativeState(setTapiAdminState(link
1165 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1166 .getAdministrativeState(), oppositeLinkAdminState))
1167 .setOperationalState(setTapiOperationalState(link
1169 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1170 .getOperationalState(), oppositeLinkOperState))
1171 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1172 .setNodeEdgePoint(nepList)
1173 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1174 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1175 .setValue(Uint64.valueOf(100)).build()).build())
1176 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1177 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1178 .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
1180 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1181 .setRestorationPolicy(RestorationPolicy.NA)
1183 .setLifecycleState(LifecycleState.INSTALLED)
1184 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1185 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1186 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1187 .setErrorCharacteristic("error")
1188 .setLossCharacteristic("loss")
1189 .setRepeatDeliveryCharacteristic("repeat delivery")
1190 .setDeliveryOrderCharacteristic("delivery order")
1191 .setUnavailableTimeCharacteristic("unavailable time")
1192 .setServerIntegrityProcessCharacteristic("server integrity process")
1193 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1196 sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, E_ODU, sourceTp));
1197 sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR));
1198 NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder()
1199 .setTopologyUuid(this.tapiTopoUuid)
1200 .setNodeUuid(sourceUuidNode)
1201 .setNodeEdgePointUuid(sourceUuidTp)
1203 nepList.put(sourceNep2.key(), sourceNep2);
1204 destUuidTp = this.uuidMap.get(String.join("+", destNode, E_ODU, destTp));
1205 destUuidNode = this.uuidMap.get(String.join("+", destNode, DSR));
1206 NodeEdgePoint destNep2 = new NodeEdgePointBuilder()
1207 .setTopologyUuid(this.tapiTopoUuid)
1208 .setNodeUuid(destUuidNode)
1209 .setNodeEdgePointUuid(destUuidTp)
1211 nepList.put(destNep2.key(), destNep2);
1212 linkName = new NameBuilder().setValueName("otn link name")
1213 .setValue(link.getLinkId().getValue())
1215 return new LinkBuilder()
1216 .setUuid(new Uuid(UUID.nameUUIDFromBytes((link.getLinkId().getValue())
1217 .getBytes(Charset.forName("UTF-8"))).toString()))
1218 .setName(Map.of(linkName.key(), linkName))
1219 .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU))
1220 .setTransitionedLayerProtocolName(new ArrayList<>())
1221 .setAdministrativeState(setTapiAdminState(link
1223 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1224 .getAdministrativeState(), oppositeLinkAdminState))
1225 .setOperationalState(setTapiOperationalState(link
1227 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1228 .getOperationalState(), oppositeLinkOperState))
1229 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1230 .setNodeEdgePoint(nepList)
1231 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1232 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1233 .setValue(Uint64.valueOf(100)).build()).build())
1234 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1235 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1236 .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
1238 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1239 .setRestorationPolicy(RestorationPolicy.NA)
1241 .setLifecycleState(LifecycleState.INSTALLED)
1242 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1243 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1244 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1245 .setErrorCharacteristic("error")
1246 .setLossCharacteristic("loss")
1247 .setRepeatDeliveryCharacteristic("repeat delivery")
1248 .setDeliveryOrderCharacteristic("delivery order")
1249 .setUnavailableTimeCharacteristic("unavailable time")
1250 .setServerIntegrityProcessCharacteristic("server integrity process")
1251 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1254 LOG.error("OTN link of type {} not managed yet", prefix);
1259 private Link createTapiOmsLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1260 .ietf.network.topology.rev180226.networks.network.Link link,
1261 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1262 .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
1263 String sourceNode = getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue());
1264 String sourceTp = link.getSource().getSourceTp().getValue();
1265 String destNode = getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue());
1266 String destTp = link.getDestination().getDestTp().getValue();
1267 AdminStates oppositeLinkAdminState = null;
1268 State oppositeLinkOperState = null;
1269 if (oppositeLink != null) {
1270 oppositeLinkAdminState = oppositeLink.augmentation(
1271 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1272 .getAdministrativeState();
1273 oppositeLinkOperState = oppositeLink.augmentation(
1274 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1275 .getOperationalState();
1277 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1278 Uuid sourceUuidNode = new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode,
1279 PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
1280 Uuid sourceUuidTp = new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode, PHTNC_MEDIA, sourceTp))
1281 .getBytes(Charset.forName("UTF-8"))).toString());
1282 Uuid destUuidNode = new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode,
1283 PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
1284 Uuid destUuidTp = new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode, PHTNC_MEDIA, destTp))
1285 .getBytes(Charset.forName("UTF-8"))).toString());
1286 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1287 .setTopologyUuid(this.tapiTopoUuid)
1288 .setNodeUuid(sourceUuidNode)
1289 .setNodeEdgePointUuid(sourceUuidTp)
1291 nepList.put(sourceNep.key(), sourceNep);
1292 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1293 .setTopologyUuid(this.tapiTopoUuid)
1294 .setNodeUuid(destUuidNode)
1295 .setNodeEdgePointUuid(destUuidTp)
1297 nepList.put(destNep.key(), destNep);
1298 Name linkName = new NameBuilder().setValueName("OMS link name")
1299 .setValue(link.getLinkId().getValue())
1301 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1302 .setCostAlgorithm("Restricted Shortest Path - RSP")
1303 .setCostName("HOP_COUNT")
1304 .setCostValue("12345678")
1306 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1307 .setFixedLatencyCharacteristic("12345678")
1308 .setQueingLatencyCharacteristic("12345678")
1309 .setJitterCharacteristic("12345678")
1310 .setWanderCharacteristic("12345678")
1311 .setTrafficPropertyName("FIXED_LATENCY")
1313 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1314 .setRiskCharacteristicName("risk characteristic")
1315 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1317 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1318 .setValidationMechanism("validation mechanism")
1319 .setValidationRobustness("validation robustness")
1320 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1322 return new LinkBuilder()
1324 UUID.nameUUIDFromBytes((link.getLinkId().getValue()).getBytes(Charset.forName("UTF-8")))
1326 .setName(Map.of(linkName.key(), linkName))
1327 .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
1328 .setTransitionedLayerProtocolName(new ArrayList<>())
1329 .setNodeEdgePoint(nepList)
1330 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1331 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1332 .setRestorationPolicy(RestorationPolicy.NA)
1334 .setAdministrativeState(setTapiAdminState(link
1336 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1337 .getAdministrativeState(), oppositeLinkAdminState))
1338 .setOperationalState(setTapiOperationalState(link
1340 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1341 .getOperationalState(), oppositeLinkOperState))
1342 .setLifecycleState(LifecycleState.INSTALLED)
1343 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1344 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1345 .setValue(Uint64.valueOf(100)).build()).build())
1346 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1347 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1348 .setValue(Uint64.valueOf(100)).build())
1350 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1351 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1352 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1353 .setErrorCharacteristic("error")
1354 .setLossCharacteristic("loss")
1355 .setRepeatDeliveryCharacteristic("repeat delivery")
1356 .setDeliveryOrderCharacteristic("delivery order")
1357 .setUnavailableTimeCharacteristic("unavailable time")
1358 .setServerIntegrityProcessCharacteristic("server integrity process")
1359 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1363 public void convertXpdrToRdmLinks(List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1364 .ietf.network.topology.rev180226.networks.network.Link> xpdrRdmLinkList) {
1365 List<String> linksToNotConvert = new ArrayList<>();
1366 LOG.info("creation of {} xpdr to roadm links", xpdrRdmLinkList.size() / 2);
1367 // LOG.info("Link list = {}", xpdrRdmLinkList.toString());
1368 for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1369 .ietf.network.topology.rev180226.networks.network.Link link:xpdrRdmLinkList) {
1370 if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
1371 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
1372 .ietf.network.topology.rev180226.networks.network.Link oppositeLink = xpdrRdmLinkList.stream()
1373 .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
1374 .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink())).findAny().orElse(null);
1376 AdminStates oppositeLinkAdminState = null;
1377 State oppositeLinkOperState = null;
1378 if (oppositeLink != null) {
1379 oppositeLinkAdminState = oppositeLink.augmentation(
1380 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1381 .getAdministrativeState();
1382 oppositeLinkOperState = oppositeLink.augmentation(
1383 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1384 .getOperationalState();
1387 String sourceNode = (link.getSource().getSourceNode().getValue().contains("ROADM"))
1388 ? getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue())
1389 : link.getSource().getSourceNode().getValue();
1390 String sourceTp = link.getSource().getSourceTp().getValue();
1391 String destNode = (link.getDestination().getDestNode().getValue().contains("ROADM"))
1392 ? getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue())
1393 : link.getDestination().getDestNode().getValue();
1394 String destTp = link.getDestination().getDestTp().getValue();
1395 Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
1396 Uuid sourceUuidNode = (sourceNode.contains("ROADM")) ? new Uuid(UUID.nameUUIDFromBytes((
1397 String.join("+", sourceNode, PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString())
1398 : new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode, OTSI))
1399 .getBytes(Charset.forName("UTF-8"))).toString());
1400 Uuid sourceUuidTp = new Uuid(UUID.nameUUIDFromBytes(
1401 (String.join("+", sourceNode, PHTNC_MEDIA, sourceTp))
1402 .getBytes(Charset.forName("UTF-8"))).toString());
1403 Uuid destUuidNode = (destNode.contains("ROADM")) ? new Uuid(UUID.nameUUIDFromBytes((
1404 String.join("+", destNode, PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString())
1405 : new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode, OTSI))
1406 .getBytes(Charset.forName("UTF-8"))).toString());
1407 Uuid destUuidTp = new Uuid(UUID.nameUUIDFromBytes((String.join("+", destNode,
1408 PHTNC_MEDIA, destTp)).getBytes(Charset.forName("UTF-8"))).toString());
1409 NodeEdgePoint sourceNep = new NodeEdgePointBuilder()
1410 .setTopologyUuid(this.tapiTopoUuid)
1411 .setNodeUuid(sourceUuidNode)
1412 .setNodeEdgePointUuid(sourceUuidTp)
1414 nepList.put(sourceNep.key(), sourceNep);
1415 NodeEdgePoint destNep = new NodeEdgePointBuilder()
1416 .setTopologyUuid(this.tapiTopoUuid)
1417 .setNodeUuid(destUuidNode)
1418 .setNodeEdgePointUuid(destUuidTp)
1420 nepList.put(destNep.key(), destNep);
1421 Name linkName = new NameBuilder().setValueName("XPDR-RDM link name")
1422 .setValue(link.getLinkId().getValue())
1424 CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
1425 .setCostAlgorithm("Restricted Shortest Path - RSP")
1426 .setCostName("HOP_COUNT")
1427 .setCostValue("12345678")
1429 LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder()
1430 .setFixedLatencyCharacteristic("12345678")
1431 .setQueingLatencyCharacteristic("12345678")
1432 .setJitterCharacteristic("12345678")
1433 .setWanderCharacteristic("12345678")
1434 .setTrafficPropertyName("FIXED_LATENCY")
1436 RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
1437 .setRiskCharacteristicName("risk characteristic")
1438 .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
1440 ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
1441 .setValidationMechanism("validation mechanism")
1442 .setValidationRobustness("validation robustness")
1443 .setLayerProtocolAdjacencyValidated("layer protocol adjacency")
1445 Link tapiLink = new LinkBuilder()
1447 UUID.nameUUIDFromBytes((link.getLinkId().getValue()).getBytes(Charset.forName("UTF-8")))
1449 .setName(Map.of(linkName.key(), linkName))
1450 .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
1451 .setTransitionedLayerProtocolName(new ArrayList<>())
1452 .setNodeEdgePoint(nepList)
1453 .setDirection(ForwardingDirection.BIDIRECTIONAL)
1454 .setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
1455 .setRestorationPolicy(RestorationPolicy.NA)
1457 .setAdministrativeState(setTapiAdminState(link
1459 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1460 .getAdministrativeState(), oppositeLinkAdminState))
1461 .setOperationalState(setTapiOperationalState(link
1463 org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1464 .getOperationalState(), oppositeLinkOperState))
1465 .setLifecycleState(LifecycleState.INSTALLED)
1466 .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
1467 new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
1468 .setValue(Uint64.valueOf(100)).build()).build())
1469 .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize(
1470 new TotalSizeBuilder().setUnit(CapacityUnit.MBPS)
1471 .setValue(Uint64.valueOf(100)).build())
1473 .setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
1474 .setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
1475 .setRiskCharacteristic(Map.of(riskCharacteristic.key(), riskCharacteristic))
1476 .setErrorCharacteristic("error")
1477 .setLossCharacteristic("loss")
1478 .setRepeatDeliveryCharacteristic("repeat delivery")
1479 .setDeliveryOrderCharacteristic("delivery order")
1480 .setUnavailableTimeCharacteristic("unavailable time")
1481 .setServerIntegrityProcessCharacteristic("server integrity process")
1482 .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism))
1484 linksToNotConvert.add(link
1485 .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
1486 .getOppositeLink().getValue());
1487 this.tapiLinks.put(tapiLink.key(), tapiLink);
1492 private String getIdBasedOnModelVersion(String linknodeid) {
1493 if (linknodeid.matches("[A-Z]{5}-[A-Z0-9]{2}-.*")) {
1494 LOG.info("OpenROADM version > 1.2.1 {}", linknodeid);
1495 return String.join("-", linknodeid.split("-")[0], linknodeid.split("-")[1]);
1497 LOG.info("OpenROADM version <= 1.2.1 {}", linknodeid);
1498 return linknodeid.split("-")[0];
1502 public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
1507 public Map<LinkKey, Link> getTapiLinks() {
1511 public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getTapiSips() {