X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftapi%2Ftopology%2FConvertORTopoToTapiFullTopo.java;h=d7c5c21f539411f7fe87904550abde6e0c52163c;hb=56d1795b647693ec1d620d6aca2c4003e3b302ca;hp=0961fc58b15f033bb53ed81d09f19e6c836062b6;hpb=21d35937b8a2d9f6930985485a1b54eb7bec9a91;p=transportpce.git diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java index 0961fc58b..d7c5c21f5 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java @@ -9,7 +9,6 @@ package org.opendaylight.transportpce.tapi.topology; import java.nio.charset.Charset; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -177,7 +176,7 @@ public class ConvertORTopoToTapiFullTopo { String.join("+", this.ietfNodeId, TapiStringConstants.DSR)).build(); Name nameNodeType = new NameBuilder().setValueName("Node Type") .setValue(this.ietfNodeType.getName()).build(); - List dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU); + Set dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology .Node dsrNode = createTapiNode(Map.of(nameDsrNode.key(), nameDsrNode, nameNodeType.key(), nameNodeType), dsrLayerProtocols); @@ -196,7 +195,7 @@ public class ConvertORTopoToTapiFullTopo { this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI), nodeUuid); Name nameOtsiNode = new NameBuilder().setValueName("otsi node name").setValue( String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)).build(); - List otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); + Set otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology .Node otsiNode = createTapiNode(Map.of(nameOtsiNode.key(), nameOtsiNode, nameNodeType.key(), nameNodeType), otsiLayerProtocols); @@ -251,8 +250,8 @@ public class ConvertORTopoToTapiFullTopo { link.getDestination().getDestNode().getValue().split("-")[1]), link.getDestination().getDestTp().getValue(), TapiStringConstants.OMS_RDM_RDM_LINK, TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA, - TapiStringConstants.PHTNC_MEDIA, adminState, operState, List.of(LayerProtocolName.PHOTONICMEDIA), - List.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid); + TapiStringConstants.PHTNC_MEDIA, adminState, operState, Set.of(LayerProtocolName.PHOTONICMEDIA), + Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid); linksToNotConvert.add(link .augmentation(Link1.class) .getOppositeLink().getValue()); @@ -346,7 +345,7 @@ public class ConvertORTopoToTapiFullTopo { Name nameNodeType = new NameBuilder().setValueName("Node Type") .setValue(this.ietfNodeType.getName()).build(); // Protocol Layer - List layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); + Set layerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA); // Build tapi node org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology .Node roadmNode = createRoadmTapiNode(nodeUuid, @@ -366,10 +365,10 @@ public class ConvertORTopoToTapiFullTopo { int count = 1; for (TerminationPoint tp : this.oorNetworkPortList) { TpId tpid1 = tp.getTpId(); - TpId tpid2 = new TpId(tp.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort()); - List tpList = new ArrayList<>(); + TpId tpid2 = tp.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) + .getAssociatedConnectionMapTp().iterator().next(); + Set tpList = new HashSet<>(); tpList.add(tpid1); tpList.add(tpid2); NonBlockingList nbl = new NonBlockingListBuilder() @@ -386,7 +385,7 @@ public class ConvertORTopoToTapiFullTopo { } private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node - createTapiNode(Map nodeNames, List layerProtocols) { + createTapiNode(Map nodeNames, Set layerProtocols) { Uuid nodeUuid = null; Map onepl = new HashMap<>(); Map nodeRuleGroupList = new HashMap<>(); @@ -409,13 +408,13 @@ public class ConvertORTopoToTapiFullTopo { CostCharacteristic costCharacteristic = new CostCharacteristicBuilder() .setCostAlgorithm("Restricted Shortest Path - RSP") .setCostName("HOP_COUNT") - .setCostValue("12345678") + .setCostValue(TapiStringConstants.COST_HOP_VALUE) .build(); LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder() - .setFixedLatencyCharacteristic("12345678") - .setQueingLatencyCharacteristic("12345678") - .setJitterCharacteristic("12345678") - .setWanderCharacteristic("12345678") + .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE) + .setQueingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE) + .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE) + .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE) .setTrafficPropertyName("FIXED_LATENCY") .build(); return new NodeBuilder() @@ -439,19 +438,19 @@ public class ConvertORTopoToTapiFullTopo { } private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node - createRoadmTapiNode(Uuid nodeUuid, Map nameMap, List layerProtocols, + createRoadmTapiNode(Uuid nodeUuid, Map nameMap, Set layerProtocols, Map oneplist) { // Empty random creation of mandatory fields for avoiding errors.... CostCharacteristic costCharacteristic = new CostCharacteristicBuilder() .setCostAlgorithm("Restricted Shortest Path - RSP") .setCostName("HOP_COUNT") - .setCostValue("12345678") + .setCostValue(TapiStringConstants.COST_HOP_VALUE) .build(); LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder() - .setFixedLatencyCharacteristic("12345678") - .setQueingLatencyCharacteristic("12345678") - .setJitterCharacteristic("12345678") - .setWanderCharacteristic("12345678") + .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE) + .setQueingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE) + .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE) + .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE) .setTrafficPropertyName("FIXED_LATENCY") .build(); return new NodeBuilder() @@ -573,18 +572,18 @@ public class ConvertORTopoToTapiFullTopo { CostCharacteristic costCharacteristic = new CostCharacteristicBuilder() .setCostAlgorithm("Restricted Shortest Path - RSP") .setCostName("HOP_COUNT") - .setCostValue("12345678") + .setCostValue(TapiStringConstants.COST_HOP_VALUE) .build(); LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder() - .setFixedLatencyCharacteristic("12345678") - .setQueingLatencyCharacteristic("12345678") - .setJitterCharacteristic("12345678") - .setWanderCharacteristic("12345678") + .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE) + .setQueingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE) + .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE) + .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE) .setTrafficPropertyName("FIXED_LATENCY") .build(); RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder() .setRiskCharacteristicName("risk characteristic") - .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2")) + .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2")) .build(); NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder() .setUuid(new Uuid( @@ -713,18 +712,18 @@ public class ConvertORTopoToTapiFullTopo { CostCharacteristic costCharacteristic = new CostCharacteristicBuilder() .setCostAlgorithm("Restricted Shortest Path - RSP") .setCostName("HOP_COUNT") - .setCostValue("12345678") + .setCostValue(TapiStringConstants.COST_HOP_VALUE) .build(); LatencyCharacteristic latencyCharacteristic = new LatencyCharacteristicBuilder() - .setFixedLatencyCharacteristic("12345678") - .setQueingLatencyCharacteristic("12345678") - .setJitterCharacteristic("12345678") - .setWanderCharacteristic("12345678") + .setFixedLatencyCharacteristic(TapiStringConstants.FIXED_LATENCY_VALUE) + .setQueingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE) + .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE) + .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE) .setTrafficPropertyName("FIXED_LATENCY") .build(); RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder() .setRiskCharacteristicName("risk characteristic") - .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2")) + .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2")) .build(); NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder() .setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count) @@ -796,7 +795,7 @@ public class ConvertORTopoToTapiFullTopo { .getBytes(Charset.forName("UTF-8"))).toString())) .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA) .setName(Map.of(nepName.key(), nepName)) - .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class)) + .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL) .setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName())) @@ -819,7 +818,7 @@ public class ConvertORTopoToTapiFullTopo { TapiStringConstants.MC, tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString())) .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA) .setName(Map.of(nepName1.key(), nepName1)) - .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class)) + .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL) .setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName())) @@ -849,7 +848,7 @@ public class ConvertORTopoToTapiFullTopo { .toString())) .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA) .setName(Map.of(nepName2.key(), nepName2)) - .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class)) + .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL) .setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName())) @@ -946,21 +945,21 @@ public class ConvertORTopoToTapiFullTopo { .build(); } - private List> createSupportedLayerProtocolQualifier(TerminationPoint tp, + private Set> createSupportedLayerProtocolQualifier(TerminationPoint tp, LayerProtocolName lpn) { Set> sclpqSet = new HashSet<>(); - List sicList; org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1 tp1 = tp.augmentation(org.opendaylight.yang.gen.v1.http .org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class); if (tp1 == null) { - return new ArrayList<>(sclpqSet); + return new HashSet<>(sclpqSet); } if (tp1.getTpSupportedInterfaces() == null) { LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue()); - return new ArrayList<>(sclpqSet); + return new HashSet<>(sclpqSet); } - sicList = new ArrayList<>(tp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values()); + Collection sicList = tp1.getTpSupportedInterfaces() + .getSupportedInterfaceCapability().values(); for (SupportedInterfaceCapability sic : sicList) { switch (lpn.getName()) { case "DSR": @@ -1035,7 +1034,7 @@ public class ConvertORTopoToTapiFullTopo { break; } } - return new ArrayList<>(sclpqSet); + return sclpqSet; } private void createTapiTransitionalLinks() { @@ -1043,9 +1042,8 @@ public class ConvertORTopoToTapiFullTopo { Link transiLink = tapiLink.createTapiLink(this.ietfNodeId, tp.getTpId().getValue(), this.ietfNodeId, tp.getTpId().getValue(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR, TapiStringConstants.OTSI, TapiStringConstants.I_ODU, TapiStringConstants.I_OTSI, - "inService", "inService", Arrays.asList(LayerProtocolName.ODU, - LayerProtocolName.PHOTONICMEDIA), - Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()), + "inService", "inService", Set.of(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA), + Set.of(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid); this.tapiLinks.put(transiLink.key(), transiLink); } @@ -1098,8 +1096,8 @@ public class ConvertORTopoToTapiFullTopo { Link tapLink = this.tapiLink.createTapiLink(sourceNode, sourceTp, destNode, destTp, TapiStringConstants.OMS_XPDR_RDM_LINK, sourceNodeQual, destNodeQual, TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA, adminState, - operState, List.of(LayerProtocolName.PHOTONICMEDIA), - List.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid); + operState, Set.of(LayerProtocolName.PHOTONICMEDIA), + Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid); linksToNotConvert.add(link.augmentation(Link1.class).getOppositeLink().getValue()); this.tapiLinks.put(tapLink.key(), tapLink); }