import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.OtsAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev181019.ots.container.OtsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODU4;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODUCTP;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODUTTP;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODUTTPCTP;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.OTU4;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.OduFunctionIdentity;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.PayloadTypeDef;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.OduAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.odu.container.OduBuilder;
return ochInterfaceBldr.getName();
}
+ public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isNetworkPort,
+ String supportingInterface) throws OpenRoadmInterfaceException {
+ Mapping mapping = portMapping.getMapping(nodeId, logicalConnPoint);
+ if (mapping == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ }
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
+ logicalConnPoint + "-ODU4");
+ if (supportingInterface != null) {
+ oduInterfaceBldr.setSupportingInterface(supportingInterface);
+ }
+
+ // ODU interface specific data
+ Class<? extends OduFunctionIdentity> oduFunction = isNetworkPort ? ODUCTP.class : ODUTTPCTP.class;
+ // TODO look at imports of different versions of class
+ oduInterfaceBldr.addAugmentation(
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder()
+ .setOdu(new OduBuilder()
+ .setRate(ODU4.class)
+ .setOduFunction(oduFunction)
+ .setMonitoringMode(OduAttributes.MonitoringMode.Terminated)
+ .setOpu(
+ new OpuBuilder()
+ .setPayloadType(PayloadTypeDef.getDefaultInstance("07"))
+ .setExpPayloadType(PayloadTypeDef.getDefaultInstance("07")).build()).build())
+ .build());
+
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(nodeId, oduInterfaceBldr);
+ return oduInterfaceBldr.getName();
+ }
+
public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
throws OpenRoadmInterfaceException {
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
}
}
+ /**
+ * This methods creates an ODU interface on the given termination point.
+ *
+ * @param nodeId node ID
+ * @param logicalConnPoint logical connection point
+ * @param isNetworkPort to distinguish a CTP from a TTP
+ * @param supportingInterface supporting OTU4 or 100GE interface
+ * @return Name of the interface if successful, otherwise return null.
+ * @throws OpenRoadmInterfaceException OpenRoadm interface exception
+ */
+
+ public String createOpenRoadmOdu4HOInterface(String nodeId, String logicalConnPoint, boolean isNetworkPort,
+ String supportingInterface) throws OpenRoadmInterfaceException {
+ switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
+ case StringConstants.OPENROADM_DEVICE_VERSION_1_2_1:
+ LOG.error(OTN_FUNTIONS_ARE_NOT_SUPPORTED_BY_OPENROADM_MODELS_1_2_1_MSG);
+ return null;
+ case StringConstants.OPENROADM_DEVICE_VERSION_2_2_1:
+ return openRoadmInterface221.createOpenRoadmOdu4HOInterface(nodeId, logicalConnPoint, isNetworkPort,
+ supportingInterface);
+ default:
+ return null;
+ }
+ }
+
/**
* This methods creates an OTU interface on the given termination point.
*
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.OtnServicePathOutput;
public interface OtnDeviceRendererService {
- OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input);
+ OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input, String serviceType);
- OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input);
+ OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input, String serviceType);
}
package org.opendaylight.transportpce.renderer.provisiondevice;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
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;
//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:
case StringConstants.SERVICE_TYPE_ODUC4:
createOduc4TtpInterface(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);
return new OtnServicePathOutputBuilder()
// 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) {
+ 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())) {
- 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");
+ switch (serviceType) {
+ case StringConstants.SERVICE_TYPE_100GE_S:
+ connectionNumber = getConnectionNumber(null, node, networkTp, "ODU4");
+ break;
+ case StringConstants.SERVICE_TYPE_100GE_M:
+ connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU4");
+ break;
+ case StringConstants.SERVICE_TYPE_ODU4:
+ interfacesToDelete.add(networkTp + "-ODU4");
+ if (node.getNetwork2Tp() != null) {
+ interfacesToDelete.add(node.getNetwork2Tp() + "-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_ODUC4:
+ interfacesToDelete.add(networkTp + "-ODUC4");
+ if (node.getNetwork2Tp() != null) {
+ interfacesToDelete.add(node.getNetwork2Tp() + "-ODUC4");
}
break;
- case 10:
+ case StringConstants.SERVICE_TYPE_10GE:
connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU2e");
break;
- case 1:
+ case StringConstants.SERVICE_TYPE_1GE:
connectionNumber = getConnectionNumber(input.getServiceName(), node, networkTp, "ODU0");
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;
+ }
+ if ((input.getServiceRate().intValue() == 100 && !supportedInterface.contains("ODUC4"))
+ || (input.getServiceRate().intValue() != 100 && !supportedInterface.contains("ODU4"))) {
+ interfacesToDelete.add(supportedInterface);
}
}
}
}
private String getConnectionNumber(String serviceName, 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 "";
}
+ if (serviceName != null) {
+ list1.add(serviceName);
+ list2.add(serviceName);
+ }
+ list1.addAll(list2);
+ return String.join("-", list1);
}
private Optional<String> postCrossConnect(List<String> createdOduInterfaces, Nodes node)
}
}
+ private void createHighOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
+ CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
+ for (Nodes node : input.getNodes()) {
+ // check if the node is mounted or not?
+ List<String> createdEthInterfaces = new ArrayList<>();
+ List<String> createdOduInterfaces = new ArrayList<>();
+ switch (input.getServiceRate().intValue()) {
+ case 100:
+ LOG.info("Input service is 100G");
+ if (node.getClientTp() != null) {
+ String supEthInter = openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
+ node.getNodeId(), node.getClientTp());
+ createdEthInterfaces.add(supEthInter);
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(
+ node.getNodeId(), node.getClientTp(), false, supEthInter));
+ }
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(node.getNodeId(), node.getNetworkTp(),
+ true, null));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ if (node.getNetwork2Tp() != null) {
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu4HOInterface(node.getNodeId(),
+ node.getNetwork2Tp(), true, null));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ }
+ break;
+ default:
+ LOG.error("service rate {} not managed yet", input.getServiceRate());
+ return;
+ }
+
+ // implement cross connect
+ List<String> createdConnections = new ArrayList<>();
+ if (!createdOduInterfaces.isEmpty()) {
+ Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
+ createdConnections.add(connectionNameOpt.get());
+ LOG.info("Created cross connects");
+ }
+ nodeInterfaces.add(new NodeInterfaceBuilder()
+ .withKey(new NodeInterfaceKey(node.getNodeId()))
+ .setNodeId(node.getNodeId())
+ .setConnectionId(createdConnections)
+ .setEthInterfaceId(createdEthInterfaces)
+ .setOduInterfaceId(createdOduInterfaces)
+ .build());
+ }
+ }
+
private void createOduc4TtpInterface(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
if (input.getNodes() == null) {
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerTurndownOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.get.pm.output.Measurements;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.RendererRpcResultSp;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.RendererRpcResultSpBuilder;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.ServiceDeleteInput;
case StringConstants.SERVICE_TYPE_1GE:
case StringConstants.SERVICE_TYPE_10GE:
case StringConstants.SERVICE_TYPE_100GE_M:
+ case StringConstants.SERVICE_TYPE_100GE_S:
case StringConstants.SERVICE_TYPE_ODU4:
case StringConstants.SERVICE_TYPE_ODUC4:
if (!manageOtnServicePathCreation(input, serviceType, serviceRate)) {
OPERATION_FAILED);
}
PathDescription pathDescription = pathDescriptionOpt.get();
+ Mapping mapping = portMapping.getMapping(service.getServiceAEnd().getNodeId().getValue(),
+ service.getServiceAEnd().getTxDirection().getPort().getPortName());
String serviceType = ServiceTypes.getServiceType(service.getServiceAEnd().getServiceFormat().getName(),
- service.getServiceAEnd().getServiceRate(), portMapping.getMapping(service.getServiceAEnd()
- .getNodeId().getValue(), service.getServiceAEnd().getTxDirection().getPort().getPortName()));
+ service.getServiceAEnd().getServiceRate(), mapping);
switch (serviceType) {
case StringConstants.SERVICE_TYPE_100GE_T:
case StringConstants.SERVICE_TYPE_400GE:
case StringConstants.SERVICE_TYPE_1GE:
case StringConstants.SERVICE_TYPE_10GE:
case StringConstants.SERVICE_TYPE_100GE_M:
+ case StringConstants.SERVICE_TYPE_100GE_S:
case StringConstants.SERVICE_TYPE_ODU4:
case StringConstants.SERVICE_TYPE_ODUC4:
if (!manageOtnServicePathDeletion(serviceName, pathDescription, service, serviceType)) {
value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "call in call() method")
private List<OtnDeviceRenderingResult> otnDeviceRendering(RollbackProcessor rollbackProcessor,
- OtnServicePathInput otnServicePathAtoZ, OtnServicePathInput otnServicePathZtoA) {
+ OtnServicePathInput otnServicePathAtoZ, OtnServicePathInput otnServicePathZtoA, String serviceType) {
LOG.info(RENDERING_DEVICES_A_Z_MSG);
sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
otnServicePathAtoZ.getServiceName(), RpcStatusEx.Pending,
RENDERING_DEVICES_A_Z_MSG);
ListenableFuture<OtnDeviceRenderingResult> atozrenderingFuture =
- this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathAtoZ));
+ this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathAtoZ, serviceType));
LOG.info(RENDERING_DEVICES_Z_A_MSG);
sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
otnServicePathZtoA.getServiceName(), RpcStatusEx.Pending,
RENDERING_DEVICES_Z_A_MSG);
ListenableFuture<OtnDeviceRenderingResult> ztoarenderingFuture =
- this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathZtoA));
+ this.executor.submit(new OtnDeviceRenderingTask(this.otnDeviceRenderer, otnServicePathZtoA, serviceType));
ListenableFuture<List<OtnDeviceRenderingResult>> renderingCombinedFuture =
Futures.allAsList(atozrenderingFuture, ztoarenderingFuture);
List<OtnDeviceRenderingResult> otnRenderingResults = new ArrayList<>(2);
// Rollback should be same for all conditions, so creating a new one
RollbackProcessor rollbackProcessor = new RollbackProcessor();
List<OtnDeviceRenderingResult> renderingResults =
- otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA);
+ otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA, serviceType);
if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
rollbackProcessor.rollbackAll();
sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
RollbackProcessor rollbackProcessor = new RollbackProcessor();
List<OtnDeviceRenderingResult> renderingResults =
- otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA);
+ otnDeviceRendering(rollbackProcessor, otnServicePathInputAtoZ, otnServicePathInputZtoA, serviceType);
List<LinkTp> otnLinkTerminationPoints = new ArrayList<>();
renderingResults.forEach(rr -> otnLinkTerminationPoints.addAll(rr.getOtnLinkTps()));
private final OtnDeviceRendererService otnDeviceRenderer;
private final OtnServicePathInput otnServicePathInput;
+ private final String serviceType;
public OtnDeviceRenderingTask(OtnDeviceRendererService otnDeviceRendererService,
- OtnServicePathInput otnServicePathInput) {
+ OtnServicePathInput otnServicePathInput, String serviceType) {
this.otnDeviceRenderer = otnDeviceRendererService;
this.otnServicePathInput = otnServicePathInput;
+ this.serviceType = serviceType;
}
@Override
switch (this.otnServicePathInput.getOperation()) {
case Create:
operation = "setup";
- output = this.otnDeviceRenderer.setupOtnServicePath(this.otnServicePathInput);
+ output = this.otnDeviceRenderer.setupOtnServicePath(this.otnServicePathInput, this.serviceType);
break;
case Delete:
operation = "delete";
- output = this.otnDeviceRenderer.deleteOtnServicePath(this.otnServicePathInput);
+ output = this.otnDeviceRenderer.deleteOtnServicePath(this.otnServicePathInput, this.serviceType);
break;
default:
return OtnDeviceRenderingResult.failed("Device rendering failed - unknown operation");
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.transportpce.common.service.ServiceTypes;
import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev210618.CreateOtsOmsInput;
@Override
public ListenableFuture<RpcResult<OtnServicePathOutput>> otnServicePath(OtnServicePathInput input) {
- if (input.getOperation() != null) {
+ if (input.getOperation() != null && input.getServiceFormat() != null && input.getServiceRate() != null) {
+ String serviceType = ServiceTypes.getOtnServiceType(input.getServiceFormat(), input.getServiceRate());
if (input.getOperation().getIntValue() == 1) {
LOG.info("Create operation request received");
return RpcResultBuilder.success(this.otnDeviceRendererService
- .setupOtnServicePath(input)).buildFuture();
+ .setupOtnServicePath(input, serviceType)).buildFuture();
} else if (input.getOperation().getIntValue() == 2) {
LOG.info("Delete operation request received");
return RpcResultBuilder.success(this.otnDeviceRendererService
- .deleteOtnServicePath(input)).buildFuture();
+ .deleteOtnServicePath(input, serviceType)).buildFuture();
}
}
return RpcResultBuilder.success(new OtnServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();