- // Create the list of connections
- Network1 nw1 = openRoadmTopo.get().augmentation(Network1.class);
- List<Link> linksList = nw1.getLink();
- // 1:EXPRESS-LINK 2:ADD-LINK 3:DROP-LINK
- // 4:ROADM-To-ROADM 5:XPONDER-INPUT 6:XPONDER-OUTPUT
- int[] externalLink = {4,5,6};
- int idFiber = 0;
- int nbEDFA = 0;
- if (!linksList.isEmpty()) {
- LOG.debug("The link list is not empty");
- for (Link link : linksList) {
- Link1 link1 = link.augmentation(Link1.class);
- int linkType = link1.getLinkType().getIntValue();
- if (IntStream.of(externalLink).anyMatch(x -> x == linkType)) {
- // Verify if the node is a ROADM
- String srcId = mapDisgNodeRefNode.get(link.getSource().getSourceNode().getValue());
- IpAddress srcIp = mapNodeRefIp.get(srcId);
- String destId = null;
- IpAddress destIp = null;
- // Add the links between amplifiers
- OMSAttributes omsAttributes = link1.getOMSAttributes();
- if (omsAttributes != null) {
- if (omsAttributes.getAmplifiedLink() != null) {
- List<AmplifiedLink> amplifiedLinkList = omsAttributes.getAmplifiedLink()
- .getAmplifiedLink();
- if (!amplifiedLinkList.isEmpty()) {
- for (AmplifiedLink amplifiedLink : amplifiedLinkList) {
- Elements element1 = null;
- if (amplifiedLink.getSectionElement()
- .getSectionElement() instanceof Ila) {
- Ila ila = (Ila) amplifiedLink.getSectionElement()
- .getSectionElement();
- String nodeId = ila.getNodeId().getValue();
- IpAddress ipEdfa = new IpAddress(
- new Ipv4Address("1.1.1." + nbEDFA));
- nbEDFA++;
- mapDisgNodeRefNode.put(nodeId, nodeId);
- mapNodeRefIp.put(nodeId, ipEdfa);
- element1 = addElementsEdfa(2, 0, "RLD", "Lannion_CAS",
- ila.getGain().getValue(), ila.getTilt().getValue(),
- ila.getOutVoaAtt().getValue(), "std_medium_gain",
- ipEdfa.getIpv4Address().getValue().toString());
- } else if (amplifiedLink.getSectionElement()
- .getSectionElement() instanceof Span) {
- // Create the location
- Span span = (Span) amplifiedLink.getSectionElement()
- .getSectionElement();
- String clfi = span.getSpan().getClfi();
- IpAddress ipFiber = new IpAddress(
- new Ipv4Address("2.2.2." + idFiber));
- mapLinkFiber.put(link.getLinkId().getValue(), clfi);
- mapFiberIp.put(clfi, ipFiber);
- idFiber++;
- element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
- ipFiber.getIpv4Address().getValue(), 20, 0, 0.2, 0, 0,
- "SSMF");
- }
- if (element1 != null) {
- topoElements.add(element1);
- destId = element1.getUid();
- destIp = null;
- // Create a new link
- if (srcId != destId) {
- Connections connection = createNewConnection(srcId, srcIp,
- destId, destIp);
- topoConnections.add(connection);
- srcId = destId;
- srcIp = destIp;
- }
- }
- }
- }
- } else if (omsAttributes.getSpan() != null) {
- org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130
- .networks.network.link.oms.attributes.@Nullable Span span
- = omsAttributes.getSpan();
- String clfi = span.getClfi();
- IpAddress ipFiber = new IpAddress(new Ipv4Address("2.2.2." + idFiber));
- mapLinkFiber.put(link.getLinkId().getValue(), clfi);
- mapFiberIp.put(clfi, ipFiber);
- idFiber++;
- double attIn = 0;
- double connIn = 0;
- double connOut = 0;
- String typeVariety = "SSMF";
- double length = 0;
- // Compute the length of the link
- List<LinkConcatenation> linkConcatenationList = span.getLinkConcatenation();
- for (LinkConcatenation linkConcatenation : linkConcatenationList) {
- double srlgLength = linkConcatenation.getSRLGLength();
- //convert to kilometer
- length += srlgLength / convertKmM;
- }
- double lossCoef = span.getSpanlossCurrent().getValue().doubleValue() / length;
- Elements element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
- ipFiber.getIpv4Address().getValue(), length, attIn, lossCoef, connIn,
- connOut, typeVariety);
- topoElements.add(element1);
- // Create a new link
- destId = element1.getUid();
- destIp = null;
- if (srcId != destId) {
- Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
- topoConnections.add(connection);
- srcId = destId;
- srcIp = destIp;
- }
- } else {
- // Add a fiber
- String clfi = "Fiber" + idFiber;
- IpAddress ipFiber = new IpAddress(new Ipv4Address("2.2.2." + idFiber));
- mapLinkFiber.put(link.getLinkId().getValue(), clfi);
- mapFiberIp.put(clfi, ipFiber);
- idFiber++;
- // Create a new element
- Elements element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
- ipFiber.getIpv4Address().getValue(), 20, 0, 0.2, 0, 0, "SSMF");
- topoElements.add(element1);
- // Create a new link
- destId = element1.getUid();
- destIp = null;
- if (srcId != destId) {
- Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
- topoConnections.add(connection);
- srcId = destId;
- srcIp = destIp;
- }
- }
- } else {
- LOG.warn("The oms attributes is null {} !",link1.getLinkType().getName());
- }
- // Create a new link
- destId = mapDisgNodeRefNode.get(link.getDestination().getDestNode().getValue());
- destIp = mapNodeRefIp.get(destId);
- Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
- topoConnections.add(connection);
- }