import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
+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.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPools;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey;
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.odu.rev181210.ODUTYPEODU2;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS;
private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopo.class);
private String ietfNodeId;
private OpenroadmNodeType ietfNodeType;
+ private AdminStates ietfNodeAdminState;
+ private State ietfNodeOperState;
private List<TerminationPoint> oorClientPortList;
private List<TerminationPoint> oorNetworkPortList;
private OduSwitchingPools oorOduSwitchingPool;
public void convertNode(Node ietfNode, List<String> networkPorts) {
this.ietfNodeId = ietfNode.getNodeId().getValue();
if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
- == null) {
+ == null) {
return;
}
this.ietfNodeType = ietfNode.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType();
+ this.ietfNodeAdminState = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
+ .getAdministrativeState();
+ this.ietfNodeOperState = ietfNode.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
+ .getOperationalState();
this.oorNetworkPortList = ietfNode.augmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
.getTerminationPoint().values().stream()
.filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERNETWORK.getIntValue()
- && networkPorts.contains(tp.getTpId().getValue()))
+ == OpenroadmTpType.XPONDERNETWORK.getIntValue()
+ && networkPorts.contains(tp.getTpId().getValue()))
.sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
.collect(Collectors.toList());
if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) {
.values().stream().findFirst().get();
this.oorClientPortList = ietfNode.augmentation(
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class)
- .getTerminationPoint().values().stream()
- .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
- == OpenroadmTpType.XPONDERCLIENT.getIntValue())
- .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
- .collect(Collectors.toList());
+ .getTerminationPoint().values().stream()
+ .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue()
+ == OpenroadmTpType.XPONDERCLIENT.getIntValue())
+ .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue()))
+ .collect(Collectors.toList());
} else {
this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G();
List<TpId> tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream()
createTapiTransitionalLinks();
}
- public void convertLinks(List
- <org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link>
- otnLinkList) {
+ public void convertLinks(Map<
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+ .LinkKey,
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+ .Link> otnLinkMap) {
+ List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
+ .Link> otnLinkList = new ArrayList<>(otnLinkMap.values());
+ Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue()
+ .compareTo(l2.getLinkId().getValue()));
List<String> linksToNotConvert = new ArrayList<>();
- LOG.info("creation of {} otn links", otnLinkList.size() / 2);
+ LOG.info("creation of {} otn links", otnLinkMap.size() / 2);
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
- .Link link : otnLinkList) {
- if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
- Link tapiLink = createTapiLink(link);
- linksToNotConvert.add(link
- .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
- .getOppositeLink().getValue());
+ .Link otnlink : otnLinkList) {
+ if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
+ .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns
+ .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOppositeLink()));
+ Link tapiLink = createTapiLink(otnlink, oppositeLink);
+ linksToNotConvert.add(oppositeLink.getLinkId().getValue());
tapiLinks.put(tapiLink.key(), tapiLink);
}
}
for (TerminationPoint tp : this.oorNetworkPortList) {
TpId tpid1 = tp.getTpId();
TpId tpid2 = new TpId(tp.augmentation(
- org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1.class)
+ org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1.class)
.getAssociatedConnectionMapPort());
List<TpId> tpList = new ArrayList<>();
tpList.add(tpid1);
}
private List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
- pruneTapiPhotonicNodes() {
+ pruneTapiPhotonicNodes() {
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
prunedTapiPhotonicNodes = new ArrayList<>();
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
.filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().get(0)))
.collect(Collectors.toList());
for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node
- : tapiPhotonicNodes) {
+ : tapiPhotonicNodes) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepM = new HashMap<>();
for (Map.Entry<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> entry : node.getOwnedNodeEdgePoint().entrySet()) {
if (entry.getValue().getName().values().stream()
- .filter(name -> name.getValueName().startsWith("eNodeEdgePoint"))
- .count() > 0) {
+ .filter(name -> name.getValueName().startsWith("eNodeEdgePoint")).count() > 0) {
onepM.put(entry.getKey(), entry.getValue());
}
}
}
private Map<String, String> convertListNodeWithListNepToMapForUuidAndName(
- List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> nodes) {
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> nodes) {
Map<String, String> uuidNameMap = new HashMap<>();
for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node : nodes) {
for (OwnedNodeEdgePoint nep : node.nonnullOwnedNodeEdgePoint().values()) {
}
private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
+ createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
Uuid nodeUuid = null;
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
.getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue());
}
return new NodeBuilder()
- .setUuid(nodeUuid)
- .setName(nodeNames)
- .setLayerProtocolName(layerProtocols)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED)
- .setOwnedNodeEdgePoint(onepl)
- .setNodeRuleGroup(nodeRuleGroupList)
- .build();
+ .setUuid(nodeUuid)
+ .setName(nodeNames)
+ .setLayerProtocolName(layerProtocols)
+ .setAdministrativeState(setTapiAdminState(this.ietfNodeAdminState))
+ .setOperationalState(setTapiOperationalState(this.ietfNodeOperState))
+ .setLifecycleState(LifecycleState.INSTALLED)
+ .setOwnedNodeEdgePoint(onepl)
+ .setNodeRuleGroup(nodeRuleGroupList)
+ .build();
+ }
+
+ private AdministrativeState setTapiAdminState(AdminStates adminState) {
+ if (adminState == null) {
+ return null;
+ }
+ return adminState.equals(AdminStates.InService) ? AdministrativeState.UNLOCKED : AdministrativeState.LOCKED;
+ }
+
+ private AdministrativeState setTapiAdminState(AdminStates adminState1, AdminStates adminState2) {
+ if (adminState1 == null || adminState2 == null) {
+ return null;
+ }
+ if (AdminStates.InService.equals(adminState1) && AdminStates.InService.equals(adminState2)) {
+ return AdministrativeState.UNLOCKED;
+ } else {
+ return AdministrativeState.LOCKED;
+ }
+ }
+
+ private OperationalState setTapiOperationalState(State operState) {
+ if (operState == null) {
+ return null;
+ }
+ return operState.getName().equals("inService") ? OperationalState.ENABLED : OperationalState.DISABLED;
+ }
+
+ private OperationalState setTapiOperationalState(State operState1, State operState2) {
+ if (operState1 == null || operState2 == null) {
+ return null;
+ }
+ if (State.InService.equals(operState1) && State.InService.equals(operState2)) {
+ return OperationalState.ENABLED;
+ } else {
+ return OperationalState.DISABLED;
+ }
}
private Uuid getNodeUuid4Photonic(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
+ Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
Uuid nodeUuid;
nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI));
// iNep creation on otsi node
for (int i = 0; i < oorNetworkPortList.size(); i++) {
Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
+ (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
.getBytes(Charset.forName("UTF-8")))
.toString());
this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
// eNep creation on otsi node
for (int i = 0; i < oorNetworkPortList.size(); i++) {
Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes(
- (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
+ (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()))
.getBytes(Charset.forName("UTF-8")))
.toString());
this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()),
nepList.put(enep.key(), enep);
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
.setUuid(new Uuid(
- UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
- .toString()))
+ UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setRule(ruleList)
.setNodeEdgePoint(nepList)
.build();
}
private Uuid getNodeUuid4Dsr(Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl,
- Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
+ Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList, Map<RuleKey, Rule> ruleList) {
Uuid nodeUuid;
nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR));
// client nep creation on DSR/ODU node
for (int i = 0; i < oorClientPortList.size(); i++) {
Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(Charset.forName("UTF-8"))).toString());
this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()),
nepUuid);
NameBuilder nameBldr = new NameBuilder().setValue(oorClientPortList.get(i).getTpId().getValue());
for (int i = 0; i < oorNetworkPortList.size(); i++) {
Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes(
(String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8"))).toString());
+ .getBytes(Charset.forName("UTF-8"))).toString());
this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()),
nepUuid);
Name onedName = new NameBuilder()
}
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
.setUuid(new Uuid(
- UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
- .toString()))
+ UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setRule(ruleList)
.setNodeEdgePoint(nepList)
.build();
}
private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map<NameKey, Name> nepNames,
- LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
+ LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) {
String key = String.join("+", keyword, oorTp.getTpId().getValue());
OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
.setUuid(this.uuidMap.get(key))
.setLayerProtocolName(nepProtocol)
- .setName(nepNames);
+ .setName(nepNames)
+ .setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol))
+ .setLinkPortDirection(PortDirection.BIDIRECTIONAL)
+ .setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(setTapiAdminState(
+ oorTp.augmentation(TerminationPoint1.class).getAdministrativeState()))
+ .setOperationalState(setTapiOperationalState(
+ oorTp.augmentation(TerminationPoint1.class).getOperationalState()))
+ .setLifecycleState(LifecycleState.INSTALLED)
+ .setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createSIP(this.uuidMap.get(key), 1));
+ onepBldr.setMappedServiceInterfacePoint(createSIP(1, oorTp, keyword));
}
- onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol));
- onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
- .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
return onepBldr.build();
}
}
private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
- Collection<OwnedNodeEdgePoint> onepl) {
+ Collection<OwnedNodeEdgePoint> onepl) {
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePointKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint>
nepMap = new HashMap<>();
return nodeRuleGroupMap;
}
- private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(Uuid nepUuid, int nb) {
+ private Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> createSIP(int nb, TerminationPoint tp,
+ String nodeId) {
Map<MappedServiceInterfacePointKey, MappedServiceInterfacePoint> msipl = new HashMap<>();
for (int i = 0; i < nb; i++) {
MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder()
- .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes(nepUuid.getValue()
- .getBytes(Charset.forName("UTF-8"))).toString()))
+ .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeId,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.build();
msipl.put(msip.key(), msip);
}
}
private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedCepLayerProtocolQualifier(TerminationPoint tp,
- LayerProtocolName lpn) {
- List<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new ArrayList<>();
+ LayerProtocolName lpn) {
+ Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
List<SupportedInterfaceCapability> sicList = new ArrayList<>(
tp.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class).getTpSupportedInterfaces()
- .getSupportedInterfaceCapability().values());
+ .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class).getTpSupportedInterfaces()
+ .getSupportedInterfaceCapability().values());
for (SupportedInterfaceCapability sic : sicList) {
switch (lpn.getName()) {
case "DSR":
- if (sic.getIfCapType().getSimpleName().equals("If10GEODU2e")) {
- sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class);
- sclpqList.add(ODUTYPEODU2E.class);
- } else if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")) {
- sclpqList.add(ODUTYPEODU4.class);
- } else if (sic.getIfCapType().getSimpleName().equals("If100GEODU4")) {
- sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
- sclpqList.add(ODUTYPEODU4.class);
- } else if (sic.getIfCapType().getSimpleName().equals("If100GE")) {
- sclpqList.add(DIGITALSIGNALTYPE100GigE.class);
+ switch (sic.getIfCapType().getSimpleName()) {
+ case "If10GEODU2e":
+ sclpqSet.add(ODUTYPEODU2E.class);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ break;
+ case "If10GEODU2":
+ sclpqSet.add(ODUTYPEODU2.class);
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ break;
+ case "If10GE":
+ sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class);
+ break;
+ case "If100GEODU4":
+ sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+ sclpqSet.add(ODUTYPEODU4.class);
+ break;
+ case "If100GE":
+ sclpqSet.add(DIGITALSIGNALTYPE100GigE.class);
+ break;
+ case "IfOCHOTU4ODU4":
+ case "IfOCH":
+ sclpqSet.add(ODUTYPEODU4.class);
+ break;
+ default:
+ LOG.error("IfCapability type not managed");
+ break;
}
break;
case "PHOTONIC_MEDIA":
- if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")) {
- sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.class);
- sclpqList.add(PHOTONICLAYERQUALIFIEROMS.class);
+ if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")
+ || sic.getIfCapType().getSimpleName().equals("IfOCH")) {
+ sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class);
+ sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class);
}
break;
default:
break;
}
}
- return sclpqList;
+ return new ArrayList<>(sclpqSet);
}
private void createTapiTransitionalLinks() {
.build();
Link transiLink = new LinkBuilder()
.setUuid(new Uuid(
- UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey))
- .getBytes(Charset.forName("UTF-8")))
- .toString()))
+ UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey))
+ .getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setName(Map.of(linkName.key(), linkName))
.setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(),
LayerProtocolName.PHOTONICMEDIA.getName()))
}
}
- private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226
- .networks.network.Link link) {
+ private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.topology.rev180226.networks.network.Link link,
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.topology.rev180226.networks.network.Link oppositeLink) {
String prefix = link.getLinkId().getValue().split("-")[0];
String sourceNode = link.getSource().getSourceNode().getValue();
- String sourceTp = link.getSource().getSourceTp().toString();
+ String sourceTp = link.getSource().getSourceTp().getValue();
String destNode = link.getDestination().getDestNode().getValue();
- String destTp = link.getDestination().getDestTp().toString();
+ String destTp = link.getDestination().getDestTp().getValue();
Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
Uuid sourceUuidTp;
Uuid sourceUuidNode;
Uuid destUuidTp;
Uuid destUuidNode;
Name linkName;
+ AdminStates oppositeLinkAdminState = null;
+ State oppositeLinkOperState = null;
+ if (oppositeLink != null) {
+ oppositeLinkAdminState = oppositeLink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState();
+ oppositeLinkOperState = oppositeLink.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState();
+ }
switch (prefix) {
case "OTU4":
sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, I_OTSI, sourceTp));
.toString()))
.setName(Map.of(linkName.key(), linkName))
.setLayerProtocolName(Arrays.asList(LayerProtocolName.PHOTONICMEDIA))
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(link
+ .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState(), oppositeLinkAdminState))
+ .setOperationalState(setTapiOperationalState(link
+ .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState(), oppositeLinkOperState))
.setDirection(ForwardingDirection.BIDIRECTIONAL)
.setNodeEdgePoint(nepList)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
.setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build())
.build())
.build();
- case "ODU4":
+ case "ODTU4":
sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, DSR, sourceTp));
sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR));
NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder()
.setValue(link.getLinkId().getValue())
.build();
return new LinkBuilder()
- .setUuid(new Uuid(
- UUID.nameUUIDFromBytes((link.getLinkId().getValue())
- .getBytes(Charset.forName("UTF-8")))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((link.getLinkId().getValue())
+ .getBytes(Charset.forName("UTF-8")))
.toString()))
.setName(Map.of(linkName.key(), linkName))
.setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU))
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(link
+ .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getAdministrativeState(), oppositeLinkAdminState))
+ .setOperationalState(setTapiOperationalState(link
+ .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
+ .getOperationalState(), oppositeLinkOperState))
.setDirection(ForwardingDirection.BIDIRECTIONAL)
.setNodeEdgePoint(nepList)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
.build();
Link omsLink = new LinkBuilder()
.setUuid(new Uuid(
- UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString()))
+ UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue()))
+ .getBytes(Charset.forName("UTF-8")))
+ .toString()))
.setName(Map.of(linkName.key(), linkName))
.setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
.setNodeEdgePoint(nepMap)
}
public Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
- getTapiNodes() {
+ getTapiNodes() {
return tapiNodes;
}