package org.opendaylight.transportpce.renderer.provisiondevice;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.stream.Collectors;
import org.opendaylight.transportpce.common.StringConstants;
import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
-import org.opendaylight.transportpce.common.service.ServiceTypes;
import org.opendaylight.transportpce.networkmodel.service.NetworkModelService;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.link.tp.LinkTp;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.link.tp.LinkTpBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterface;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterfaceBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.node.interfaces.NodeInterfaceKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210618.otn.renderer.nodes.Nodes;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.AEndApiInfo;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.az.api.info.ZEndApiInfo;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OpucnTribSlotDef;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTp;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTpBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterface;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterfaceBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.node.interfaces.NodeInterfaceKey;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.otn.renderer.nodes.Nodes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final CrossConnect crossConnect;
private final OpenRoadmInterfaces openRoadmInterfaces;
private final DeviceTransactionManager deviceTransactionManager;
- private final NetworkModelService networkModelService;
public OtnDeviceRendererServiceImpl(OpenRoadmInterfaceFactory openRoadmInterfaceFactory, CrossConnect crossConnect,
OpenRoadmInterfaces openRoadmInterfaces,
this.crossConnect = crossConnect;
this.openRoadmInterfaces = openRoadmInterfaces;
this.deviceTransactionManager = deviceTransactionManager;
- this.networkModelService = networkModelService;
}
//TODO Align log messages and returned results messages
@Override
- public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input) {
+ public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input, String serviceType) {
LOG.info("Calling setup otn-service path");
if (input.getServiceFormat() == null || input.getServiceRate() == null) {
return new OtnServicePathOutputBuilder()
}
List<NodeInterface> nodeInterfaces = new ArrayList<>();
CopyOnWriteArrayList<LinkTp> otnLinkTps = new CopyOnWriteArrayList<>();
- String serviceType = ServiceTypes.getOtnServiceType(input.getServiceFormat(), input.getServiceRate());
try {
switch (serviceType) {
case StringConstants.SERVICE_TYPE_1GE:
}
break;
case StringConstants.SERVICE_TYPE_ODU4:
- createODU4TtpInterface(input, nodeInterfaces, otnLinkTps);
+ createHighOrderInterfaces(input, nodeInterfaces, otnLinkTps);
break;
+ // For all the intermediate rates, device renderer is generalized as
+ // ODUCnTTPinterface method
+ case StringConstants.SERVICE_TYPE_ODUC2:
+ case StringConstants.SERVICE_TYPE_ODUC3:
case StringConstants.SERVICE_TYPE_ODUC4:
- createOduc4TtpInterface(input, nodeInterfaces, otnLinkTps);
+ createOducnTtpInterface(input, nodeInterfaces, otnLinkTps);
+ break;
+ case StringConstants.SERVICE_TYPE_100GE_S:
+ LOG.info("Calling Node interface for service-type {}", serviceType);
+ if (input.getNodes() != null) {
+ createHighOrderInterfaces(input, nodeInterfaces, otnLinkTps);
+ LOG.info("Node interfaces created");
+ }
break;
default:
LOG.error("Service-type {} not managed yet", serviceType);
.build();
}
- public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input) {
+ @SuppressWarnings("rawtypes")
+ // FIXME check if the ForkJoinTask raw type can be avoided
+ // Raw types use are discouraged since they lack type safety.
+ // Resulting Problems are observed at run time and not at compile time
+ public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input, String serviceType) {
if (input.getNodes() == null) {
LOG.error("Unable to delete otn service path. input nodes = null");
return new OtnServicePathOutputBuilder()
// if the node is currently mounted then proceed.
List<String> interfacesToDelete = new LinkedList<>();
String connectionNumber = "";
- switch (input.getServiceRate().intValue()) {
- case 100:
- if ("ODU".equals(input.getServiceFormat())) {
+ switch (serviceType) {
+ case StringConstants.SERVICE_TYPE_100GE_S:
+ connectionNumber = getConnectionNumber(node, networkTp, "ODU4");
+ break;
+ case StringConstants.SERVICE_TYPE_100GE_M:
+ connectionNumber = getConnectionNumber(node, networkTp, "ODU4");
+ otnLinkTps.add(new LinkTpBuilder()
+ .setNodeId(nodeId)
+ .setTpId(networkTp)
+ .build());
+ break;
+ case StringConstants.SERVICE_TYPE_ODU4:
+ if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
interfacesToDelete.add(networkTp + "-ODU4");
- if (node.getNetwork2Tp() != null) {
- interfacesToDelete.add(node.getNetwork2Tp() + "-ODU4");
- }
- } else if ("Ethernet".equals(input.getServiceFormat())) {
- connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU4");
+ otnLinkTps.add(new LinkTpBuilder()
+ .setNodeId(nodeId)
+ .setTpId(networkTp)
+ .build());
+ }
+ if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
+ interfacesToDelete.add(networkTp + "-ODU4");
+ interfacesToDelete.add(node.getNetwork2Tp() + "-ODU4");
+ connectionNumber = getConnectionNumber(node, networkTp, "ODU4");
}
break;
- case 400:
- if ("ODU".equals(input.getServiceFormat())) {
- interfacesToDelete.add(networkTp + "-ODUC4");
- if (node.getNetwork2Tp() != null) {
- interfacesToDelete.add(node.getNetwork2Tp() + "-ODUC4");
- }
+ case StringConstants.SERVICE_TYPE_ODUC2:
+ case StringConstants.SERVICE_TYPE_ODUC3:
+ case StringConstants.SERVICE_TYPE_ODUC4:
+ if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
+ // Service-type can be ODUC2, ODUC3, ODUC4
+ interfacesToDelete.add(networkTp + "-" + serviceType);
+ otnLinkTps.add(new LinkTpBuilder()
+ .setNodeId(nodeId)
+ .setTpId(networkTp)
+ .build());
+ }
+ if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
+ interfacesToDelete.add(networkTp + "-" + serviceType);
+ interfacesToDelete.add(node.getNetwork2Tp() + "-" + serviceType);
+ connectionNumber = getConnectionNumber(node, networkTp, serviceType);
}
break;
- case 10:
- connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU2e");
+ case StringConstants.SERVICE_TYPE_10GE:
+ connectionNumber = getConnectionNumber(node, networkTp, "ODU2e");
+ otnLinkTps.add(new LinkTpBuilder()
+ .setNodeId(nodeId)
+ .setTpId(networkTp)
+ .build());
break;
- case 1:
- connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU0");
+ case StringConstants.SERVICE_TYPE_1GE:
+ connectionNumber = getConnectionNumber(node, networkTp, "ODU0");
+ otnLinkTps.add(new LinkTpBuilder()
+ .setNodeId(nodeId)
+ .setTpId(networkTp)
+ .build());
break;
default:
- LOG.error("service rate {} not managed yet", input.getServiceRate());
- String result = input.getServiceRate() + " is not supported";
+ LOG.error("service-type {} not managed yet", serviceType);
+ String result = serviceType + " is not supported";
results.add(result);
success.set(false);
return;
this.deviceTransactionManager)) {
interfacesToDelete.add(interf);
String supportedInterface = this.openRoadmInterfaces.getSupportedInterface(nodeId, interf);
- if (input.getServiceRate().intValue() == 100) {
- if (!supportedInterface.contains("ODUC4")) {
- interfacesToDelete.add(supportedInterface);
- }
- } else {
- if (!supportedInterface.contains("ODU4")) {
- interfacesToDelete.add(supportedInterface);
- }
+ if (supportedInterface == null) {
+ continue;
+ }
+ // Here ODUC can be ODUC2, ODUC3, ODUC4
+ if ((input.getServiceRate().intValue() == 100 && !supportedInterface.contains("ODUC"))
+ || (input.getServiceRate().intValue() != 100 && !supportedInterface.contains("ODU4"))) {
+ interfacesToDelete.add(supportedInterface);
}
}
}
results.add(result);
}
}
- List<String> interList =
- interfacesToDelete.stream().filter(ele -> ele.contains("NETWORK")).collect(Collectors.toList());
- if (!interList.isEmpty()) {
- for (String inter : interList) {
- otnLinkTps.add(new LinkTpBuilder()
- .setNodeId(nodeId)
- .setTpId(inter.split("-ODU")[0])
- .build());
- }
- }
}));
try {
forkJoinTask.get();
.build();
}
- private String getConnectionNumber(String serviceName, Nodes node, String networkTp, String oduType) {
+ private String getConnectionNumber(Nodes node, String networkTp, String oduType) {
+ List<String> list1 = new ArrayList<>();
+ List<String> list2 = new ArrayList<>(Arrays.asList("x"));
if (node.getClientTp() != null) {
- return String.join("-", node.getClientTp(), oduType, serviceName, "x", networkTp, oduType, serviceName);
+ list1.addAll(Arrays.asList(node.getClientTp(), oduType));
+ list2.addAll(Arrays.asList(networkTp, oduType));
} else if (node.getNetwork2Tp() != null) {
- return String.join("-", networkTp, oduType, serviceName, "x", node.getNetwork2Tp(), oduType, serviceName);
+ list1.addAll(Arrays.asList(networkTp, oduType));
+ list2.addAll(Arrays.asList(node.getNetwork2Tp(), oduType));
} else {
return "";
}
+ list1.addAll(list2);
+ return String.join("-", list1);
}
private Optional<String> postCrossConnect(List<String> createdOduInterfaces, Nodes node)
private void createLowOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
for (Nodes node : input.getNodes()) {
+ AEndApiInfo apiInfoA = null;
+ ZEndApiInfo apiInfoZ = null;
+ if (input.getAEndApiInfo() != null && input.getAEndApiInfo().getNodeId().contains(node.getNodeId())) {
+ apiInfoA = input.getAEndApiInfo();
+ }
+ if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(node.getNodeId())) {
+ apiInfoZ = input.getZEndApiInfo();
+ }
// check if the node is mounted or not?
- List<String> createdEthInterfaces = new ArrayList<>();
- List<String> createdOduInterfaces = new ArrayList<>();
+ Set<String> createdEthInterfaces = new HashSet<>();
+ Set<String> createdOduInterfaces = new HashSet<>();
switch (input.getServiceRate().intValue()) {
case 1:
LOG.info("Input service is 1G");
createdOduInterfaces.add(
// suppporting interface?, payload ?
openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getClientTp(),
- input.getServiceName(), PT_07, false, input.getTribPortNumber(), input.getTribSlot()));
+ input.getServiceName(), false, input.getTribPortNumber(), input.getTribSlot(), apiInfoA,
+ apiInfoZ, PT_07));
}
createdOduInterfaces.add(
openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getNetworkTp(),
- input.getServiceName(), PT_07, true, input.getTribPortNumber(), input.getTribSlot()));
+ input.getServiceName(), true, input.getTribPortNumber(), input.getTribSlot(), null, null,
+ null));
linkTpList.add(
new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
if (node.getNetwork2Tp() != null) {
createdOduInterfaces.add(
// supporting interface? payload ?
openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
- node.getNetwork2Tp(), input.getServiceName(), PT_07, true, input.getTribPortNumber(),
- input.getTribSlot()));
+ node.getNetwork2Tp(), input.getServiceName(), true, input.getTribPortNumber(),
+ input.getTribSlot(), null, null, null));
linkTpList.add(
new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
}
createdOduInterfaces.add(
// suppporting interface?, payload ?
openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
- node.getClientTp(), input.getServiceName(), PT_03, false, input.getTribPortNumber(),
- input.getTribSlot()));
+ node.getClientTp(), false, input.getTribPortNumber(),
+ input.getTribSlot(), apiInfoA, apiInfoZ, PT_03));
}
createdOduInterfaces.add(
// supporting interface? payload ?
openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(), node.getNetworkTp(),
- input.getServiceName(), PT_03, true, input.getTribPortNumber(), input.getTribSlot()));
+ true, input.getTribPortNumber(), input.getTribSlot(), null,
+ null, null));
linkTpList.add(
new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
if (node.getNetwork2Tp() != null) {
createdOduInterfaces.add(
// supporting interface? payload ?
openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
- node.getNetwork2Tp(), input.getServiceName(), PT_03, true, input.getTribPortNumber(),
- input.getTribSlot()));
+ node.getNetwork2Tp(), true, input.getTribPortNumber(),
+ input.getTribSlot(), null, null, null));
linkTpList.add(
new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
}
LOG.info("Input service is 100G");
// Take the first and last value in the list of OpucnTribSlot (assuming SH would provide
// min and max value only, size two)
- OpucnTribSlotDef minOpucnTs = OpucnTribSlotDef.getDefaultInstance(
- input.getOpucnTribSlots().get(0).getValue());
- OpucnTribSlotDef maxOpucnTs = OpucnTribSlotDef.getDefaultInstance(
- input.getOpucnTribSlots().get(1).getValue());
+ OpucnTribSlotDef minOpucnTs = input.getOpucnTribSlots().stream()
+ .min((ts1, ts2) -> ts1.getValue().compareTo(ts2.getValue())).get();
+ OpucnTribSlotDef maxOpucnTs = input.getOpucnTribSlots().stream()
+ .max((ts1, ts2) -> ts1.getValue().compareTo(ts2.getValue())).get();
if (node.getClientTp() != null) {
createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
node.getNodeId(), node.getClientTp()));
}
// implement cross connect
- List<String> createdConnections = new ArrayList<>();
+ Set<String> createdConnections = new HashSet<>();
if (!createdOduInterfaces.isEmpty()) {
- Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
+ Optional<String> connectionNameOpt = postCrossConnect(new ArrayList<>(createdOduInterfaces), node);
createdConnections.add(connectionNameOpt.get());
LOG.info("Created cross connects");
}
}
}
- private void createOduc4TtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
- CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
- if (input.getNodes() == null) {
- return;
- }
- LOG.info("Creation of ODUC4 TTP interface in OTN service path {}", input);
- for (int i = 0; i < input.getNodes().size(); i++) {
- Nodes node = input.getNodes().get(i);
- String supportingOtuInterface = node.getNetworkTp() + "-OTUC4";
-
- Nodes tgtNode =
- i + 1 == input.getNodes().size()
- // For the end node, tgtNode becomes the first node in the list
- ? input.getNodes().get(0)
- : input.getNodes().get(i + 1);
+ private void createHighOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
+ CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
+ for (Nodes node : input.nonnullNodes()) {
+ AEndApiInfo apiInfoA = null;
+ ZEndApiInfo apiInfoZ = null;
+ if (input.getAEndApiInfo() != null && input.getAEndApiInfo().getNodeId().contains(node.getNodeId())) {
+ apiInfoA = input.getAEndApiInfo();
+ }
+ if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(node.getNodeId())) {
+ apiInfoZ = input.getZEndApiInfo();
+ }
+ // check if the node is mounted or not?
+ Set<String> createdEthInterfaces = new HashSet<>();
+ Set<String> createdOduInterfaces = new HashSet<>();
+ switch (input.getServiceRate().intValue()) {
+ case 100:
+ LOG.info("Input service is 100G");
+ if (node.getClientTp() != null && node.getNetwork2Tp() == null) {
+ createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
+ node.getNodeId(), node.getClientTp()));
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+ node.getNodeId(), node.getClientTp(), false, apiInfoA, apiInfoZ, "21"));
+ // supporting interface? payload ?
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+ node.getNodeId(), node.getNetworkTp(), true, null, null, null));
+ linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getClientTp())
+ .build());
+ }
+ if (node.getClientTp() == null && node.getNetwork2Tp() == null) {
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+ node.getNodeId(), node.getNetworkTp(), false, apiInfoA, apiInfoZ, "21"));
+ linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp())
+ .build());
+ }
+ if (node.getClientTp() == null && node.getNetwork2Tp() != null) {
+ // supporting interface? payload ?
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+ node.getNodeId(), node.getNetworkTp(), true, null, null, null));
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+ node.getNodeId(), node.getNetwork2Tp(), true, null, null, null));
+ }
+ break;
+ default:
+ LOG.error("service rate {} not managed yet", input.getServiceRate());
+ return;
+ }
+ // implement cross connect
+ Set<String> createdConnections = new HashSet<>();
+ if (createdOduInterfaces.size() == 2) {
+ Optional<String> connectionNameOpt = postCrossConnect(new ArrayList<>(createdOduInterfaces), node);
+ createdConnections.add(connectionNameOpt.get());
+ LOG.info("Created cross connects");
+ }
nodeInterfaces.add(new NodeInterfaceBuilder()
.withKey(new NodeInterfaceKey(node.getNodeId()))
.setNodeId(node.getNodeId())
- .setOduInterfaceId(List.of(
- // though this is odu, actually it has ODUC4 interfaces
- openRoadmInterfaceFactory.createOpenRoadmOtnOduc4Interface(node.getNodeId(),
- node.getNetworkTp(), supportingOtuInterface, tgtNode.getNodeId(), tgtNode.getNetworkTp())))
+ .setConnectionId(createdConnections)
+ .setEthInterfaceId(createdEthInterfaces)
+ .setOduInterfaceId(createdOduInterfaces)
.build());
- linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
}
}
- private void createODU4TtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
+ private void createOducnTtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
if (input.getNodes() == null) {
return;
}
- LOG.info("Creation of ODU4 tp interface {}", input);
+ if (input.getServiceRate() == null) {
+ LOG.error("Missing service rate for ODUCn interface");
+ return;
+ }
+ LOG.info("Creation of ODUCn TTP interface in OTN service path {}", input);
for (int i = 0; i < input.getNodes().size(); i++) {
Nodes node = input.getNodes().get(i);
- String supportingOtuInterface = node.getNetworkTp() + "-OTU";
+ // Based on the service rate, we will know if it is a OTUC4, OTUC3 or OTUC2
+ String supportingOtuInterface = node.getNetworkTp();
+ boolean serviceRateNotSupp = false;
+
+ switch (input.getServiceRate().intValue()) {
+ case 200:
+ supportingOtuInterface += "-OTUC2";
+ break;
+ case 300:
+ supportingOtuInterface += "-OTUC3";
+ break;
+ case 400:
+ supportingOtuInterface += "-OTUC4";
+ break;
+ default:
+ serviceRateNotSupp = true;
+ break;
+ }
+ if (serviceRateNotSupp) {
+ LOG.error("Service rate {} is not supported", input.getServiceRate());
+ }
Nodes tgtNode =
i + 1 == input.getNodes().size()
nodeInterfaces.add(new NodeInterfaceBuilder()
.withKey(new NodeInterfaceKey(node.getNodeId()))
.setNodeId(node.getNodeId())
- .setOduInterfaceId(List.of(
- openRoadmInterfaceFactory.createOpenRoadmOtnOdu4Interface(node.getNodeId(),
+ .setOduInterfaceId(Set.of(
+ // though this is odu, actually it has ODUCn interfaces
+ openRoadmInterfaceFactory.createOpenRoadmOtnOducnInterface(node.getNodeId(),
node.getNetworkTp(), supportingOtuInterface, tgtNode.getNodeId(), tgtNode.getNetworkTp())))
.build());
linkTpList.add(new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());