- // Here is the switch statement that distinguishes on the connection-type
- LOG.info("Connection-type is {} for {}", input.getConnectionType(), input.getServiceName());
- switch (input.getConnectionType()) {
- case Service: case RoadmLine: // This takes into account of Ethernet 100G, 1G, 10G and ODU4
- LOG.info("RPC implementation for {}", input.getConnectionType());
- if (((input.getServiceAEnd().getServiceRate() != null)
- && (input.getServiceAEnd().getServiceRate().intValue() == 100))
- && ((input.getServiceAEnd().getServiceFormat().getName().equals("Ethernet"))
- || (input.getServiceAEnd().getServiceFormat().getName().equals("OC")))) {
- LOG.info("Service format for {} is {} and rate is {}", input.getServiceName(),
- input.getServiceAEnd().getServiceFormat(), input.getServiceAEnd().getServiceRate());
- if (!createServicepathInput(input)) {
- return ModelMappingUtils.createServiceImplResponse(ResponseCodes.RESPONSE_FAILED,
- OPERATION_FAILED);
- }
- } else { // This implies, service-rate is 1 or 10G
- // This includes the lower-order odu (1G, 10G) and this is A-Z side
- LOG.info("RPC implementation for LO-ODU");
- String serviceRate = ""; // Assuming service at A-side and Z-side has same service rate
- if (input.getServiceAEnd().getServiceRate() != null) {
- serviceRate = input.getServiceAEnd().getServiceRate().toString() + "G";
- }
- LOG.info("Start rendering for {} service with {} rate and {} format",
- input.getServiceName(), serviceRate,
- input.getServiceAEnd().getServiceFormat());
- // This is A-Z side
- OtnServicePathInput otnServicePathInputAtoZ = ModelMappingUtils
- .rendererCreateOtnServiceInput(input.getServiceName(),
- input.getServiceAEnd().getServiceFormat().getName(),
- serviceRate, (PathDescription) input.getPathDescription(), true);
- // Rollback should be same for all conditions, so creating a new one
- RollbackProcessor rollbackProcessor = new RollbackProcessor();
- List<OtnDeviceRenderingResult> otnRenderingResults = otnDeviceRendering(rollbackProcessor,
- otnServicePathInputAtoZ, null);
- if (rollbackProcessor.rollbackAllIfNecessary() > 0) {
- sendNotifications(ServicePathNotificationTypes.ServiceImplementationRequest,
- input.getServiceName(), RpcStatusEx.Failed, DEVICE_RENDERING_ROLL_BACK_MSG);
- return ModelMappingUtils.createServiceImplResponse(ResponseCodes.RESPONSE_FAILED,
- OPERATION_FAILED);
- }
- LOG.info("OTN rendering result size {}", otnRenderingResults.size());
+ Uint32 serviceRate = getServiceRate(input);
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210927.network.Nodes
+ mappingNode = portMapping.isNodeExist(input.getServiceAEnd().getNodeId())
+ ? portMapping.getNode(input.getServiceAEnd().getNodeId())
+ : null;
+ String serviceType = ServiceTypes.getServiceType(
+ input.getServiceAEnd().getServiceFormat().getName(),
+ serviceRate,
+ (mappingNode != null
+ && NodeTypes.Xpdr.equals(mappingNode.getNodeInfo().getNodeType())
+ && input.getServiceAEnd().getTxDirection() != null
+ && input.getServiceAEnd().getTxDirection().getPort() != null
+ && input.getServiceAEnd().getTxDirection().getPort().getPortName() != null)
+ ? portMapping.getMapping(input.getServiceAEnd().getNodeId(),
+ input.getServiceAEnd().getTxDirection().getPort().getPortName())
+ : null);
+
+ switch (serviceType) {
+ case StringConstants.SERVICE_TYPE_100GE_T:
+ case StringConstants.SERVICE_TYPE_400GE:
+ case StringConstants.SERVICE_TYPE_OTU4:
+ case StringConstants.SERVICE_TYPE_OTUC4:
+ if (!manageServicePathCreation(input, serviceType)) {
+ return ModelMappingUtils.createServiceImplResponse(ResponseCodes.RESPONSE_FAILED,
+ OPERATION_FAILED);