import java.math.RoundingMode;
import java.nio.charset.Charset;
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.Set;
+import java.util.TreeMap;
import java.util.UUID;
import java.util.stream.Collectors;
import org.opendaylight.transportpce.common.fixedflex.GridConstant;
+import org.opendaylight.transportpce.common.fixedflex.GridUtils;
import org.opendaylight.transportpce.tapi.TapiStringConstants;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev230526.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.degree.rev230526.degree.used.wavelengths.UsedWavelengths;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.degree.rev230526.degree.used.wavelengths.UsedWavelengthsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.networks.network.node.termination.point.PpAttributes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.networks.network.node.termination.point.TxTtpAttributes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.networks.network.node.termination.point.XpdrNetworkAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPools;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev230526.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.AdministrativeState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.CAPACITYUNITGBPS;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Direction;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LAYERPROTOCOLQUALIFIER;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LifecycleState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.OperationalState;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.AvailableSpectrum;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.AvailableSpectrumBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.AvailableSpectrumKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.OccupiedSpectrum;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.OccupiedSpectrumBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.OccupiedSpectrumKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.SupportableSpectrum;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.SupportableSpectrumBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121.spectrum.capability.pac.SupportableSpectrumKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULE;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULECANNOTFORWARDACROSSGROUP;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.FORWARDINGRULEMAYFORWARDACROSSGROUP;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.RuleType;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.inter.rule.group.AssociatedNodeRuleGroup;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.inter.rule.group.AssociatedNodeRuleGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.inter.rule.group.AssociatedNodeRuleGroupKey;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroup;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.InterRuleGroupKey;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroup;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.NodeRuleGroupKey;
public class ConvertORToTapiTopology {
private static final Logger LOG = LoggerFactory.getLogger(ConvertORToTapiTopology.class);
+ private static final TreeMap<Integer, String> OPMODE_LOOPRATE_MAP;
+ private static final int OPMODE_LOOPRATE_MAX;
+ private static final Map<String, Map<String, Map<LAYERPROTOCOLQUALIFIER, Uint64>>> LPN_MAP;
private String ietfNodeId;
private OpenroadmNodeType ietfNodeType;
private AdminStates ietfNodeAdminState;
private Map<ServiceInterfacePointKey, ServiceInterfacePoint> tapiSips;
private Map<String, Uuid> uuidMap;
+ static {
+ OPMODE_LOOPRATE_MAP = new TreeMap<>(Comparator.reverseOrder());
+ OPMODE_LOOPRATE_MAP.putAll(Map.of(8, "800G", 6, "600G" , 4, "400G" , 3, "300G" , 2, "200G" , 1, "100G"));
+ OPMODE_LOOPRATE_MAX = Collections.max(OPMODE_LOOPRATE_MAP.keySet());
+ LPN_MAP = new HashMap<>(Map.of(
+ "ETH", new HashMap<>(Map.of(
+ "If1GEODU0", Map.of(
+ ODUTYPEODU0.VALUE, Uint64.valueOf(0), DIGITALSIGNALTYPEGigE.VALUE, Uint64.valueOf(0)),
+ "If10GEODU2e", Map.of(
+ ODUTYPEODU2E.VALUE, Uint64.valueOf(0), DIGITALSIGNALTYPE10GigELAN.VALUE, Uint64.valueOf(0)),
+ "If10GEODU2", Map.of(
+ ODUTYPEODU2.VALUE, Uint64.valueOf(0), DIGITALSIGNALTYPE10GigELAN.VALUE, Uint64.valueOf(0)),
+ "If10GE", Map.of(DIGITALSIGNALTYPE10GigELAN.VALUE, Uint64.valueOf(0)),
+ "If100GEODU4", Map.of(
+ ODUTYPEODU4.VALUE, Uint64.valueOf(0), DIGITALSIGNALTYPE100GigE.VALUE, Uint64.valueOf(0)),
+ "If100GE", Map.of(DIGITALSIGNALTYPE100GigE.VALUE, Uint64.valueOf(0)),
+ "IfOCH", Map.of(ODUTYPEODU4.VALUE, Uint64.valueOf(0)))),
+ "ODU", new HashMap<>(Map.of(
+ "If1GEODU0", Map.of(ODUTYPEODU0.VALUE, Uint64.valueOf(0)),
+ "If10GEODU2e", Map.of(ODUTYPEODU2E.VALUE, Uint64.valueOf(0)),
+ "If10GEODU2", Map.of(ODUTYPEODU2.VALUE, Uint64.valueOf(0)),
+ "If100GEODU4", Map.of(ODUTYPEODU4.VALUE, Uint64.valueOf(0)))),
+ "PHOTONIC_MEDIA", new HashMap<>(Map.of(
+ "IfOCHOTUCnODUCn",
+ Map.of(ODUTYPEODUCN.VALUE, Uint64.valueOf(1), OTUTYPEOTUCN.VALUE, Uint64.valueOf(1)),
+ "IfOCH",
+ Map.of(ODUTYPEODUCN.VALUE, Uint64.valueOf(1), OTUTYPEOTUCN.VALUE, Uint64.valueOf(1),
+ PHOTONICLAYERQUALIFIEROTSiMC.VALUE, Uint64.valueOf(1),
+ PHOTONICLAYERQUALIFIEROTS.VALUE, Uint64.valueOf(1))))));
+ LPN_MAP.get("ETH").put("IfOCHOTU4ODU4", LPN_MAP.get("ETH").get("IfOCH"));
+ LPN_MAP.put("DSR", LPN_MAP.get("ETH"));
+ LPN_MAP.get("ODU").put("If10GE", LPN_MAP.get("ODU").get("If10GEODU2"));
+ LPN_MAP.get("ODU").put("If100GE", LPN_MAP.get("ODU").get("If100GEODU4"));
+ LPN_MAP.get("ODU").put("IfOCHOTU4ODU4", LPN_MAP.get("ODU").get("If100GEODU4"));
+ LPN_MAP.get("ODU").put("IfOCH", LPN_MAP.get("ODU").get("If100GEODU4"));
+ LPN_MAP.get("PHOTONIC_MEDIA").put("IfOtsiOtucnOducn", LPN_MAP.get("PHOTONIC_MEDIA").get("IfOCHOTUCnODUCn"));
+ LPN_MAP.get("PHOTONIC_MEDIA").put("IfOCHOTUCnODUCnRegen", LPN_MAP.get("PHOTONIC_MEDIA").get("IfOCHOTUCnODUCn"));
+ LPN_MAP
+ .get("PHOTONIC_MEDIA").put("IfOCHOTUCnODUCnUniregen", LPN_MAP.get("PHOTONIC_MEDIA").get("IfOCHOTUCnODUCn"));
+ LPN_MAP.get("PHOTONIC_MEDIA").put("IfOCHOTU4ODU4", LPN_MAP.get("PHOTONIC_MEDIA").get("IfOCH"));
+ LPN_MAP.get("PHOTONIC_MEDIA").put("IfOCHOTU4ODU4Regen", LPN_MAP.get("PHOTONIC_MEDIA").get("IfOCH"));
+ LPN_MAP.get("PHOTONIC_MEDIA").put("IfOCHOTU4ODU4Uniregen", LPN_MAP.get("PHOTONIC_MEDIA").get("IfOCH"));
+ }
+
public ConvertORToTapiTopology(Uuid tapiTopoUuid) {
this.tapiTopoUuid = tapiTopoUuid;
&& networkPorts.contains(tp.getTpId().getValue()))
.sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
.collect(Collectors.toList());
- if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
+ if (this.ietfNodeType.equals(OpenroadmNodeType.TPDR)) {
this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
.flatMap(nbl -> nbl.getTpList().stream())
Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(nodeIdXpdr).build();
Name namePhot = new NameBuilder().setValueName("otsi node name").setValue(nodeIdXpdr).build();
Name nameNodeType = new NameBuilder().setValueName("Node Type").setValue(this.ietfNodeType.getName()).build();
- org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
- .topology.Node dsrNode =
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node dsrNode =
createTapiNode(
- Map.of(nameDsr.key(), nameDsr, namePhot.key(), namePhot,nameNodeType.key(), nameNodeType),
+ Map.of(nameDsr.key(), nameDsr, namePhot.key(), namePhot, nameNodeType.key(), nameNodeType),
//dsrLayerProtocols
Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU,
LayerProtocolName.DIGITALOTN, LayerProtocolName.PHOTONICMEDIA));
tapiNodes.put(dsrNode.key(), dsrNode);
}
- public Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(
- String topoType, Uuid nodeUuid, String orNodeId, Collection<OwnedNodeEdgePoint> onepl) {
+ public Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String topoType, Uuid nodeUuid,
+ String subNodeName, List<OwnedNodeEdgePointKey> onepl, FORWARDINGRULE forwardingRule, int index) {
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.rule.group.NodeEdgePoint>
nepMap = new HashMap<>();
- for (OwnedNodeEdgePoint onep : onepl) {
+ for (OwnedNodeEdgePointKey onepKey : onepl) {
var nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
.node.rule.group.NodeEdgePointBuilder()
.setTopologyUuid(tapiTopoUuid)
.setNodeUuid(nodeUuid)
- .setNodeEdgePointUuid(onep.key().getUuid())
+ .setNodeEdgePointUuid(onepKey.getUuid())
.build();
nepMap.put(nep.key(), nep);
}
+ String nrgNameValue = String.join("-", subNodeName, "node-rule-group-" + index);
Rule rule = new RuleBuilder()
.setLocalId("forward")
- .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
- .setRuleType(new HashSet<>(Set.of(RuleType.FORWARDING)))
+ .setForwardingRule(forwardingRule)
+ .setRuleType(new HashSet<RuleType>(Set.of(RuleType.FORWARDING)))
.build();
+ Name nrgName = new NameBuilder().setValueName("nrg name").setValue(nrgNameValue).build();
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes((
- topoType.equals("Abstracted") ? "rdm infra node rule group" : orNodeId + " node rule group")
- .getBytes(Charset.forName("UTF-8"))).toString()))
- .setRule(new HashMap<>(Map.of(rule.key(), rule)))
+ .setName(Map.of(nrgName.key(), nrgName))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((nrgNameValue).getBytes(Charset.forName("UTF-8"))).toString()))
+ .setRule(new HashMap<RuleKey, Rule>(Map.of(rule.key(), rule)))
.setNodeEdgePoint(nepMap)
.build();
return new HashMap<>(Map.of(nodeRuleGroup.key(), nodeRuleGroup));
}
+ public Map<NodeRuleGroupKey, NodeRuleGroup> createAllNodeRuleGroupForRdmNode(
+ String topoType, Uuid nodeUuid, String orNodeId, Collection<OwnedNodeEdgePoint> onepl) {
+ List<OwnedNodeEdgePoint> otsNepList = topoType.equals("T0ML") ? onepl.stream().collect(Collectors.toList())
+ : onepl.stream()
+ .filter(onep -> onep.getName().keySet().contains(new NameKey("PHOTONIC_MEDIA_OTSNodeEdgePoint")))
+ .collect(Collectors.toList());
+ LOG.info("Creating NRG for {} {}", topoType, otsNepList);
+ List<OwnedNodeEdgePointKey> degOnepKeyList = new ArrayList<>();
+ List<String> srgNames = new ArrayList<>();
+ Map<OwnedNodeEdgePointKey,String> srgMap = new HashMap<>();
+ for (OwnedNodeEdgePoint onep : otsNepList) {
+ String onepName = onep.getName()
+ .get(new NameKey(topoType.equals("T0ML") ? "NodeEdgePoint name" : "PHOTONIC_MEDIA_OTSNodeEdgePoint"))
+ .getValue();
+ String subNodeName = topoType.equals("T0ML") ? "ROADMINFRA-SRG-PP"
+ : String.join("-", onepName.split("\\+")[0], onepName.split("\\+")[2]);
+ if (subNodeName.contains("DEG")) {
+ subNodeName = subNodeName.split("\\-TTP")[0];
+ degOnepKeyList.add(onep.key());
+ } else if (subNodeName.contains("SRG")) {
+ subNodeName = subNodeName.split("\\-PP")[0];
+ srgMap.put(onep.key(), subNodeName);
+ if (!srgNames.contains(subNodeName)) {
+ srgNames.add(subNodeName);
+ }
+ }
+ }
+ int index = 0;
+ Map<NodeRuleGroupKey, NodeRuleGroup> globalNrgMap = new HashMap<>();
+ if (topoType.equals("Full")) {
+ globalNrgMap.putAll(createNodeRuleGroupForRdmNode(
+ topoType, nodeUuid, String.join("-", orNodeId, "DEG"),
+ degOnepKeyList, FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE, index));
+ index++;
+ }
+ for (String srgName : srgNames) {
+ globalNrgMap.putAll(createNodeRuleGroupForRdmNode(
+ topoType,
+ nodeUuid,
+ srgName,
+ srgMap.entrySet().stream()
+ .filter(item -> item.getValue().equals(srgName))
+ .map(item -> item.getKey())
+ .collect(Collectors.toList()),
+ // For T0ML we consider any port of ROADM INFRA can connect to potentially any other port
+ //topoType.equals("T0ML") ? FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE
+ topoType.equals("T0ML") ? FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE
+ : FORWARDINGRULECANNOTFORWARDACROSSGROUP.VALUE,
+ // Whereas for Abstracted or Full Topology we consider any port of the same SRG can not forward to
+ // another port of the same SRG. Connectivity between SRGS will be defined through inter-rule-group
+ index));
+ index++;
+ LOG.debug("AllNodeRuleGroup : creating a NRG for {}", srgName);
+ }
+ return globalNrgMap;
+ }
+
+ public Map<InterRuleGroupKey, InterRuleGroup> createInterRuleGroupForRdmNode(
+ String topoType, Uuid nodeUuid,String orNodeId, List<NodeRuleGroupKey> nrgList) {
+ Map<AssociatedNodeRuleGroupKey, AssociatedNodeRuleGroup> associatedNrgMap = new HashMap<>();
+ for (NodeRuleGroupKey nrgKey : nrgList) {
+ AssociatedNodeRuleGroup associatedNrg = new AssociatedNodeRuleGroupBuilder()
+ .setTopologyUuid(tapiTopoUuid)
+ .setNodeUuid(nodeUuid)
+ .setNodeRuleGroupUuid(nrgKey.getUuid())
+ .build();
+ associatedNrgMap.put(associatedNrg.key(), associatedNrg);
+ }
+ var rule = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
+ .inter.rule.group.RuleBuilder()
+ .setLocalId("forward")
+ .setForwardingRule(FORWARDINGRULEMAYFORWARDACROSSGROUP.VALUE)
+ .setRuleType(new HashSet<RuleType>(Set.of(RuleType.FORWARDING)))
+ .build();
+ String irgNameValue = topoType.equals("Full") ? orNodeId + " inter rule group-" : "rdm infra inter rule group-";
+ Name irgName = new NameBuilder().setValueName("irg name").setValue(irgNameValue).build();
+ InterRuleGroup interRuleGroup = new InterRuleGroupBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((irgNameValue).getBytes(Charset.forName("UTF-8"))).toString()))
+ .setName(Map.of(irgName.key(), irgName))
+ .setRule(new HashMap<>(Map.of(rule.key(), rule)))
+ .setAssociatedNodeRuleGroup(associatedNrgMap)
+ .build();
+ return new HashMap<>(Map.of(new InterRuleGroupKey(interRuleGroup.getUuid()), interRuleGroup));
+ }
+
public Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createMSIP(
int nb, LayerProtocolName layerProtocol, String tpId, String nodeid,
Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
// add them to SIP context
Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
for (int i = 0; i < nb; i++) {
- String sipName =
- nb == 1
- ? String.join("+", "SIP", nodeid, tpId)
+ String sipName = nb == 1 ? String.join("+", "SIP", nodeid, tpId)
: String.join("+", "SIP", nodeid, tpId, "Nber", String.valueOf(i));
LOG.info("SIP = {}", sipName);
Uuid sipUuid = new Uuid(UUID.nameUUIDFromBytes(sipName.getBytes(Charset.forName("UTF-8"))).toString());
- MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
- .setServiceInterfacePointUuid(sipUuid)
- .build();
+ MappedServiceInterfacePoint msip =
+ new MappedServiceInterfacePointBuilder().setServiceInterfacePointUuid(sipUuid).build();
ServiceInterfacePoint sip =
createSIP(sipUuid, layerProtocol, tpId, nodeid, supportedInterfaceCapability, operState, adminState);
this.tapiSips.put(sip.key(), sip);
Integer nepRate = 0;
Integer loopRate = 0;
for (OperationalModeKey operationalMode : supportedOpModes) {
- if (operationalMode.toString().contains("800G")) {
- loopRate = 8;
- } else if (operationalMode.toString().contains("600G")) {
- loopRate = 6;
- } else if (operationalMode.toString().contains("400G")) {
- loopRate = 4;
- } else if (operationalMode.toString().contains("300G")) {
- loopRate = 3;
- } else if (operationalMode.toString().contains("200G")) {
- loopRate = 2;
- } else if (operationalMode.toString().contains("100G")) {
- loopRate = 1;
+ for (Map.Entry<Integer, String> entry: OPMODE_LOOPRATE_MAP.entrySet()) {
+ if (operationalMode.toString().contains(entry.getValue())) {
+ loopRate = entry.getKey();
+ break;
+ }
}
- if (loopRate >= nepRate) {
+ if (loopRate > nepRate) {
nepRate = loopRate;
+ if (nepRate >= OPMODE_LOOPRATE_MAX) {
+ break;
+ }
}
}
List<AvailablePayloadStructure> aps = new ArrayList<>();
Integer nepRate = 0;
Integer loopRate = 0;
for (OperationalModeKey operationalMode : supportedOpModes) {
- if (operationalMode.toString().contains("800G")) {
- loopRate = 8;
- } else if (operationalMode.toString().contains("600G")) {
- loopRate = 6;
- } else if (operationalMode.toString().contains("400G")) {
- loopRate = 4;
- } else if (operationalMode.toString().contains("300G")) {
- loopRate = 3;
- } else if (operationalMode.toString().contains("200G")) {
- loopRate = 2;
- } else if (operationalMode.toString().contains("100G")) {
- loopRate = 1;
+ for (Map.Entry<Integer, String> entry: OPMODE_LOOPRATE_MAP.entrySet()) {
+ if (operationalMode.toString().contains(entry.getValue())) {
+ loopRate = entry.getKey();
+ break;
+ }
}
- if (loopRate >= nepRate) {
+ if (loopRate > nepRate) {
nepRate = loopRate;
+ if (nepRate >= OPMODE_LOOPRATE_MAX) {
+ break;
+ }
}
}
List<SupportedPayloadStructure> sps = new ArrayList<>();
return sps.stream().distinct().toList();
}
- @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH",
- justification = "Voluntarily No break in switchcase where comment is inserted in following method")
public List<SupportedCepLayerProtocolQualifierInstances> createSupportedCepLayerProtocolQualifier(
Collection<SupportedInterfaceCapability> sicList, LayerProtocolName lpn) {
if (sicList == null) {
}
LOG.debug("SIC list = {}", sicList);
List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
+ String lpnName = lpn.getName();
for (SupportedInterfaceCapability sic : sicList) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "ETH":
- case "DSR":
- switch (ifCapType) {
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "ODU":
- switch (ifCapType) {
- case "If1GEODU0":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- switch (ifCapType) {
- case "IfOCHOTUCnODUCn":
- case "IfOtsiOtucnOducn":
- case "IfOCHOTUCnODUCnRegen":
- case "IfOCHOTUCnODUCnUniregen":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODUCN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(OTUTYPEOTUCN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- //fallthrough
- case "IfOCH":
- case "IfOCHOTU4ODU4":
- case "IfOCHOTU4ODU4Regen":
- case "IfOCHOTU4ODU4Uniregen":
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- default:
- break;
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown {}", lpn.getName());
- break;
+ if (!LPN_MAP.containsKey(lpnName)) {
+ LOG.error("Layer Protocol Name is unknown {}", lpnName);
+ break;
+ }
+ var ifCapTypeMap = LPN_MAP.get(lpnName);
+ if (!ifCapTypeMap.containsKey(ifCapType)) {
+ LOG.error("IfCapability type {} not managed", ifCapType);
+ break;
+ }
+ for (LAYERPROTOCOLQUALIFIER qualifier: ifCapTypeMap.get(ifCapType).keySet()) {
+ sclpqiList.add(new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(qualifier)
+ .setNumberOfCepInstances(Uint64.valueOf(1))
+ .build());
}
}
return sclpqiList.stream().distinct().toList();
public Map<Double, Double> getXpdrUsedWavelength(TerminationPoint tp) {
var tpAug = tp.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class);
- if (tpAug == null || tpAug.getXpdrNetworkAttributes() == null) {
+ if (tpAug == null) {
return null;
}
- var xnattWvlgth = tpAug.getXpdrNetworkAttributes().getWavelength();
- return xnattWvlgth == null || xnattWvlgth.getFrequency() == null || xnattWvlgth.getWidth() == null
- ? null
- : new HashMap<>(Map.of(
- xnattWvlgth.getFrequency().getValue().doubleValue(),
- xnattWvlgth.getWidth().getValue().doubleValue()));
+ XpdrNetworkAttributes xnatt = tpAug.getXpdrNetworkAttributes();
+ if (xnatt == null) {
+ return null;
+ }
+ var xnattWvlgth = xnatt.getWavelength();
+ if (xnattWvlgth == null) {
+ return null;
+ }
+ var freq = xnattWvlgth.getFrequency();
+ if (freq == null) {
+ return null;
+ }
+ var width = xnattWvlgth.getWidth();
+ if (width == null) {
+ return null;
+ }
+ Double freqValue = freq.getValue().doubleValue();
+ Double widthValue = width.getValue().doubleValue();
+ return new HashMap<>(Map.of(freqValue - widthValue * 0.001 / 2, freqValue + widthValue * 0.001 / 2));
}
public Map<Double, Double> getPPUsedWavelength(TerminationPoint tp) {
- PpAttributes ppAtt = tp.augmentation(
- org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class)
- .getPpAttributes();
- return ppAtt == null || ppAtt.getUsedWavelength() == null
- || ppAtt.getUsedWavelength().entrySet().iterator().next() == null
- ? null
- : new HashMap<>(Map.of(
- ppAtt.getUsedWavelength().entrySet().iterator().next().getValue().getFrequency().getValue().doubleValue(),
- ppAtt.getUsedWavelength().entrySet().iterator().next().getValue().getFrequency().getValue().doubleValue()));
+ var tpAug = tp.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class);
+ if (tpAug == null) {
+ return null;
+ }
+ PpAttributes ppAtt = tpAug.getPpAttributes();
+ if (ppAtt == null) {
+ return null;
+ }
+ var usedWvl = ppAtt.getUsedWavelength();
+ if (usedWvl == null || usedWvl.isEmpty()) {
+ return null;
+ }
+ var usedWvlfirstValue = usedWvl.entrySet().iterator().next().getValue();
+ Double centFreq = usedWvlfirstValue.getFrequency().getValue().doubleValue();
+ Double width = usedWvlfirstValue.getWidth().getValue().doubleValue();
+ return new HashMap<>(Map.of(centFreq - width * 0.001 / 2, centFreq + width * 0.001 / 2));
+ }
+
+ public Map<Double, Double> getTTPUsedFreqMap(TerminationPoint tp) {
+ byte[] byteArray = new byte[GridConstant.NB_OCTECTS];
+ Arrays.fill(byteArray, (byte) GridConstant.AVAILABLE_SLOT_VALUE);
+ var termPoint1 = tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526
+ .TerminationPoint1.class);
+ if (termPoint1 == null) {
+ return null;
+ }
+ TxTtpAttributes txttpAtt = termPoint1.getTxTtpAttributes();
+ if (txttpAtt == null) {
+ return null;
+ }
+ var txttpAttUsedWvl = txttpAtt.getUsedWavelengths();
+ if (txttpAttUsedWvl == null || txttpAttUsedWvl.isEmpty()) {
+ var txttpAttAvlFreqMaps = txttpAtt.getAvailFreqMaps();
+ if (txttpAttAvlFreqMaps == null || !txttpAttAvlFreqMaps.keySet().toString().contains(GridConstant.C_BAND)) {
+ return null;
+ }
+ byte[] freqBitSet = new byte[GridConstant.NB_OCTECTS];
+ LOG.debug("Creation of Bitset {}", freqBitSet);
+ freqBitSet = txttpAttAvlFreqMaps.entrySet().stream()
+ .filter(afm -> afm.getKey().toString().equals(GridConstant.C_BAND))
+ .findFirst().orElseThrow().getValue().getFreqMap();
+ for (int i = 0; i < GridConstant.EFFECTIVE_BITS; i++) {
+ if (freqBitSet[i] == 0) {
+ freqBitSet[i] = 1;
+ } else {
+ freqBitSet[i] = 0;
+ }
+ }
+ return getFreqMapFromBitSet(freqBitSet);
+ }
+ Map<Double,Double> freqMap = new HashMap<>();
+ for (Map.Entry<UsedWavelengthsKey, UsedWavelengths> usedLambdas : txttpAttUsedWvl.entrySet()) {
+ Double centFreq = usedLambdas.getValue().getFrequency().getValue().doubleValue();
+ Double width = usedLambdas.getValue().getWidth().getValue().doubleValue();
+ freqMap.put(centFreq - width * 0.001 / 2, centFreq + width * 0.001 / 2);
+ }
+ return freqMap;
+ }
+
+ public Map<Double, Double> getTTPAvailableFreqMap(TerminationPoint tp) {
+ var termPoint1 = tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526
+ .TerminationPoint1.class);
+ if (termPoint1 == null) {
+ return null;
+ }
+ TxTtpAttributes txttpAtt = termPoint1.getTxTtpAttributes();
+ if (txttpAtt == null) {
+ return null;
+ }
+ var avlFreqMaps = txttpAtt.getAvailFreqMaps();
+ if (avlFreqMaps == null || !avlFreqMaps.keySet().toString().contains(GridConstant.C_BAND)) {
+ return null;
+ }
+ byte[] byteArray = new byte[GridConstant.NB_OCTECTS];
+ LOG.debug("Creation of Bitset {}", byteArray);
+ return getFreqMapFromBitSet(
+ avlFreqMaps.entrySet().stream()
+ .filter(afm -> afm.getKey().toString().equals(GridConstant.C_BAND))
+ .findFirst().orElseThrow().getValue().getFreqMap());
+ }
+
+ public Map<Double, Double> getTTP11AvailableFreqMap(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1 tp) {
+ if (tp == null) {
+ return null;
+ }
+ TxTtpAttributes txttpAtt = tp.getTxTtpAttributes();
+ if (txttpAtt == null) {
+ return null;
+ }
+ var avlFreqMaps = txttpAtt.getAvailFreqMaps();
+ if (avlFreqMaps == null || !avlFreqMaps.keySet().toString().contains(GridConstant.C_BAND)) {
+ return null;
+ }
+ byte[] byteArray = new byte[GridConstant.NB_OCTECTS];
+ LOG.debug("Creation of Bitset {}", byteArray);
+ return getFreqMapFromBitSet(
+ avlFreqMaps.entrySet().stream()
+ .filter(afm -> afm.getKey().toString().equals(GridConstant.C_BAND))
+ .findFirst().orElseThrow().getValue().getFreqMap());
+ }
+
+ public Map<Double, Double> getPP11UsedWavelength(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1 tp) {
+ if (tp == null) {
+ return null;
+ }
+ PpAttributes ppAtt = tp.getPpAttributes();
+ if (ppAtt == null) {
+ return null;
+ }
+ var usedWvl = ppAtt.getUsedWavelength();
+ if (usedWvl == null || usedWvl.isEmpty()) {
+ return null;
+ }
+ var usedWvlFirstValue = usedWvl.entrySet().iterator().next().getValue();
+ Double centFreq = usedWvlFirstValue.getFrequency().getValue().doubleValue();
+ Double width = usedWvlFirstValue.getWidth().getValue().doubleValue();
+ return new HashMap<>(Map.of(centFreq - width * 0.001 / 2, centFreq + width * 0.001 / 2));
+ }
+
+ public Map<Double, Double> getTTP11UsedFreqMap(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1 tp) {
+ byte[] byteArray = new byte[GridConstant.NB_OCTECTS];
+ Arrays.fill(byteArray, (byte) GridConstant.AVAILABLE_SLOT_VALUE);
+ if (tp == null) {
+ return null;
+ }
+ TxTtpAttributes txttpAtt = tp.getTxTtpAttributes();
+ if (txttpAtt == null) {
+ return null;
+ }
+ var txttpAttUsedWvl = txttpAtt.getUsedWavelengths();
+ if (txttpAttUsedWvl == null || txttpAttUsedWvl.isEmpty()) {
+ var txttpAttAvlFreqMaps = txttpAtt.getAvailFreqMaps();
+ if (txttpAttAvlFreqMaps == null || !txttpAttAvlFreqMaps.keySet().toString().contains(GridConstant.C_BAND)) {
+ return null;
+ }
+ byte[] freqBitSet = new byte[GridConstant.NB_OCTECTS];
+ LOG.debug("Creation of Bitset {}", freqBitSet);
+ freqBitSet = txttpAttAvlFreqMaps.entrySet().stream()
+ .filter(afm -> afm.getKey().toString().equals(GridConstant.C_BAND))
+ .findFirst().orElseThrow().getValue().getFreqMap();
+ for (int i = 0; i < GridConstant.EFFECTIVE_BITS; i++) {
+ if (freqBitSet[i] == 0) {
+ freqBitSet[i] = 1;
+ } else {
+ freqBitSet[i] = 0;
+ }
+ }
+ return getFreqMapFromBitSet(freqBitSet);
+ }
+ Map<Double,Double> freqMap = new HashMap<>();
+ for (Map.Entry<UsedWavelengthsKey, UsedWavelengths> usedLambdas : txttpAttUsedWvl.entrySet()) {
+ var usedLambdasValue = usedLambdas.getValue();
+ Double centFreq = usedLambdasValue.getFrequency().getValue().doubleValue();
+ Double width = usedLambdasValue.getWidth().getValue().doubleValue();
+ freqMap.put(centFreq - width * 0.001 / 2, centFreq + width * 0.001 / 2);
+ }
+ return freqMap;
+ }
+
+ public Map<Double, Double> getFreqMapFromBitSet(byte[] byteArray) {
+ // Provides a Map <LowerFreq, HigherFreq> describing start and stop frequencies of all slots that are available
+ // in the ByteArray describing the spectrum : bit sets initially sets to 1/true
+ // In case the byte array has been inverted before calling this method, it provides respectively a map
+ // describing all occupied slots!
+ Map<Double,Double> freqMap = new HashMap<>();
+ Double startFreq = GridConstant.START_EDGE_FREQUENCY;
+ Double stopFreq = 0.0;
+ boolean occupied = false;
+ if (byteArray[0] == 0) {
+ occupied = true;
+ }
+ for (int index = 0 ; index < GridConstant.EFFECTIVE_BITS ; index++) {
+ if (occupied) {
+ if (byteArray[index] == 1) {
+ startFreq = GridUtils.getStartFrequencyFromIndex(index).doubleValue();
+ stopFreq = GridUtils.getStartFrequencyFromIndex(index).doubleValue();
+ occupied = false;
+ }
+ } else {
+ if (byteArray[index] == 0) {
+ stopFreq = GridUtils.getStartFrequencyFromIndex(index).doubleValue();
+ occupied = true;
+ }
+ }
+ if (occupied) {
+ if (stopFreq.doubleValue() > startFreq.doubleValue()) {
+ freqMap.put(startFreq, stopFreq);
+ startFreq = stopFreq;
+ }
+ } else {
+ if (index == GridConstant.EFFECTIVE_BITS - 1 && startFreq.doubleValue() == stopFreq.doubleValue()) {
+ stopFreq = GridUtils.getStopFrequencyFromIndex(index).doubleValue();
+ freqMap.put(startFreq, stopFreq);
+ }
+ }
+ }
+ return freqMap;
}
- public OwnedNodeEdgePointBuilder addPayloadStructureAndPhotSpecToOnep(
- String nodeId, Map<Double, Double> freqWidthMap, List<OperationalModeKey> operModeList,
+ public OwnedNodeEdgePointBuilder addPayloadStructureAndPhotSpecToOnep(String nodeId,
+ Map<Double, Double> freqMap, List<OperationalModeKey> operModeList,
Collection<SupportedInterfaceCapability> sicColl, OwnedNodeEdgePointBuilder onepBldr, String keyword) {
if (!String.join("+", nodeId, TapiStringConstants.OTSI_MC).equals(keyword)
&& !String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS).equals(keyword)) {
return onepBldr;
}
- //Creating OTS & OTSI_MC NEP specific attributes
+ LOG.debug("Entering LOOP Step1");
double naz = 0.01;
- Uint64 supLoFreq = Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09 + naz));
- Uint64 supUpFreq = Uint64.valueOf(Math.round(GridConstant.START_EDGE_FREQUENCY * 1E09
- + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06 + naz));
- boolean boolParam;
- Uint64 upFreq;
- Uint64 loFreq;
+ Double lowSupFreq = GridConstant.START_EDGE_FREQUENCY * 1E09 ;
+ Double upSupFreq = lowSupFreq + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06 + naz;
+ lowSupFreq += naz;
+ // Creating OTS & OTSI_MC NEP specific attributes
+ onepBldr.setSupportedPayloadStructure(
+ createSupportedPayloadStructureForPhtncMedia(sicColl,operModeList));
SpectrumCapabilityPacBuilder spectrumPac = new SpectrumCapabilityPacBuilder();
- if (freqWidthMap == null || freqWidthMap.isEmpty()) {
- upFreq = Uint64.valueOf(0);
- loFreq = Uint64.valueOf(0);
- boolParam = false;
- AvailableSpectrum aspec =
- new AvailableSpectrumBuilder().setUpperFrequency(supUpFreq).setLowerFrequency(supLoFreq).build();
- spectrumPac.setAvailableSpectrum(new HashMap<>(Map.of(
- new AvailableSpectrumKey(aspec.getLowerFrequency(), aspec.getUpperFrequency()), aspec)));
+ OccupiedSpectrumBuilder ospecBd = new OccupiedSpectrumBuilder();
+ if (freqMap == null || freqMap.isEmpty()) {
+// TODO: verify if we need to fill OcupiedSpectrum as follows when no lambda provisioned
+// ospecBd
+// .setUpperFrequency(Uint64.valueOf(0))
+// .setLowerFrequency(Uint64.valueOf(0));
+ onepBldr.setAvailablePayloadStructure(
+ createAvailablePayloadStructureForPhtncMedia(false, sicColl,operModeList));
+ AvailableSpectrum aspec = new AvailableSpectrumBuilder()
+ .setLowerFrequency(Uint64.valueOf(Math.round(lowSupFreq)))
+ .setUpperFrequency(Uint64.valueOf(Math.round(upSupFreq)))
+ .build();
+ spectrumPac.setAvailableSpectrum(
+ new HashMap<AvailableSpectrumKey, AvailableSpectrum>(Map.of(
+ new AvailableSpectrumKey(aspec.getLowerFrequency(), aspec.getUpperFrequency()), aspec)));
} else {
- upFreq = Uint64.valueOf(Math.round(
- freqWidthMap.keySet().iterator().next().doubleValue() * 1E09
- + (freqWidthMap.entrySet().iterator().next().getValue().doubleValue() * 1E06) / 2));
- loFreq = Uint64.valueOf(Math.round(
- freqWidthMap.keySet().iterator().next().doubleValue() * 1E09
- - (freqWidthMap.entrySet().iterator().next().getValue().doubleValue() * 1E06) / 2));
- boolParam = true;
+ LOG.debug("Entering LOOP Step2");
+ onepBldr.setAvailablePayloadStructure(
+ createAvailablePayloadStructureForPhtncMedia(true, sicColl,operModeList));
+ for (Map.Entry<Double, Double> frequency : freqMap.entrySet()) {
+ ospecBd
+ .setLowerFrequency(Uint64.valueOf(Math.round(frequency.getKey().doubleValue() * 1E09)))
+ .setUpperFrequency(Uint64.valueOf(Math.round(frequency.getValue().doubleValue() * 1E09)));
+ }
+ OccupiedSpectrum ospec = ospecBd.build();
+ spectrumPac.setOccupiedSpectrum(
+ new HashMap<OccupiedSpectrumKey, OccupiedSpectrum>(Map.of(
+ new OccupiedSpectrumKey(ospec.getLowerFrequency(), ospec.getUpperFrequency()), ospec)));
}
- return onepBldr
- .setSupportedPayloadStructure(createSupportedPayloadStructureForPhtncMedia(sicColl, operModeList))
- .setAvailablePayloadStructure(createAvailablePayloadStructureForPhtncMedia(boolParam, sicColl,operModeList))
- .addAugmentation(
- new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121
- .OwnedNodeEdgePoint1Builder()
- .setPhotonicMediaNodeEdgePointSpec(
- new PhotonicMediaNodeEdgePointSpecBuilder()
- .setSpectrumCapabilityPac(
- spectrumPac
- .setOccupiedSpectrum(new HashMap<>(Map.of(
- new OccupiedSpectrumKey(loFreq, upFreq),
- new OccupiedSpectrumBuilder()
- .setUpperFrequency(upFreq)
- .setLowerFrequency(loFreq)
- .build())))
- .setSupportableSpectrum(new HashMap<>(Map.of(
- new SupportableSpectrumKey(supLoFreq, supUpFreq),
- new SupportableSpectrumBuilder()
- .setUpperFrequency(supUpFreq)
- .setLowerFrequency(supLoFreq)
- .build())))
- .build())
- .build())
- .build());
+ LOG.debug("Entering LOOP Step3");
+ SupportableSpectrum sspec = new SupportableSpectrumBuilder()
+ .setLowerFrequency(Uint64.valueOf(Math.round(lowSupFreq)))
+ .setUpperFrequency(Uint64.valueOf(Math.round(upSupFreq)))
+ .build();
+ spectrumPac.setSupportableSpectrum(
+ new HashMap<SupportableSpectrumKey, SupportableSpectrum>(Map.of(
+ new SupportableSpectrumKey(sspec.getLowerFrequency(), sspec.getUpperFrequency()), sspec)));
+ LOG.debug("Entering LOOP Step4");
+ var onep1 = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121
+ .OwnedNodeEdgePoint1Builder()
+ .setPhotonicMediaNodeEdgePointSpec(
+ new PhotonicMediaNodeEdgePointSpecBuilder().setSpectrumCapabilityPac(spectrumPac.build()).build())
+ .build();
+ LOG.debug("creating Photonic NEP SPEC for node {} and nep {}", nodeId, onep1);
+ onepBldr.addAugmentation(onep1);
+ LOG.debug("Entering LOOP Step5");
+ return onepBldr;
+ }
+
+
+ public OwnedNodeEdgePointBuilder addPhotSpecToRoadmOnep(String nodeId,
+ Map<Double, Double> usedFreqMap, Map<Double, Double> availableFreqMap,
+ OwnedNodeEdgePointBuilder onepBldr, String keyword) {
+ if (!String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OTS).equals(keyword)
+ && !String.join("+", nodeId, TapiStringConstants.PHTNC_MEDIA_OMS).equals(keyword)) {
+ return onepBldr;
+ }
+ // Creating OTS/OMS NEP specific attributes
+ double naz = 0.01;
+ Double lowSupFreq = GridConstant.START_EDGE_FREQUENCY * 1E09 ;
+ Double upSupFreq = lowSupFreq + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06 + naz;
+ lowSupFreq += naz;
+ SpectrumCapabilityPacBuilder spectrumPac = new SpectrumCapabilityPacBuilder();
+ Map<Double, Double> freqMap = null;
+ if (usedFreqMap == null || usedFreqMap.isEmpty()) {
+ freqMap = Map.of(lowSupFreq, upSupFreq);
+ } else {
+ Map<OccupiedSpectrumKey, OccupiedSpectrum> ospecMap = new HashMap<>();
+ OccupiedSpectrumBuilder ospecBd = new OccupiedSpectrumBuilder();
+ for (Map.Entry<Double, Double> frequency : usedFreqMap.entrySet()) {
+ ospecBd
+ .setLowerFrequency(Uint64.valueOf(Math.round(frequency.getKey().doubleValue() * 1E09)))
+ .setUpperFrequency(Uint64.valueOf(Math.round(frequency.getValue().doubleValue() * 1E09)));
+ OccupiedSpectrum ospec = ospecBd.build();
+ ospecMap.put(new OccupiedSpectrumKey(ospec.getLowerFrequency(), ospec.getUpperFrequency()), ospec);
+ }
+ spectrumPac.setOccupiedSpectrum(ospecMap);
+ }
+ if (availableFreqMap != null && !availableFreqMap.isEmpty()) {
+ freqMap = availableFreqMap;
+ }
+ if (freqMap != null) {
+ Map<AvailableSpectrumKey, AvailableSpectrum> aspecMap = new HashMap<>();
+ AvailableSpectrumBuilder aspecBd = new AvailableSpectrumBuilder();
+ for (Map.Entry<Double, Double> frequency : availableFreqMap.entrySet()) {
+ aspecBd
+ .setLowerFrequency(Uint64.valueOf(Math.round(frequency.getKey().doubleValue() * 1E09)))
+ .setUpperFrequency(Uint64.valueOf(Math.round(frequency.getValue().doubleValue() * 1E09)));
+ AvailableSpectrum aspec = aspecBd.build();
+ aspecMap.put(new AvailableSpectrumKey(aspec.getLowerFrequency(), aspec.getUpperFrequency()), aspec);
+ }
+ spectrumPac.setAvailableSpectrum(aspecMap);
+ }
+ SupportableSpectrum sspec = new SupportableSpectrumBuilder()
+ .setLowerFrequency(Uint64.valueOf(Math.round(lowSupFreq)))
+ .setUpperFrequency(Uint64.valueOf(Math.round(upSupFreq)))
+ .build();
+ spectrumPac.setSupportableSpectrum(
+ new HashMap<SupportableSpectrumKey, SupportableSpectrum>(Map.of(
+ new SupportableSpectrumKey(sspec.getLowerFrequency(), sspec.getUpperFrequency()), sspec)));
+ var onep1 = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev221121
+ .OwnedNodeEdgePoint1Builder()
+ .setPhotonicMediaNodeEdgePointSpec(
+ new PhotonicMediaNodeEdgePointSpecBuilder().setSpectrumCapabilityPac(spectrumPac.build()).build())
+ .build();
+ onepBldr.addAugmentation(onep1);
+ LOG.debug("Add Photonic Node Edge point Spec to {} including available Spectrum {} = ",
+ onepBldr.getName(),
+ onep1.getPhotonicMediaNodeEdgePointSpec().getSpectrumCapabilityPac().getAvailableSpectrum());
+ return onepBldr;
}
private OduSwitchingPools createOduSwitchingPoolForTp100G() {
.build();
nodeUuid = getNodeUuid4Dsr(onepl, nodeRuleGroupList, new HashMap<>(Map.of(rule.key(), rule)));
} else {
- LOG.error("Undefined LayerProtocolName for {} node {}",
- nodeNames.get(nodeNames.keySet().iterator().next()).getValueName(),
- nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
+ var nodeName = nodeNames.get(nodeNames.keySet().iterator().next());
+ LOG.error("Undefined LayerProtocolName for {} node {}", nodeName.getValueName(), nodeName.getValue());
}
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
LOG.debug("UUidMap={}", this.uuidMap.keySet());
LOG.debug("TP list = {}", nbl.getTpList());
for (TpId tp : nbl.getTpList()) {
- LOG.debug("TP={}", tp.getValue());
- String ietfEoduTp = String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU, tp.getValue());
+ String tpValue = tp.getValue();
+ LOG.debug("TP={}", tpValue);
+ String ietfEoduTp = String.join("+", this.ietfNodeId, TapiStringConstants.E_ODU, tpValue);
LOG.debug("UuidKey={}", ietfEoduTp);
- String ietfIoduTp = String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue());
- if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, tp.getValue()))
+ String ietfIoduTp = String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU, tpValue);
+ if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, tpValue))
|| this.uuidMap.containsKey(ietfIoduTp)) {
- String qual = tp.getValue().contains("CLIENT")
- ? TapiStringConstants.DSR : TapiStringConstants.I_ODU;
var nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121
.node.rule.group.NodeEdgePointBuilder()
.setTopologyUuid(tapiTopoUuid)
.setNodeUuid(this.uuidMap.get(ietfXpdr))
.setNodeEdgePointUuid(this.uuidMap.get(
- String.join("+", this.ietfNodeId, qual, tp.getValue())))
+ String.join("+",
+ this.ietfNodeId,
+ tpValue.contains("CLIENT") ? TapiStringConstants.DSR : TapiStringConstants.I_ODU,
+ tpValue)))
.build();
nepList.put(nep.key(), nep);
}
.setRiskCharacteristicName("risk characteristic")
.setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
+ Name nrgName = new NameBuilder()
+ .setValueName("nrg name")
+ .setValue("odu node rule group " + count)
+ .build();
NodeRuleGroup nodeRuleGroup1 = new NodeRuleGroupBuilder()
+ .setName(Map.of(nrgName.key(), nrgName))
.setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count)
.getBytes(Charset.forName("UTF-8"))).toString()))
.setRule(ruleList)
LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
var tp1 = oorTp.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev230526.TerminationPoint1.class);
+ var oorTpId = oorTp.getTpId();
+ var oorTpIdValue = oorTpId.getValue();
if (tp1.getTpSupportedInterfaces() == null) {
- LOG.warn("Tp supported interface doesnt exist on TP {}", oorTp.getTpId().getValue());
+ LOG.warn("Tp supported interface doesnt exist on TP {}", oorTpIdValue);
return null;
}
+ TerminationPoint1 oorTpAug = oorTp.augmentation(TerminationPoint1.class);
+ var oorTpAugAdmState = oorTpAug.getAdministrativeState();
AdministrativeState adminState =
- oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() == null
- ? null
- : transformAsToTapiAdminState(
- oorTp.augmentation(TerminationPoint1.class).getAdministrativeState().getName());
+ oorTpAugAdmState == null ? null : transformAsToTapiAdminState(oorTpAugAdmState.getName());
+ var oorTpAugOprState = oorTpAug.getOperationalState();
OperationalState operState =
- oorTp.augmentation(TerminationPoint1.class).getOperationalState() == null
- ? null
- : transformOsToTapiOperationalState(
- oorTp.augmentation(TerminationPoint1.class).getOperationalState().getName());
+ oorTpAugOprState == null ? null : transformOsToTapiOperationalState(oorTpAugOprState.getName());
Collection<SupportedInterfaceCapability> sicColl =
tp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values();
OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(this.uuidMap.get(String.join("+", keyword, oorTp.getTpId().getValue())))
+ .setUuid(this.uuidMap.get(String.join("+", keyword, oorTpIdValue)))
.setLayerProtocolName(nepProtocol)
.setName(nepNames)
.setSupportedCepLayerProtocolQualifierInstances(
.setLifecycleState(LifecycleState.INSTALLED);
if (withSip) {
onepBldr.setMappedServiceInterfacePoint(
- createMSIP(1, nepProtocol, oorTp.getTpId().getValue(), keyword, sicColl, operState, adminState));
+ createMSIP(1, nepProtocol, oorTpIdValue, keyword, sicColl, operState, adminState));
}
- if (oorTp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
+ if (oorTpAug.getTpType().equals(OpenroadmTpType.XPONDERNETWORK)) {
List<OperationalModeKey> opModeList = new ArrayList<>();
var tp11 = oorTp.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev230526.TerminationPoint1.class);
if (tp11 == null || tp11.getXpdrNetworkAttributes() == null) {
for (SupportedInterfaceCapability sic : sicColl) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- if (("IfOCHOTUCnODUCn").equals(ifCapType) || ("IfOCHOTUCnODUCnUniregen").equals(ifCapType)
- || ("IfOCHOTUCnODUCnRegen").equals(ifCapType)) {
- opModeList.add(new OperationalModeKey("400G"));
- LOG.warn(TopologyUtils.NOOPMODEDECLARED + "400G rate available", oorTp.getTpId());
- break;
+ switch (ifCapType) {
+ case "IfOCHOTUCnODUCn":
+ case "IfOCHOTUCnODUCnUniregen":
+ case "IfOCHOTUCnODUCnRegen":
+ opModeList.add(new OperationalModeKey("400G"));
+ LOG.warn(TopologyUtils.NOOPMODEDECLARED + "400G rate available", oorTpId);
+ break;
+ default:
+ break;
}
}
opModeList.add(new OperationalModeKey("100G"));
- LOG.warn(TopologyUtils.NOOPMODEDECLARED + "100G rate available", oorTp.getTpId());
+ LOG.warn(TopologyUtils.NOOPMODEDECLARED + "100G rate available", oorTpId);
} else {
opModeList = tp11.getXpdrNetworkAttributes().getSupportedOperationalModes().getOperationalMode()
.keySet().stream().toList();
onepBldr = addPayloadStructureAndPhotSpecToOnep(
this.ietfNodeId, getXpdrUsedWavelength(oorTp), opModeList, sicColl, onepBldr, keyword);
}
- return onepBldr.build();
+ OwnedNodeEdgePoint onep = onepBldr.build();
+ LOG.debug("ConvertORToTapiTopology 1360, onep = {}", onep);
+ return onep;
}
private ServiceInterfacePoint createSIP(Uuid sipUuid, LayerProtocolName layerProtocol, String tpId,
String nodeid, Collection<SupportedInterfaceCapability> supportedInterfaceCapability,
OperationalState operState, AdministrativeState adminState) {
// TODO: what value should be set in total capacity and available capacity??
- // LOG.info("SIP name = {}", String.join("+", nodeid, tp.getTpId().getValue()));
+ LOG.debug("SIP name = {}", String.join("+", nodeid, tpId));
Name sipName = new NameBuilder()
.setValueName("SIP name")
.setValue(String.join("+", nodeid, tpId))
.build();
}
- @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "SF_SWITCH_FALLTHROUGH",
- justification = "Voluntarily No break in switchcase where comment is inserted in following method")
private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
.service._interface.point.SupportedCepLayerProtocolQualifierInstances>
createSipSupportedLayerProtocolQualifier(
}
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
.service._interface.point.SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>();
+ String lpnName = lpn.getName();
for (SupportedInterfaceCapability sic : supportedInterfaceCapability) {
String ifCapType = sic.getIfCapType().toString().split("\\{")[0];
- switch (lpn.getName()) {
- case "ETH":
- case "DSR":
- switch (ifCapType) {
- case "If1GEODU0":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPEGigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE10GigELAN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(DIGITALSIGNALTYPE100GigE.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "ODU":
- switch (ifCapType) {
- case "If1GEODU0":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU0.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2e":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2E.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If10GEODU2":
- case "If10GE":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU2.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- case "If100GEODU4":
- case "If100GE":
- case "IfOCHOTU4ODU4":
- case "IfOCH":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODU4.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(0))
- .build());
- break;
- default:
- LOG.error("IfCapability type not managed");
- break;
- }
- break;
- case "PHOTONIC_MEDIA":
- switch (ifCapType) {
- case "IfOCHOTUCnODUCn":
- case "IfOtsiOtucnOducn":
- case "IfOCHOTUCnODUCnRegen":
- case "IfOCHOTUCnODUCnUniregen":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(ODUTYPEODUCN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(OTUTYPEOTUCN.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- //fallthrough
- case "IfOCH":
- case "IfOCHOTU4ODU4":
- case "IfOCHOTU4ODU4Regen":
- case "IfOCHOTU4ODU4Uniregen":
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- sclpqiList.add(new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
- .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
- .setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE)
- .setNumberOfCepInstances(Uint64.valueOf(1))
- .build());
- break;
- default:
- break;
- }
- break;
- default:
- LOG.error("Layer Protocol Name is unknown");
- break;
+ if (!LPN_MAP.containsKey(lpnName)) {
+ LOG.error("Layer Protocol Name is unknown {}", lpnName);
+ break;
+ }
+ var ifCapTypeMap = LPN_MAP.get(lpnName);
+ if (!ifCapTypeMap.containsKey(ifCapType)) {
+ LOG.error("IfCapability type {} not managed", ifCapType);
+ break;
+ }
+ for (Map.Entry<LAYERPROTOCOLQUALIFIER, Uint64> entry: ifCapTypeMap.get(ifCapType).entrySet()) {
+ sclpqiList.add(
+ new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121
+ .service._interface.point.SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setLayerProtocolQualifier(entry.getKey())
+ .setNumberOfCepInstances(entry.getValue())
+ .build());
}
}
return sclpqiList.stream().distinct().toList();
}
public AdministrativeState transformAsToTapiAdminState(String adminState) {
- return adminState == null
- ? null
+ return adminState == null ? null
: adminState.equals(AdminStates.InService.getName())
|| adminState.equals(AdministrativeState.UNLOCKED.getName())
? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
}
public OperationalState transformOsToTapiOperationalState(String operState) {
- return operState == null
- ? null
+ return operState == null ? null
: operState.equals("inService") || operState.equals(OperationalState.ENABLED.getName())
? OperationalState.ENABLED : OperationalState.DISABLED;
}