for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network
.Link link : rdmTordmLinkList) {
if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
- Link tapiLink = createTapiOmsLink(link);
+ Link tapiLink = createTapiOmsLink(link, rdmTordmLinkList.stream()
+ .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink()))
+ .findAny().orElse(null));
linksToNotConvert.add(link
.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class)
.getOppositeLink().getValue());
}
public void convertRoadmNode(Node roadm, Network openroadmTopo) {
+ this.ietfNodeId = roadm.getNodeId().getValue();
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist = new HashMap<>();
// 1. Get degree and srg nodes to map TPs into NEPs
if (openroadmTopo.getNode() == null) {
List<Node> nodeList = new ArrayList<Node>(openroadmTopo.getNode().values());
for (Node node:nodeList) {
if (node.getSupportingNode().values().stream().noneMatch(sp -> sp.getNodeRef().getValue()
- .equals(roadm.getNodeId().getValue()))) {
+ .equals(this.ietfNodeId))) {
LOG.warn("Abstracted node {} is not part of {}",
- node.getNodeId().getValue(), roadm.getNodeId().getValue());
+ node.getNodeId().getValue(), this.ietfNodeId);
continue;
}
if (node.augmentation(Node1.class) == null
// Convert TP List in NEPs and put it in onepl
LOG.info("Degree port List: {}", degPortList);
// TODO: deg port could be sip. e.g. MDONS
- oneplist.putAll(populateNepsForRdmNode(roadm.getNodeId().getValue(), degPortList, false));
+ oneplist.putAll(populateNepsForRdmNode(degPortList, false));
// oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), degPortList, false));
numNeps += degPortList.size() * 3;
break;
.collect(Collectors.toList());
// Convert TP List in NEPs and put it in onepl
LOG.info("Srg port List: {}", srgPortList);
- oneplist.putAll(populateNepsForRdmNode(roadm.getNodeId().getValue(), srgPortList, true));
+ oneplist.putAll(populateNepsForRdmNode(srgPortList, true));
// oneplist.putAll(populateNepsForRdmNode(node.getNodeId().getValue(), srgPortList, true));
numNeps += srgPortList.size() * 3;
numSips += srgPortList.size();
return onepBldr.build();
}
- private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(String nodeId,
- List<TerminationPoint> tpList,
+ private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(List<TerminationPoint> tpList,
boolean withSip) {
// create neps for MC and OTSiMC and Photonic Media
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
- for (int i = 0; i < tpList.size(); i++) {
+ for (TerminationPoint tp:tpList) {
+ // Admin and oper state common for all tps
+ AdminStates admin = tp.augmentation(TerminationPoint1.class).getAdministrativeState();
+ State oper = tp.augmentation(TerminationPoint1.class).getOperationalState();
// PHOTONIC MEDIA nep
- LOG.info("NEP = {}", String.join("+", nodeId, PHTNC_MEDIA, tpList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, PHTNC_MEDIA,
- tpList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
+ LOG.info("PHOTO NEP = {}", String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()));
Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
- .setValue(String.join("+", nodeId, PHTNC_MEDIA, tpList.get(i).getTpId().getValue()))
+ .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, PHTNC_MEDIA, tp.getTpId().getValue()))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+
+ OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, PHTNC_MEDIA,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(admin))
+ .setOperationalState(setTapiOperationalState(oper))
.setLifecycleState(LifecycleState.INSTALLED)
.setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep = onepBldr.build();
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
onepMap.put(onep.key(), onep);
- }
- for (int i = 0; i < tpList.size(); i++) {
+
// MC nep
- LOG.info("NEP = {}", String.join("+", nodeId, MC, tpList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, MC,
- tpList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
- Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
- .setValue(String.join("+", nodeId, MC, tpList.get(i).getTpId().getValue()))
+ LOG.info("MC NEP = {}", String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()));
+ Name nepName1 = new NameBuilder()
+ .setValueName(MC + "NodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, MC, tp.getTpId().getValue()))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+ OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, MC,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
+ .setName(Map.of(nepName1.key(), nepName1))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(admin))
+ .setOperationalState(setTapiOperationalState(oper))
.setLifecycleState(LifecycleState.INSTALLED)
.setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
if (withSip) {
- onepBldr.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
- tpList.get(i), String.join("+", nodeId, MC)));
+ onepBldr1.setMappedServiceInterfacePoint(createMSIP(1, LayerProtocolName.PHOTONICMEDIA,
+ tp, String.join("+", this.ietfNodeId, MC)));
}
- OwnedNodeEdgePoint onep = onepBldr.build();
- onepMap.put(onep.key(), onep);
- }
- for (int i = 0; i < tpList.size(); i++) {
+ OwnedNodeEdgePoint onep1 = onepBldr1.build();
+ onepMap.put(onep1.key(), onep1);
+
// OTSiMC nep
- LOG.info("NEP = {}", String.join("+", nodeId, OTSI_MC, tpList.get(i).getTpId().getValue()));
- Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId, OTSI_MC,
- tpList.get(i).getTpId().getValue()))
- .getBytes(Charset.forName("UTF-8")))
- .toString());
- Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
- .setValue(String.join("+", nodeId, OTSI_MC, tpList.get(i).getTpId().getValue()))
+ LOG.info("OTSi NEP = {}", String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()));
+ Name nepName2 = new NameBuilder()
+ .setValueName(OTSI_MC + "NodeEdgePoint")
+ .setValue(String.join("+", this.ietfNodeId, OTSI_MC, tp.getTpId().getValue()))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
+
+ OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI_MC,
+ tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
+ .setName(Map.of(nepName2.key(), nepName2))
.setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(admin))
+ .setOperationalState(setTapiOperationalState(oper))
.setLifecycleState(LifecycleState.INSTALLED)
.setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep = onepBldr.build();
- onepMap.put(onep.key(), onep);
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
+ onepMap.put(onep2.key(), onep2);
}
return onepMap;
}
.build();
ruleList.put(rule.key(), rule);
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group").getBytes(Charset.forName("UTF-8")))
- .toString()))
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((this.ietfNodeId + " node rule group")
+ .getBytes(Charset.forName("UTF-8"))).toString()))
.setRule(ruleList)
.setNodeEdgePoint(nepMap)
.build();
.setUuid(sipUuid)
.setName(Map.of(sipName.key(), sipName))
.setLayerProtocolName(layerProtocol)
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
+ .setAdministrativeState(setTapiAdminState(
+ tp.augmentation(TerminationPoint1.class).getAdministrativeState()))
+ .setOperationalState(setTapiOperationalState(
+ tp.augmentation(TerminationPoint1.class).getOperationalState()))
.setLifecycleState(LifecycleState.INSTALLED)
.setAvailableCapacity(new AvailableCapacityBuilder().build())
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().build())
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .setAdministrativeState(AdministrativeState.UNLOCKED)
- .setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
}
private Link createTapiOmsLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.topology.rev180226.networks.network.Link link) {
+ .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 sourceNode = getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue());
String sourceTp = link.getSource().getSourceTp().getValue();
String destNode = getIdBasedOnModelVersion(link.getDestination().getDestNode().getValue());
- String destTp = link.getDestination().getDestTp().getValue();
+ String destTp = link.getDestination().getDestTp().toString();
+ 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();
+ }
Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
Uuid sourceUuidNode = new Uuid(UUID.nameUUIDFromBytes((String.join("+", sourceNode,
PHTNC_MEDIA)).getBytes(Charset.forName("UTF-8"))).toString());
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .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))
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
.ietf.network.topology.rev180226.networks.network.Link link:xpdrRdmLinkList) {
if (!linksToNotConvert.contains(link.getLinkId().getValue())) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.topology.rev180226.networks.network.Link oppositeLink = xpdrRdmLinkList.stream()
+ .filter(l -> l.getLinkId().equals(link.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.network.rev200529.Link1.class).getOppositeLink())).findAny().orElse(null);
+
+ 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();
+ }
+
String sourceNode = (link.getSource().getSourceNode().getValue().contains("ROADM"))
? getIdBasedOnModelVersion(link.getSource().getSourceNode().getValue())
: link.getSource().getSourceNode().getValue();
.setResilienceType(new ResilienceTypeBuilder().setProtectionType(ProtectionType.NOPROTECTON)
.setRestorationPolicy(RestorationPolicy.NA)
.build())
- .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))
.setLifecycleState(LifecycleState.INSTALLED)
.setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize(
new TotalSizeBuilder().setUnit(CapacityUnit.GBPS)
.getBytes(Charset.forName("UTF-8")))
.toString());
Name nepName = new NameBuilder()
- .setValueName("NodeEdgePoint name")
+ .setValueName(PHTNC_MEDIA + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, PHTNC_MEDIA, tpId))
.build();
- OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid)
- .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
- .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState).setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep = onepBldr.build();
+ OwnedNodeEdgePoint onep = new OwnedNodeEdgePointBuilder()
+ .setUuid(nepUuid)
+ .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+ .setName(Map.of(nepName.key(), nepName))
+ .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(adminState).setOperationalState(operState)
+ .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
onepMap.put(onep.key(), onep);
// MC nep
.getBytes(Charset.forName("UTF-8")))
.toString());
Name nepName1 = new NameBuilder()
- .setValueName("NodeEdgePoint name")
+ .setValueName(MC + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, MC, tpId))
.build();
OwnedNodeEdgePointBuilder onepBldr1 = new OwnedNodeEdgePointBuilder()
.getBytes(Charset.forName("UTF-8")))
.toString());
Name nepName2 = new NameBuilder()
- .setValueName("NodeEdgePoint name")
+ .setValueName(OTSI_MC + "NodeEdgePoint")
.setValue(String.join("+", orNodeId, OTSI_MC, tpId))
.build();
- OwnedNodeEdgePointBuilder onepBldr2 = new OwnedNodeEdgePointBuilder()
- .setUuid(nepUuid2)
- .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
- .setName(Map.of(nepName2.key(), nepName2))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
- .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
- .setAdministrativeState(adminState).setOperationalState(operState)
- .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
- .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL);
- OwnedNodeEdgePoint onep2 = onepBldr2.build();
+
+ OwnedNodeEdgePoint onep2 = new OwnedNodeEdgePointBuilder()
+ .setUuid(nepUuid2)
+ .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+ .setName(Map.of(nepName2.key(), nepName2))
+ .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(adminState).setOperationalState(operState)
+ .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
+ .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL)
+ .build();
onepMap.put(onep2.key(), onep2);
return onepMap;
}
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
.setOwnedNodeEdgePoint(oneplist)
- .setNodeRuleGroup(createNodeRuleGroupForRdmNode(nodeUuid, oneplist.values()))
+ .setNodeRuleGroup(createNodeRuleGroupForRdmNode(orNodeId, nodeUuid, oneplist.values()))
.setCostCharacteristic(Map.of(costCharacteristic.key(), costCharacteristic))
.setLatencyCharacteristic(Map.of(latencyCharacteristic.key(), latencyCharacteristic))
.setErrorCharacteristic("error")
.build();
}
- private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(Uuid nodeUuid,
+ private Map<NodeRuleGroupKey, NodeRuleGroup> createNodeRuleGroupForRdmNode(String orNodeId, Uuid nodeUuid,
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>
.build();
ruleList.put(rule.key(), rule);
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
- .setUuid(new Uuid(UUID.nameUUIDFromBytes(("rdm infra node rule group")
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((orNodeId + " node rule group")
.getBytes(Charset.forName("UTF-8"))).toString()))
.setRule(ruleList)
.setNodeEdgePoint(nepMap)
public Topology createFullOtnTopology() throws TapiTopologyException {
// read openroadm-topology
Network openroadmTopo = readTopology(InstanceIdentifiers.OVERLAY_NETWORK_II);
- List<Link> linkList = new ArrayList<>();
- if (openroadmTopo.augmentation(Network1.class) != null) {
- linkList.addAll(openroadmTopo.augmentation(Network1.class).getLink().values());
- }
- List<Link> xponderOutLinkList = linkList.stream()
- .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
- .collect(Collectors.toList());
- List<Link> xponderInLinkList = linkList.stream()
- .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
- .collect(Collectors.toList());
- // read otn-topology
- Network otnTopo = readTopology(InstanceIdentifiers.OTN_NETWORK_II);
- Map<NodeId, org.opendaylight.yang.gen.v1.urn
- .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node> otnNodeMap = otnTopo.nonnullNode()
- .values().stream().collect(Collectors.toMap(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
- .ietf.network.rev180226.networks.network.Node::getNodeId, node -> node));
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.T0_FULL_MULTILAYER
+ .getBytes(Charset.forName("UTF-8"))).toString());
+ Name name = new NameBuilder().setValue(TopologyUtils.T0_FULL_MULTILAYER).setValueName("TAPI Topology Name")
+ .build();
+ if (openroadmTopo != null) {
+ List<Link> linkList = new ArrayList<>();
+ if (openroadmTopo.augmentation(Network1.class) != null) {
+ linkList.addAll(openroadmTopo.augmentation(Network1.class).getLink().values());
+ }
+ List<Link> xponderOutLinkList = linkList.stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))
+ .collect(Collectors.toList());
+ List<Link> xponderInLinkList = linkList.stream()
+ .filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.XPONDERINPUT))
+ .collect(Collectors.toList());
+ // read otn-topology
+ Network otnTopo = readTopology(InstanceIdentifiers.OTN_NETWORK_II);
+ Map<NodeId, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.rev180226.networks.network.Node> otnNodeMap = otnTopo.nonnullNode()
+ .values().stream().collect(Collectors.toMap(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.rev180226.networks.network.Node::getNodeId, node -> node));
- Map<String, List<String>> networkPortMap = new HashMap<>();
- Iterator<Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
- .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node>> itOtnNodeMap = otnNodeMap
- .entrySet().iterator();
- while (itOtnNodeMap.hasNext()) {
- Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
- .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node> entry = itOtnNodeMap.next();
- String portMappingNodeId = entry.getValue().getSupportingNode().values().stream()
- .filter(sn -> sn.getNetworkRef().getValue().equals(NetworkUtils.UNDERLAY_NETWORK_ID))
- .findFirst()
- .get().getNodeRef().getValue();
- List<String> networkPortList = new ArrayList<>();
- for (TerminationPoint tp: entry.getValue().augmentation(Node1.class).getTerminationPoint().values()) {
- // TODO -> why are we checking with respect to XPDR links?? Is there a real purpose on doing that?
- if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)
- && checkTp(entry.getKey().getValue(), portMappingNodeId, tp, xponderOutLinkList,
- xponderInLinkList)) {
- networkPortList.add(tp.getTpId().getValue());
+ Map<String, List<String>> networkPortMap = new HashMap<>();
+ Iterator<Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
+ .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node>> itOtnNodeMap = otnNodeMap
+ .entrySet().iterator();
+ while (itOtnNodeMap.hasNext()) {
+ Map.Entry<NodeId, org.opendaylight.yang.gen.v1.urn
+ .ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node> entry = itOtnNodeMap.next();
+ String portMappingNodeId = entry.getValue().getSupportingNode().values().stream()
+ .filter(sn -> sn.getNetworkRef().getValue().equals(NetworkUtils.UNDERLAY_NETWORK_ID))
+ .findFirst()
+ .get().getNodeRef().getValue();
+ List<String> networkPortList = new ArrayList<>();
+ for (TerminationPoint tp: entry.getValue().augmentation(Node1.class).getTerminationPoint().values()) {
+ // TODO -> why are we checking with respect to XPDR links?? Is there a real purpose on doing that?
+ if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERNETWORK)
+ && checkTp(entry.getKey().getValue(), portMappingNodeId, tp, xponderOutLinkList,
+ xponderInLinkList)) {
+ networkPortList.add(tp.getTpId().getValue());
+ }
+ }
+ if (!networkPortList.isEmpty()) {
+ networkPortMap.put(entry.getKey().getValue(), networkPortList);
}
}
- if (!networkPortList.isEmpty()) {
- networkPortMap.put(entry.getKey().getValue(), networkPortList);
+ Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
+ tapiNodeList = new HashMap<>();
+ Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link>
+ tapiLinkList = new HashMap<>();
+ ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topoUuid);
+ Iterator<Map.Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
+ while (it.hasNext()) {
+ String nodeId = it.next().getKey();
+ tapiFactory.convertNode(otnNodeMap.get(new NodeId(nodeId)), networkPortMap.get(nodeId));
+ tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
}
- }
- Map<NodeKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node>
- tapiNodeList = new HashMap<>();
- Map<LinkKey, org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link>
- tapiLinkList = new HashMap<>();
- Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(TopologyUtils.T0_FULL_MULTILAYER
- .getBytes(Charset.forName("UTF-8"))).toString());
- ConvertORTopoToTapiFullTopo tapiFactory = new ConvertORTopoToTapiFullTopo(topoUuid);
- Iterator<Map.Entry<String, List<String>>> it = networkPortMap.entrySet().iterator();
- while (it.hasNext()) {
- String nodeId = it.next().getKey();
- tapiFactory.convertNode(otnNodeMap.get(new NodeId(nodeId)), networkPortMap.get(nodeId));
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
- }
- // roadm infrastructure not abstracted
- // read openroadm-network
- Network openroadmNet = readTopology(InstanceIdentifiers.UNDERLAY_NETWORK_II);
- if (openroadmNet != null && openroadmNet.nonnullNode().values().stream().filter(nt ->
+ // roadm infrastructure not abstracted
+ // read openroadm-network
+ Network openroadmNet = readTopology(InstanceIdentifiers.UNDERLAY_NETWORK_II);
+ if (openroadmNet != null && openroadmNet.nonnullNode().values().stream().filter(nt ->
nt.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class)
- .getNodeType().equals(OpenroadmNodeType.ROADM)).count() > 0) {
- // map roadm nodes
- for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node
- roadm:openroadmNet.nonnullNode().values().stream().filter(
- nt -> nt.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.common.network.rev200529.Node1.class)
- .getNodeType().equals(OpenroadmNodeType.ROADM))
+ .getNodeType().equals(OpenroadmNodeType.ROADM)).count() > 0) {
+ // map roadm nodes
+ for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang
+ .ietf.network.rev180226.networks.network.Node roadm:openroadmNet.nonnullNode().values().stream()
+ .filter(nt -> nt.augmentation(org.opendaylight.yang.gen.v1.http
+ .org.openroadm.common.network.rev200529.Node1.class)
+ .getNodeType().equals(OpenroadmNodeType.ROADM))
.collect(Collectors.toList())) {
- tapiFactory.convertRoadmNode(roadm, openroadmTopo);
- tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ tapiFactory.convertRoadmNode(roadm, openroadmTopo);
+ tapiNodeList.putAll(tapiFactory.getTapiNodes());
+ }
+ } else {
+ LOG.warn("No roadm nodes exist in the network");
}
- } else {
- LOG.warn("No roadm nodes exist in the network");
- }
- // map roadm to roadm link
- List<Link> rdmTordmLinkList = linkList.stream()
+ // map roadm to roadm link
+ List<Link> rdmTordmLinkList = linkList.stream()
.filter(lk -> lk.augmentation(Link1.class).getLinkType().equals(OpenroadmLinkType.ROADMTOROADM))
.collect(Collectors.toList());
- tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
- // map xpdr_input to roadm and xpdr_output to roadm links.
- xponderInLinkList.addAll(xponderOutLinkList);
- tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ tapiFactory.convertRdmToRdmLinks(rdmTordmLinkList);
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ // map xpdr_input to roadm and xpdr_output to roadm links.
+ xponderInLinkList.addAll(xponderOutLinkList);
+ tapiFactory.convertXpdrToRdmLinks(xponderInLinkList);
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
- if (otnTopo.augmentation(Network1.class) != null) {
- Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
+ if (otnTopo.augmentation(Network1.class) != null) {
+ Map<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks
.network.LinkKey, Link> otnLinkMap = otnTopo.augmentation(Network1.class).getLink();
- tapiFactory.convertLinks(otnLinkMap);
- tapiLinkList.putAll(tapiFactory.getTapiLinks());
- }
- Name name = new NameBuilder().setValue(TopologyUtils.T0_FULL_MULTILAYER).setValueName("TAPI Topology Name")
- .build();
- // Retrieve created sips map in TapiFactory when mapping all the nodes
- this.tapiSips = tapiFactory.getTapiSips();
- return new TopologyBuilder()
+ tapiFactory.convertLinks(otnLinkMap);
+ tapiLinkList.putAll(tapiFactory.getTapiLinks());
+ }
+ // Retrieve created sips map in TapiFactory when mapping all the nodes
+ this.tapiSips = tapiFactory.getTapiSips();
+ return new TopologyBuilder()
.setName(Map.of(name.key(), name))
.setUuid(topoUuid)
.setNode(tapiNodeList)
.setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
- LayerProtocolName.DSR))
+ LayerProtocolName.DSR))
.setLink(tapiLinkList).build();
+ }
+ return new TopologyBuilder()
+ .setName(Map.of(name.key(), name))
+ .setUuid(topoUuid)
+ .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
+ LayerProtocolName.DSR))
+ .build();
}
public Map<ServiceInterfacePointKey, ServiceInterfacePoint> getSipMap() {
topologyBuilder.setNode(mapNode);
return topologyBuilder.build();
}
-
-}
+}
\ No newline at end of file