X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftapi%2Ftopology%2FTapiNetworkModelServiceImpl.java;h=c41b17b3ddc8a8b59000f079125d24e7be0af134;hb=refs%2Fchanges%2F46%2F100646%2F27;hp=603612eab2b5d5c5d02d0f681149d60b7c6d608f;hpb=211dacfed540c8ddbf552c229c74b6054b185720;p=transportpce.git diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiNetworkModelServiceImpl.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiNetworkModelServiceImpl.java index 603612eab..c41b17b3d 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiNetworkModelServiceImpl.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiNetworkModelServiceImpl.java @@ -9,13 +9,14 @@ 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.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; @@ -237,8 +238,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { String.join("+", nodeId, TapiStringConstants.DSR)).build(); Name nameNodeType = new NameBuilder().setValueName("Node Type") .setValue(getNodeType(xponderType)).build(); - List dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, - LayerProtocolName.ODU); + Set dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU); Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr, nameNodeType.key(), nameNodeType), dsrLayerProtocols, nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool); @@ -250,7 +250,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .getBytes(Charset.forName("UTF-8"))).toString()); Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue( String.join("+", nodeId, TapiStringConstants.OTSI)).build(); - List otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); + Set otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA); Node otsiNode = createTapiXpdrNode(Map.of(nameOtsi.key(), nameOtsi, nameNodeType.key(), nameNodeType), otsiLayerProtocols, nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null); @@ -419,7 +419,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { } } - private Node createTapiXpdrNode(Map nameMap, List layerProtocols, + private Node createTapiXpdrNode(Map nameMap, Set layerProtocols, String nodeId, Uuid nodeUuid, List xpdrClMaps, List xpdrNetMaps, XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) { Map onepl = new HashMap<>(); @@ -496,7 +496,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .build(); List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, @@ -517,7 +517,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .build(); List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, @@ -538,7 +538,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .build(); List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, @@ -571,7 +571,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { } List> newSupIfCapList = - xpdrClMaps.get(i).getSupportedInterfaceCapability(); + new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(), Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true, @@ -594,7 +594,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .build(); List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), @@ -618,7 +618,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .build(); List> newSupIfCapList = - xpdrClMaps.get(i).getSupportedInterfaceCapability(); + new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), @@ -680,7 +680,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .setUuid(nepUuid) .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(adminState).setOperationalState(operState) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -699,7 +699,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .setUuid(nepUuid1) .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(adminState).setOperationalState(operState) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -724,7 +724,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .setUuid(nepUuid2) .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(adminState).setOperationalState(operState) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -787,7 +787,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { Name nameNodeType = new NameBuilder().setValueName("Node Type") .setValue(OpenroadmNodeType.ROADM.getName()).build(); // Protocol Layer - List layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); + Set layerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA); // Empty random creation of mandatory fields for avoiding errors.... CostCharacteristic costCharacteristic = new CostCharacteristicBuilder() .setCostAlgorithm("Restricted Shortest Path - RSP") @@ -858,9 +858,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { Link transiLink = tapiLink.createTapiLink(nodeId, mapping.getLogicalConnectionPoint(), nodeId, mapping.getLogicalConnectionPoint(), 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); linkMap.put(transiLink.key(), transiLink); } @@ -876,7 +875,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { LOG.info("XPDr net associated LCP = {}", xpdrNetMaps.get(i - 1).getConnectionMapLcp()); TpId tpid1 = new TpId(xpdrNetMaps.get(i - 1).getLogicalConnectionPoint()); TpId tpid2 = new TpId(xpdrNetMaps.get(i - 1).getConnectionMapLcp()); - List tpList = new ArrayList<>(); + Set tpList = new HashSet<>(); tpList.add(tpid1); tpList.add(tpid2); NonBlockingList nbl = new NonBlockingListBuilder() @@ -894,7 +893,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { private OduSwitchingPools createSwtchSwitchPool(List xpdrClMaps, List xpdrNetMaps, Integer xpdrNb) { - List tpl = new ArrayList<>(); + Set tpl = new HashSet<>(); TpId tpId = null; for (int i = 1; i <= xpdrClMaps.size(); i++) { tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i); @@ -921,7 +920,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { private OduSwitchingPools createMuxSwitchPool(List xpdrClMaps, List xpdrNetMaps, Integer xpdrNb) { Map nbMap = new HashMap<>(); for (int i = 1; i <= xpdrClMaps.size(); i++) { - List tpList = new ArrayList<>(); + Set tpList = new HashSet<>(); TpId tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i); tpList.add(tpId); tpId = new TpId("XPDR" + xpdrNb + "-NETWORK1"); @@ -982,7 +981,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .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( @@ -1058,7 +1057,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .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( @@ -1076,10 +1075,10 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { return nodeRuleGroupMap; } - private List> createSupportedLayerProtocolQualifier( + private Set> createSupportedLayerProtocolQualifier( List> sicList, LayerProtocolName lpn) { if (sicList == null) { - return List.of(PHOTONICLAYERQUALIFIEROMS.class); + return Set.of(PHOTONICLAYERQUALIFIEROMS.class); } Map supIfMap = new HashMap<>(); LOG.info("SIC list = {}", sicList); @@ -1090,7 +1089,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { .build(); supIfMap.put(supIfCapa.key(), supIfCapa); } - List> sclpqList = new ArrayList<>(); + Set> sclpqList = new HashSet<>(); for (SupportedInterfaceCapability sic : supIfMap.values()) { switch (lpn.getName()) { case "DSR":