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=268c77de3789e8128d4d99a851b875fc768e5d1e;hb=b3d4257ba36696849b4391f39c4ae904407a72e1;hp=603612eab2b5d5c5d02d0f681149d60b7c6d608f;hpb=8fdc322646abb6603c9d9b928aee7a8a342f60bb;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..268c77de3 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 @@ -7,18 +7,22 @@ */ package org.opendaylight.transportpce.tapi.topology; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.tapi.R2RTapiLinkDiscovery; @@ -63,6 +67,11 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.glob import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePoint; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePointBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePointKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.OwnedNodeEdgePoint1; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.OwnedNodeEdgePoint1Builder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.cep.list.ConnectionEndPoint; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.cep.list.ConnectionEndPointBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.cep.list.ConnectionEndPointKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.Connection; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionKey; @@ -72,9 +81,17 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18121 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPoint; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.EndPointKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepList; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPEGigE; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU0; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E; @@ -83,6 +100,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROTSi; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.ForwardingRule; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.NodeEdgePointRef; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.RuleType; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.NodeRuleGroup; @@ -103,6 +121,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.no import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristic; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.risk.parameter.pac.RiskCharacteristicBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder; @@ -115,6 +134,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.tr import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristic; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.transfer.timing.pac.LatencyCharacteristicBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.Notification; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; @@ -124,18 +144,21 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { private static final Logger LOG = LoggerFactory.getLogger(TapiNetworkModelServiceImpl.class); private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER - .getBytes(Charset.forName("UTF-8"))).toString()); + .getBytes(StandardCharsets.UTF_8)).toString()); private final NetworkTransactionService networkTransactionService; private Map sipMap; private final R2RTapiLinkDiscovery linkDiscovery; private final TapiLink tapiLink; + private final NotificationPublishService notificationPublishService; public TapiNetworkModelServiceImpl(final R2RTapiLinkDiscovery linkDiscovery, - NetworkTransactionService networkTransactionService, TapiLink tapiLink) { + NetworkTransactionService networkTransactionService, TapiLink tapiLink, + final NotificationPublishService notificationPublishService) { this.networkTransactionService = networkTransactionService; this.sipMap = new HashMap<>(); this.linkDiscovery = linkDiscovery; this.tapiLink = tapiLink; + this.notificationPublishService = notificationPublishService; } @Override @@ -226,19 +249,187 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { // Device not managed yet } + @Override + public void updateTapiTopology(String nodeId, Mapping mapping) { + List uuids = getChangedNodeUuids(nodeId, mapping); + + List changedOneps = updateNeps(mapping, uuids); + updateLinks(changedOneps, mapping); + sendNotification(changedOneps, mapping); + + LOG.info("Updated TAPI topology successfully."); + } + + @SuppressWarnings("rawtypes") + private void sendNotification(List changedOneps, Mapping mapping) { + Notification notification = new NotificationBuilder() + .setNotificationType(NotificationType.ATTRIBUTEVALUECHANGE) + .setTargetObjectType(ObjectType.NODEEDGEPOINT) + .setChangedAttributes(getChangedAttributes(changedOneps, mapping)) + .setUuid(tapiTopoUuid) + .build(); + try { + notificationPublishService.putNotification(notification); + } catch (InterruptedException e) { + LOG.error("Could not send notification"); + } + } + + private Map getChangedAttributes(List changedOneps, + Mapping mapping) { + Map changedAttributes = new HashMap<>(); + for (Uuid nep : changedOneps) { + changedAttributes.put(new ChangedAttributesKey(nep.getValue()), + new ChangedAttributesBuilder().setValueName(nep.getValue()) + .setOldValue(mapping.getPortOperState().equals("InService") ? "OutOfService" : "InService") + .setNewValue(mapping.getPortOperState()) + .build()); + } + return changedAttributes; + } + + private void updateLinks(List changedOneps, Mapping mapping) { + try { + InstanceIdentifier topoIID = InstanceIdentifier.builder(Context.class) + .augmentation(Context1.class).child(TopologyContext.class) + .child(Topology.class, new TopologyKey(tapiTopoUuid)) + .build(); + Optional optTopology = this.networkTransactionService + .read(LogicalDatastoreType.OPERATIONAL, topoIID).get(); + if (optTopology.isEmpty()) { + LOG.error("Could not update TAPI links"); + return; + } + for (Link link : optTopology.get().nonnullLink().values()) { + List linkNeps = Objects.requireNonNull(link.getNodeEdgePoint()).values().stream() + .map(NodeEdgePointRef::getNodeEdgePointUuid).collect(Collectors.toList()); + if (!Collections.disjoint(changedOneps, linkNeps)) { + InstanceIdentifier linkIID = InstanceIdentifier.builder(Context.class) + .augmentation(Context1.class).child(TopologyContext.class) + .child(Topology.class, new TopologyKey(tapiTopoUuid)) + .child(Link.class, new LinkKey(link.getUuid())).build(); + Link linkblr = new LinkBuilder().setUuid(link.getUuid()) + .setAdministrativeState(transformAdminState(mapping.getPortAdminState())) + .setOperationalState(transformOperState(mapping.getPortOperState())).build(); + this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, linkIID, linkblr); + } + } + this.networkTransactionService.commit().get(); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Could not update TAPI links"); + } + } + + private List updateNeps(Mapping mapping, List uuids) { + List changedOneps = new ArrayList<>(); + for (Uuid nodeUuid : uuids) { + try { + InstanceIdentifier nodeIID = InstanceIdentifier.builder(Context.class) + .augmentation(Context1.class).child(TopologyContext.class) + .child(Topology.class, new TopologyKey(tapiTopoUuid)).child(Node.class, new NodeKey(nodeUuid)) + .build(); + Optional optionalNode = this.networkTransactionService.read( + LogicalDatastoreType.OPERATIONAL, nodeIID).get(); + if (optionalNode.isPresent()) { + Node node = optionalNode.get(); + List oneps = node.getOwnedNodeEdgePoint().values().stream() + .filter(onep -> ((Name) onep.getName().values().toArray()[0]).getValue() + .contains(mapping.getLogicalConnectionPoint())).collect(Collectors.toList()); + for (OwnedNodeEdgePoint onep : oneps) { + changedOneps.add(onep.getUuid()); + updateSips(mapping, onep); + CepList cepList = getUpdatedCeps(mapping, onep); + InstanceIdentifier onepIID = InstanceIdentifier.builder(Context.class) + .augmentation(Context1.class).child(TopologyContext.class) + .child(Topology.class, new TopologyKey(tapiTopoUuid)) + .child(Node.class, new NodeKey(nodeUuid)) + .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(onep.getUuid())) + .build(); + OwnedNodeEdgePoint onepblr = new OwnedNodeEdgePointBuilder().setUuid(onep.getUuid()) + .addAugmentation(new OwnedNodeEdgePoint1Builder().setCepList(cepList).build()) + .setAdministrativeState(transformAdminState(mapping.getPortAdminState())) + .setOperationalState(transformOperState(mapping.getPortOperState())).build(); + this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, onepIID, onepblr); + } + this.networkTransactionService.commit().get(); + } + } catch (InterruptedException | ExecutionException e) { + LOG.error("Could not update TAPI NEP"); + } + } + return changedOneps; + } + + private CepList getUpdatedCeps(Mapping mapping, OwnedNodeEdgePoint onep) { + OwnedNodeEdgePoint1 onep1 = onep.augmentation(OwnedNodeEdgePoint1.class); + Map cepMap = new HashMap<>(); + if (onep1 != null && onep1.getCepList() != null && onep1.getCepList().getConnectionEndPoint() != null) { + for (Map.Entry entry : onep1.getCepList().getConnectionEndPoint() + .entrySet()) { + ConnectionEndPoint cep = new ConnectionEndPointBuilder(entry.getValue()) + .setOperationalState(transformOperState(mapping.getPortOperState())).build(); + cepMap.put(entry.getKey(), cep); + } + } + return new CepListBuilder().setConnectionEndPoint(cepMap).build(); + } + + private List getChangedNodeUuids(String nodeId, Mapping mapping) { + List uuids = new ArrayList<>(); + if (nodeId.contains("ROADM")) { + uuids.add(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA)) + .getBytes(StandardCharsets.UTF_8)).toString())); + } else if (nodeId.contains("PDR") && mapping.getLogicalConnectionPoint().contains("CLIENT")) { + int xpdrNb = Integer.parseInt(mapping.getLogicalConnectionPoint().split("XPDR")[1].split("-")[0]); + String xpdrNodeId = nodeId + TapiStringConstants.XPDR + xpdrNb; + uuids.add(new Uuid(UUID.nameUUIDFromBytes((String.join("+", xpdrNodeId, TapiStringConstants.DSR)) + .getBytes(StandardCharsets.UTF_8)).toString())); + } else if (nodeId.contains("PDR") && mapping.getLogicalConnectionPoint().contains("NETWORK")) { + int xpdrNb = Integer.parseInt(mapping.getLogicalConnectionPoint().split("XPDR")[1].split("-")[0]); + String xpdrNodeId = nodeId + TapiStringConstants.XPDR + xpdrNb; + uuids.add(new Uuid(UUID.nameUUIDFromBytes((String.join("+", xpdrNodeId, TapiStringConstants.DSR)) + .getBytes(StandardCharsets.UTF_8)).toString())); + uuids.add(new Uuid(UUID.nameUUIDFromBytes((String.join("+", xpdrNodeId, TapiStringConstants.OTSI)) + .getBytes(StandardCharsets.UTF_8)).toString())); + } else { + LOG.error("Updating this device is currently not supported"); + return uuids; + } + return uuids; + } + + private void updateSips(Mapping mapping, OwnedNodeEdgePoint onep) { + if (onep.getMappedServiceInterfacePoint() == null + || onep.getMappedServiceInterfacePoint().size() == 0) { + return; + } + for (MappedServiceInterfacePoint msip : onep.getMappedServiceInterfacePoint().values()) { + InstanceIdentifier sipIID = InstanceIdentifier + .builder(Context.class) + .child(ServiceInterfacePoint.class, + new ServiceInterfacePointKey(msip.getServiceInterfacePointUuid())) + .build(); + ServiceInterfacePoint sipblr = new ServiceInterfacePointBuilder() + .setUuid(msip.getServiceInterfacePointUuid()) + .setAdministrativeState(transformAdminState(mapping.getPortAdminState())) + .setOperationalState(transformOperState(mapping.getPortOperState())).build(); + this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, sipIID, sipblr); + } + + } + private Map transformXpdrToTapiNode(String nodeId, List xpdrClMaps, List xpdrNetMaps, XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) { Map nodeMap = new HashMap<>(); LOG.info("creation of a DSR/ODU node for {}", nodeId); Uuid nodeUuidDsr = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.DSR)) - .getBytes(Charset.forName("UTF-8"))).toString()); + .getBytes(StandardCharsets.UTF_8)).toString()); Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue( 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); @@ -247,10 +438,10 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { // node creation [otsi] LOG.info("creation of an OTSi node for {}", nodeId); Uuid nodeUuidOtsi = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.OTSI)) - .getBytes(Charset.forName("UTF-8"))).toString()); + .getBytes(StandardCharsets.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); @@ -258,8 +449,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { // transitional link cration between network nep of DSR/ODU node and iNep of otsi node LOG.info("creation of transitional links between DSR/ODU and OTSi nodes"); - Map linkMap = createTapiTransitionalLinks(nodeId, xpdrNetMaps, nodeUuidDsr, - nodeUuidOtsi); + Map linkMap = createTapiTransitionalLinks(nodeId, xpdrNetMaps); mergeLinkinTopology(linkMap); return nodeMap; @@ -368,7 +558,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { if (nodeId.contains("ROADM")) { // Node is in photonic media layer and UUID can be built from nodeId + PHTN_MEDIA Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, - TapiStringConstants.PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString()); + TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8)).toString()); deleteNodeFromTopo(nodeUuid); } if (nodeId.contains("XPDR") || nodeId.contains("SPDR") || nodeId.contains("MXPDR")) { @@ -419,7 +609,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<>(); @@ -451,13 +641,13 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { 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() @@ -488,15 +678,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { for (int i = 0; i < xpdrNetMaps.size(); i++) { Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.I_OTSI, - xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString()); + xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString()); Name onedName = new NameBuilder() .setValueName("iNodeEdgePoint") .setValue(String.join("+", nodeId, TapiStringConstants.I_OTSI, xpdrNetMaps.get(i).getLogicalConnectionPoint())) .build(); - List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + List newSupIfCapList = + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, @@ -509,15 +699,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { for (int i = 0; i < xpdrNetMaps.size(); i++) { Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.E_OTSI, - xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString()); + xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString()); Name onedName = new NameBuilder() .setValueName("eNodeEdgePoint") .setValue(String.join("+", nodeId, TapiStringConstants.E_OTSI, xpdrNetMaps.get(i).getLogicalConnectionPoint())) .build(); - List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + List newSupIfCapList = + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, @@ -530,15 +720,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { for (int i = 0; i < xpdrNetMaps.size(); i++) { Uuid nepUuid3 = new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA, - xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString()); + xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString()); Name onedName = new NameBuilder() .setValueName("PhotMedNodeEdgePoint") .setValue(String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA, xpdrNetMaps.get(i).getLogicalConnectionPoint())) .build(); - List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + List newSupIfCapList = + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, @@ -560,7 +750,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { xpdrClMaps.get(i).getLogicalConnectionPoint())); Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.DSR, - xpdrClMaps.get(i).getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString()); + xpdrClMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString()); NameBuilder nameBldr = new NameBuilder().setValue(String.join("+", nodeId, TapiStringConstants.DSR, xpdrClMaps.get(i).getLogicalConnectionPoint())); Name name; @@ -570,8 +760,8 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { name = nameBldr.setValueName("NodeEdgePoint_C").build(); } - List> newSupIfCapList = - xpdrClMaps.get(i).getSupportedInterfaceCapability(); + List newSupIfCapList = + new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(), Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true, @@ -586,15 +776,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { xpdrNetMaps.get(i).getLogicalConnectionPoint())); Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.I_ODU, - xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString()); + xpdrNetMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString()); Name onedName = new NameBuilder() .setValueName("iNodeEdgePoint_N") .setValue(String.join("+", nodeId, TapiStringConstants.I_ODU, xpdrNetMaps.get(i).getLogicalConnectionPoint())) .build(); - List> newSupIfCapList = - xpdrNetMaps.get(i).getSupportedInterfaceCapability(); + List newSupIfCapList = + new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), @@ -610,15 +800,15 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { xpdrClMaps.get(i).getLogicalConnectionPoint())); Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.E_ODU, - xpdrClMaps.get(i).getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString()); + xpdrClMaps.get(i).getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString()); Name onedName = new NameBuilder() .setValueName("eNodeEdgePoint_N") .setValue(String.join("+", nodeId, TapiStringConstants.E_ODU, xpdrClMaps.get(i).getLogicalConnectionPoint())) .build(); - List> newSupIfCapList = - xpdrClMaps.get(i).getSupportedInterfaceCapability(); + List newSupIfCapList = + new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability()); OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(), Map.of(onedName.key(), onedName), @@ -645,7 +835,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { private OwnedNodeEdgePoint createNep(Uuid nepUuid, String tpid, Map nepNames, LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword, - List> supportedInterfaceCapability, + List supportedInterfaceCapability, OperationalState operState, AdministrativeState adminState) { OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder() .setUuid(nepUuid) @@ -671,7 +861,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { Map onepMap = new HashMap<>(); // PHOTONIC MEDIA nep Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, - TapiStringConstants.PHTNC_MEDIA, tpId)).getBytes(Charset.forName("UTF-8"))).toString()); + TapiStringConstants.PHTNC_MEDIA, tpId)).getBytes(StandardCharsets.UTF_8)).toString()); Name nepName = new NameBuilder() .setValueName(TapiStringConstants.PHTNC_MEDIA + "NodeEdgePoint") .setValue(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA, tpId)) @@ -680,7 +870,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.VALUE)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(adminState).setOperationalState(operState) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -690,7 +880,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { // MC nep Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, - TapiStringConstants.MC, tpId)).getBytes(Charset.forName("UTF-8"))).toString()); + TapiStringConstants.MC, tpId)).getBytes(StandardCharsets.UTF_8)).toString()); Name nepName1 = new NameBuilder() .setValueName(TapiStringConstants.MC + "NodeEdgePoint") .setValue(String.join("+", orNodeId, TapiStringConstants.MC, tpId)) @@ -699,7 +889,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.VALUE)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(adminState).setOperationalState(operState) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -714,7 +904,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { // OTSiMC nep Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, TapiStringConstants.OTSI_MC, - tpId)).getBytes(Charset.forName("UTF-8"))).toString()); + tpId)).getBytes(StandardCharsets.UTF_8)).toString()); Name nepName2 = new NameBuilder() .setValueName(TapiStringConstants.OTSI_MC + "NodeEdgePoint") .setValue(String.join("+", orNodeId, TapiStringConstants.OTSI_MC, tpId)) @@ -724,7 +914,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.VALUE)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(adminState).setOperationalState(operState) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -736,12 +926,12 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { private Map createMSIP(int nb, LayerProtocolName layerProtocol, String tpid, String nodeid, - List> supportedInterfaceCapability, + List supportedInterfaceCapability, OperationalState operState, AdministrativeState adminState) { Map msipl = new HashMap<>(); for (int i = 0; i < nb; i++) { Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeid, - tpid)).getBytes(Charset.forName("UTF-8"))).toString()); + tpid)).getBytes(StandardCharsets.UTF_8)).toString()); MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder() .setServiceInterfacePointUuid(sipUuid).build(); ServiceInterfacePoint sip = createSIP(sipUuid, layerProtocol, tpid, nodeid, supportedInterfaceCapability, @@ -755,7 +945,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { } private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpid, String nodeid, - List> supportedInterfaceCapability, + List supportedInterfaceCapability, OperationalState operState, AdministrativeState adminState) { // TODO: what value should be set in total capacity and available capacity LOG.info("SIP name = {}", String.join("+", nodeid, tpid)); @@ -780,25 +970,25 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { private Node createRoadmTapiNode(String orNodeId, Map oneplist) { // UUID Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", orNodeId, - TapiStringConstants.PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString()); + TapiStringConstants.PHTNC_MEDIA)).getBytes(StandardCharsets.UTF_8)).toString()); // Names Name nodeNames = new NameBuilder().setValueName("roadm node name") .setValue(String.join("+", orNodeId, TapiStringConstants.PHTNC_MEDIA)).build(); 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") .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.COST_HOP_VALUE) + .setQueingLatencyCharacteristic(TapiStringConstants.QUEING_LATENCY_VALUE) + .setJitterCharacteristic(TapiStringConstants.JITTER_VALUE) + .setWanderCharacteristic(TapiStringConstants.WANDER_VALUE) .setTrafficPropertyName("FIXED_LATENCY") .build(); return new NodeBuilder() @@ -843,7 +1033,7 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { ruleList.put(rule.key(), rule); NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder() .setUuid(new Uuid(UUID.nameUUIDFromBytes((orNodeId + " node rule group") - .getBytes(Charset.forName("UTF-8"))).toString())) + .getBytes(StandardCharsets.UTF_8)).toString())) .setRule(ruleList) .setNodeEdgePoint(nepMap) .build(); @@ -851,16 +1041,14 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { return nodeRuleGroupMap; } - private Map createTapiTransitionalLinks(String nodeId, List xpdrNetMaps, Uuid nodeUuidDsr, - Uuid nodeUuidOtsi) { + private Map createTapiTransitionalLinks(String nodeId, List xpdrNetMaps) { Map linkMap = new HashMap<>(); for (Mapping mapping : xpdrNetMaps) { 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 +1064,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 +1082,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 +1109,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"); @@ -952,18 +1140,18 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { NodeEdgePoint inep = new NodeEdgePointBuilder() .setTopologyUuid(this.tapiTopoUuid) .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, - TapiStringConstants.OTSI)).getBytes(Charset.forName("UTF-8"))).toString())) + TapiStringConstants.OTSI)).getBytes(StandardCharsets.UTF_8)).toString())) .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, TapiStringConstants.I_OTSI, tpMapping.getLogicalConnectionPoint())) - .getBytes(Charset.forName("UTF-8"))).toString())) + .getBytes(StandardCharsets.UTF_8)).toString())) .build(); NodeEdgePoint enep = new NodeEdgePointBuilder() .setTopologyUuid(this.tapiTopoUuid) .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, - TapiStringConstants.OTSI)).getBytes(Charset.forName("UTF-8"))).toString())) + TapiStringConstants.OTSI)).getBytes(StandardCharsets.UTF_8)).toString())) .setNodeEdgePointUuid(new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId, TapiStringConstants.E_OTSI, - tpMapping.getLogicalConnectionPoint())).getBytes(Charset.forName("UTF-8"))).toString())) + tpMapping.getLogicalConnectionPoint())).getBytes(StandardCharsets.UTF_8)).toString())) .build(); nepList.put(inep.key(), inep); nepList.put(enep.key(), enep); @@ -971,22 +1159,22 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { 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(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8"))) + UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(StandardCharsets.UTF_8)) .toString())) .setRule(ruleList) .setNodeEdgePoint(nepList) @@ -1020,23 +1208,23 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { LOG.info("EDOU TP = {}", String.join("+", nodeId, TapiStringConstants.E_ODU, tp.getValue())); LOG.info("DSR TP = {}", String.join("+", nodeId, TapiStringConstants.DSR, tp.getValue())); Uuid tpUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, - TapiStringConstants.E_ODU, tp.getValue())).getBytes(Charset.forName("UTF-8"))).toString()); + TapiStringConstants.E_ODU, tp.getValue())).getBytes(StandardCharsets.UTF_8)).toString()); Uuid tp1Uuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, - TapiStringConstants.DSR, tp.getValue())).getBytes(Charset.forName("UTF-8"))).toString()); + TapiStringConstants.DSR, tp.getValue())).getBytes(StandardCharsets.UTF_8)).toString()); if (onepl.containsKey(new OwnedNodeEdgePointKey(tpUuid)) && onepl.containsKey(new OwnedNodeEdgePointKey(tp1Uuid))) { NodeEdgePoint nep1 = new NodeEdgePointBuilder() .setTopologyUuid(this.tapiTopoUuid) .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId,TapiStringConstants. DSR)) - .getBytes(Charset.forName("UTF-8"))).toString())) + .getBytes(StandardCharsets.UTF_8)).toString())) .setNodeEdgePointUuid(tp1Uuid) .build(); NodeEdgePoint nep2 = new NodeEdgePointBuilder() .setTopologyUuid(this.tapiTopoUuid) .setNodeUuid(new Uuid(UUID.nameUUIDFromBytes( (String.join("+", nodeId,TapiStringConstants. DSR)) - .getBytes(Charset.forName("UTF-8"))).toString())) + .getBytes(StandardCharsets.UTF_8)).toString())) .setNodeEdgePointUuid(tpUuid) .build(); nepList.put(nep1.key(), nep1); @@ -1047,22 +1235,22 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { 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).getBytes(Charset.forName("UTF-8"))) + UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(StandardCharsets.UTF_8)) .toString())) .setRule(ruleList) .setNodeEdgePoint(nepList) @@ -1076,52 +1264,53 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { return nodeRuleGroupMap; } - private List> createSupportedLayerProtocolQualifier( - List> sicList, LayerProtocolName lpn) { + private Set createSupportedLayerProtocolQualifier( + List sicList, LayerProtocolName lpn) { if (sicList == null) { - return List.of(PHOTONICLAYERQUALIFIEROMS.class); + return Set.of(PHOTONICLAYERQUALIFIEROMS.VALUE); } Map supIfMap = new HashMap<>(); LOG.info("SIC list = {}", sicList); - for (Class supInterCapa : sicList) { + for (SupportedIfCapability supInterCapa : sicList) { SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder() .withKey(new SupportedInterfaceCapabilityKey(supInterCapa)) .setIfCapType(supInterCapa) .build(); supIfMap.put(supIfCapa.key(), supIfCapa); } - List> sclpqList = new ArrayList<>(); + Set sclpqList = new HashSet<>(); for (SupportedInterfaceCapability sic : supIfMap.values()) { + String ifCapType = sic.getIfCapType().toString().split("\\{")[0]; switch (lpn.getName()) { case "DSR": - switch (sic.getIfCapType().getSimpleName()) { + switch (ifCapType) { // TODO: it may be needed to add more cases clauses if the interface capabilities of a // port are extended in the config file case "If1GEODU0": - sclpqList.add(ODUTYPEODU0.class); - sclpqList.add(DIGITALSIGNALTYPEGigE.class); + sclpqList.add(ODUTYPEODU0.VALUE); + sclpqList.add(DIGITALSIGNALTYPEGigE.VALUE); break; case "If10GEODU2e": - sclpqList.add(ODUTYPEODU2E.class); - sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class); + sclpqList.add(ODUTYPEODU2E.VALUE); + sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE); break; case "If10GEODU2": - sclpqList.add(ODUTYPEODU2.class); - sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class); + sclpqList.add(ODUTYPEODU2.VALUE); + sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE); break; case "If10GE": - sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class); + sclpqList.add(DIGITALSIGNALTYPE10GigELAN.VALUE); break; case "If100GEODU4": - sclpqList.add(DIGITALSIGNALTYPE100GigE.class); - sclpqList.add(ODUTYPEODU4.class); + sclpqList.add(DIGITALSIGNALTYPE100GigE.VALUE); + sclpqList.add(ODUTYPEODU4.VALUE); break; case "If100GE": - sclpqList.add(DIGITALSIGNALTYPE100GigE.class); + sclpqList.add(DIGITALSIGNALTYPE100GigE.VALUE); break; case "IfOCHOTU4ODU4": case "IfOCH": - sclpqList.add(ODUTYPEODU4.class); + sclpqList.add(ODUTYPEODU4.VALUE); break; default: LOG.error("IfCapability type not managed"); @@ -1129,24 +1318,24 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { } break; case "ODU": - switch (sic.getIfCapType().getSimpleName()) { + switch (ifCapType) { // TODO: it may be needed to add more cases clauses if the interface capabilities of a // port are extended in the config file case "If1GEODU0": - sclpqList.add(ODUTYPEODU0.class); + sclpqList.add(ODUTYPEODU0.VALUE); break; case "If10GEODU2e": - sclpqList.add(ODUTYPEODU2E.class); + sclpqList.add(ODUTYPEODU2E.VALUE); break; case "If10GEODU2": case "If10GE": - sclpqList.add(ODUTYPEODU2.class); + sclpqList.add(ODUTYPEODU2.VALUE); break; case "If100GEODU4": case "If100GE": case "IfOCHOTU4ODU4": case "IfOCH": - sclpqList.add(ODUTYPEODU4.class); + sclpqList.add(ODUTYPEODU4.VALUE); break; default: LOG.error("IfCapability type not managed"); @@ -1154,10 +1343,9 @@ public class TapiNetworkModelServiceImpl implements TapiNetworkModelService { } break; case "PHOTONIC_MEDIA": - if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4") - || sic.getIfCapType().getSimpleName().equals("IfOCH")) { - sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.class); - sclpqList.add(PHOTONICLAYERQUALIFIEROMS.class); + if (ifCapType.equals("IfOCHOTU4ODU4") || ifCapType.equals("IfOCH")) { + sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.VALUE); + sclpqList.add(PHOTONICLAYERQUALIFIEROMS.VALUE); } break; default: