ordmodels/src/main/java
tests/config.xml
tests/models
+<<<<<<< HEAD
*.log
*.log.*
__pycache__
*.swp
nosetests.xml
api/src/main/java
+api/src/main/java/org/opendaylight/yang/gen/v1/gnpy/path/rev190502/TeTpIdBuilder.java
+api/src/main/java/org/opendaylight/yang/gen/v1/gnpy/path/rev190502/AccumulatedMetricTypeBuilder.java
# Sphinx documentation
.tox/
docs/_build/
-
}
}
description
- "Soruce type defines whether RPC runs for all links or given link Id";
+ "Source type defines whether RPC runs for all links or given link Id";
}
leaf link-id {
when "../src-type = 'link'";
import java.util.List;
import java.util.Optional;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.otn.renderer.input.Nodes;
public interface CrossConnect {
*/
boolean setPowerLevel(String deviceId, Enum mode, BigDecimal powerValue,
String connectionNumber);
+
+ Optional<String> postOtnCrossConnect(List<String> createdOduInterfaces, Nodes node) throws
+ OpenRoadmInterfaceException;
+
}
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.common.mapping.MappingUtils;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.otn.renderer.input.Nodes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
return false;
}
+
+ @Override
+ public Optional<String> postOtnCrossConnect(List<String> createdOduInterfaces, Nodes node)
+ throws OpenRoadmInterfaceException {
+ return crossConnectImpl221.postOtnCrossConnect(createdOduInterfaces, node);
+ }
}
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.PowerDBm;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.GetConnectionPortTrailInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.GetConnectionPortTrailOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OduConnection.Direction;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.connection.DestinationBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.connection.SourceBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.get.connection.port.trail.output.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.OduConnectionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.OduConnectionKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsKey;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.otn.renderer.input.Nodes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
public Optional<String> postCrossConnect(String deviceId, Long waveNumber, String srcTp, String destTp) {
- RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder();
String connectionNumber = generateConnectionName(srcTp, destTp, waveNumber);
- rdmConnBldr.setConnectionName(connectionNumber);
+ RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder()
+ .setConnectionName(connectionNumber)
+ .setOpticalControlMode(OpticalControlMode.Off)
+ .setSource(new SourceBuilder().setSrcIf(srcTp + "-nmc-" + waveNumber).build())
+ .setDestination(new DestinationBuilder().setDstIf(destTp + "-nmc-" + waveNumber)
+ .build());
- rdmConnBldr.setOpticalControlMode(OpticalControlMode.Off);
-
- rdmConnBldr.setSource(new SourceBuilder().setSrcIf(srcTp + "-nmc-" + waveNumber).build());
-
- rdmConnBldr.setDestination(new DestinationBuilder().setDstIf(destTp + "-nmc-" + waveNumber).build());
-
-
- InstanceIdentifier<RoadmConnections> rdmConnectionIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(rdmConnBldr.getConnectionName()));
+ InstanceIdentifier<RoadmConnections> rdmConnectionIID =
+ InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(rdmConnBldr.getConnectionName()));
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
DeviceTransaction deviceTx;
private String generateConnectionName(String srcTp, String destTp, Long waveNumber) {
return srcTp + "-" + destTp + "-" + waveNumber;
}
+
+ public Optional<String> postOtnCrossConnect(List<String> createdOduInterfaces, Nodes node) {
+ String deviceId = node.getNodeId();
+ String srcTp = createdOduInterfaces.get(0);
+ String dstTp = createdOduInterfaces.get(1);
+ OduConnectionBuilder oduConnectionBuilder = new OduConnectionBuilder()
+ .setConnectionName(srcTp + "-x-" + dstTp)
+ .setDestination(new org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.odu.connection
+ .DestinationBuilder().setDstIf(dstTp).build())
+ .setSource(new org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.odu.connection
+ .SourceBuilder().setSrcIf(srcTp).build())
+ .setDirection(Direction.Bidirectional);
+
+ InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.OduConnection> oduConnectionIID =
+ InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.OduConnection.class,
+ new OduConnectionKey(oduConnectionBuilder.getConnectionName())
+ );
+
+ Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
+ DeviceTransaction deviceTx;
+ try {
+ Optional<DeviceTransaction> deviceTxOpt = deviceTxFuture.get();
+ if (deviceTxOpt.isPresent()) {
+ deviceTx = deviceTxOpt.get();
+ } else {
+ LOG.error("Device transaction for device {} was not found!", deviceId);
+ return Optional.empty();
+ }
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("Unable to obtain device transaction for device {}!", deviceId, e);
+ return Optional.empty();
+ }
+
+ // post the cross connect on the device
+ deviceTx.merge(LogicalDatastoreType.CONFIGURATION, oduConnectionIID, oduConnectionBuilder.build());
+ FluentFuture<? extends @NonNull CommitInfo> commit =
+ deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
+ try {
+ commit.get();
+ LOG.info("Otn-connection successfully created: {}-{}", srcTp, dstTp);
+ return Optional.of(srcTp + "-x-" + dstTp);
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.warn("Failed to post {}. Exception: {}", oduConnectionBuilder.build(), e);
+ }
+ return Optional.empty();
+ }
}
*/
void deleteInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException;
+ /**
+ * This methods does an edit-config operation on the openROADM device in
+ * order to create the OTN given interface.
+ *
+ * @param nodeId node ID
+ * @param ifBuilder Builder object containing the data to post
+ * @throws OpenRoadmInterfaceException OpenRoadm Interface Exception
+ */
+ <T> void postOTNInterface(String nodeId, T ifBuilder) throws OpenRoadmInterfaceException;
+
+ /**
+ * This methods does an edit-config operation on the openROADM device in
+ * order to manages the equipment-state status of the circuit pack on which
+ * OTN interfaces are created.
+ *
+ * @param nodeId node ID
+ * @param circuitPackName Circtuit-Pack name
+ * @param activate activate or not
+ *
+ * @throws OpenRoadmInterfaceException OpenRoadm Interface Exception
+ */
+ void postOTNEquipmentState(String nodeId, String circuitPackName, boolean activate)
+ throws OpenRoadmInterfaceException;
+
}
}
+ @Override
+ public <T> void postOTNInterface(String nodeId, T ifBuilder) throws OpenRoadmInterfaceException {
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.InterfaceBuilder
+ ifBuilder22 = (org.opendaylight.yang.gen.v1.http.org.openroadm
+ .device.rev181019.interfaces.grp.InterfaceBuilder) ifBuilder;
+ openRoadmInterfacesImpl221.postInterface(nodeId,ifBuilder22);
+ }
+
+ @Override
+ public void postOTNEquipmentState(String nodeId, String circuitPackName, boolean activate)
+ throws OpenRoadmInterfaceException {
+ openRoadmInterfacesImpl221.postEquipmentState(nodeId, circuitPackName, activate);
+ }
+
private <T> T convertInstanceOfInterface(Object object, Class<T> classToCast) {
try {
return classToCast.cast(object);
private final MappingUtils mappingUtils;
private final OpenRoadmInterface121 openRoadmInterface121;
private final OpenRoadmInterface221 openRoadmInterface221;
-
+ private final OpenRoadmOTNInterface openRoadmOTNInterface;
public OpenRoadmInterfaceFactory(MappingUtils mappingUtils, OpenRoadmInterface121 openRoadmInterface121,
- OpenRoadmInterface221 openRoadmInterface221) {
+ OpenRoadmInterface221 openRoadmInterface221, OpenRoadmOTNInterface openRoadmOTNInterface) {
this.mappingUtils = mappingUtils;
this.openRoadmInterface121 = openRoadmInterface121;
this.openRoadmInterface221 = openRoadmInterface221;
+ this.openRoadmOTNInterface = openRoadmOTNInterface;
}
public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint)
}
}
+ public String createOpenRoadmEth1GInterface(String nodeId,
+ String logicalConnPoint) throws OpenRoadmInterfaceException {
+ return openRoadmOTNInterface.createOpenRoadmEth1GInterface(nodeId,logicalConnPoint);
+ }
+
+ public String createOpenRoadmEth10GInterface(String nodeId,
+ String logicalConnPoint) throws OpenRoadmInterfaceException {
+ return openRoadmOTNInterface.createOpenRoadmEth10GInterface(nodeId,logicalConnPoint);
+ }
+
+ public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String servicename,
+ String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlot)
+ throws OpenRoadmInterfaceException {
+ return openRoadmOTNInterface.createOpenRoadmOdu0Interface(nodeId, logicalConnPoint, servicename, payLoad,
+ isNetworkPort, tribPortNumber, tribSlot);
+ }
+
+ public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String servicename,
+ String payLoad, boolean isNetworkPort)
+ throws OpenRoadmInterfaceException {
+ return openRoadmOTNInterface.createOpenRoadmOdu2Interface(nodeId, logicalConnPoint, servicename, payLoad,
+ isNetworkPort);
+ }
+
+ public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String servicename,
+ String payLoad, boolean isNetworkPort)
+ throws OpenRoadmInterfaceException {
+ return openRoadmOTNInterface.createOpenRoadmOdu2eInterface(nodeId, logicalConnPoint, servicename, payLoad,
+ isNetworkPort);
+ }
}
--- /dev/null
+/*
+ * Copyright © 2019 AT&T and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.renderer.openroadminterface;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.opendaylight.transportpce.common.mapping.PortMapping;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev200128.network.nodes.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.InterfaceBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.InterfaceKey;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.AdminStates;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev181019.EthAttributes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev181019.Interface1;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev181019.Interface1Builder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.ethernet.interfaces.rev181019.ethernet.container.EthernetBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.EthernetCsmacd;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.InterfaceType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev161014.OtnOdu;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODU0;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODU2;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev171215.ODU2e;
+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.ODUTTPCTP;
+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;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.opu.OpuBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.parent.odu.allocation.ParentOduAllocationBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class OpenRoadmOTNInterface {
+
+ private final PortMapping portMapping;
+ private final OpenRoadmInterfaces openRoadmInterfaces;
+ private static final Logger LOG = LoggerFactory.getLogger(OpenRoadmInterfaceFactory.class);
+
+ public OpenRoadmOTNInterface(PortMapping portMapping, OpenRoadmInterfaces openRoadmInterfaces) {
+ this.portMapping = portMapping;
+ this.openRoadmInterfaces = openRoadmInterfaces;
+ }
+
+ public String createOpenRoadmEth1GInterface(String nodeId, String logicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(String.format("Unable to get mapping from PortMapping for node % and"
+ + " logical connection port %s", nodeId, logicalConnPoint));
+ }
+
+ // Ethernet interface specific data
+ EthernetBuilder ethIfBuilder = new EthernetBuilder()
+ .setAutoNegotiation(EthAttributes.AutoNegotiation.Disabled)
+ .setSpeed(1000L)
+ .setMtu(9000L);
+ //.setCurrSpeed("1000L")
+ //.setCurrDuplex("FULL");
+ InterfaceBuilder ethInterfaceBldr =
+ createGenericInterfaceBuilder(portMap, EthernetCsmacd.class, logicalConnPoint + "-ETHERNET1G");
+ // Create Interface1 type object required for adding as augmentation
+ Interface1Builder ethIf1Builder = new Interface1Builder();
+ ethInterfaceBldr.addAugmentation(Interface1.class, ethIf1Builder.setEthernet(ethIfBuilder.build()).build());
+ // Post interface on the device
+ this.openRoadmInterfaces.postOTNInterface(nodeId, ethInterfaceBldr);
+ // Post the equipment-state change on the device circuit-pack
+ this.openRoadmInterfaces.postOTNEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
+ this.portMapping.updateMapping(nodeId,portMap);
+ String ethernetInterfaceName = ethInterfaceBldr.getName();
+
+ return ethernetInterfaceName;
+ }
+
+ private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap,
+ Class<? extends InterfaceType> type, String key) {
+ InterfaceBuilder interfaceBuilder = new InterfaceBuilder()
+ //.setDescription(" TBD ")
+ //.setCircuitId(" TBD ")
+ .setSupportingCircuitPackName(portMap.getSupportingCircuitPackName())
+ .setSupportingPort(portMap.getSupportingPort())
+ .setAdministrativeState(AdminStates.InService)
+ //TODO get rid of unchecked cast warning
+ .setType(
+ (Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.interfaces.rev170626.InterfaceType>)
+ type
+ )
+ .setName(key)
+ .withKey(new InterfaceKey(key));
+ return interfaceBuilder;
+ }
+
+ public String createOpenRoadmEth10GInterface(String nodeId, String logicalConnPoint)
+ throws OpenRoadmInterfaceException {
+ Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(
+ "Unable to get mapping from PortMapping for node % and logical connection port %s",
+ nodeId, logicalConnPoint));
+ }
+
+ // Ethernet interface specific data
+ EthernetBuilder ethIfBuilder = new EthernetBuilder()
+ .setAutoNegotiation(EthAttributes.AutoNegotiation.Disabled)
+ .setSpeed(10000L)
+ .setMtu(9000L);
+ //.setCurrSpeed("1000L")
+ //.setCurrDuplex("FULL");
+ // Create Interface1 type object required for adding as augmentation
+ Interface1Builder ethIf1Builder = new Interface1Builder();
+ InterfaceBuilder ethInterfaceBldr =
+ createGenericInterfaceBuilder(portMap, EthernetCsmacd.class, logicalConnPoint + "-ETHERNET10G")
+ .addAugmentation(Interface1.class, ethIf1Builder.setEthernet(ethIfBuilder.build()).build());
+ // Post interface on the device
+ this.openRoadmInterfaces.postOTNInterface(nodeId, ethInterfaceBldr);
+ // Post the equipment-state change on the device circuit-pack
+ this.openRoadmInterfaces.postOTNEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
+ this.portMapping.updateMapping(nodeId,portMap);
+ String ethernetInterfaceName = ethInterfaceBldr.getName();
+
+ return ethernetInterfaceName;
+ }
+
+
+ public String createOpenRoadmOdu2eInterface(String nodeId, String logicalConnPoint, String serviceName,
+ String payLoad, boolean isNetworkPort)
+ throws OpenRoadmInterfaceException {
+ Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format("Unable to get mapping from PortMapping for node % and logical connection port %s",
+ nodeId, logicalConnPoint));
+ }
+ String supportingInterface = null;
+
+ if (isNetworkPort) {
+ supportingInterface = portMap.getSupportingOdu4();
+
+ } else {
+ // supportingInterface = portMap.getSupportingEthernet();
+ supportingInterface = logicalConnPoint + "-ETHERNET10G";
+ }
+ InterfaceBuilder oduInterfaceBldr =
+ createGenericInterfaceBuilder(portMap, OtnOdu.class, logicalConnPoint + "-ODU2e-" + serviceName)
+ .setSupportingInterface(supportingInterface);
+
+ // ODU interface specific data
+ OduBuilder oduIfBuilder = new OduBuilder()
+ .setRate(ODU2e.class)
+ .setOduFunction(ODUTTPCTP.class)
+ .setMonitoringMode(OduAttributes.MonitoringMode.Terminated);
+ if (isNetworkPort) {
+ List<Integer> tribSlots = new ArrayList<>();
+ //add trib slots
+ tribSlots.add(45);
+ ParentOduAllocationBuilder parentOduAllocationBuilder = new ParentOduAllocationBuilder()
+ //set trib port numbers
+ .setTribPortNumber(24)
+ .setTribSlots(tribSlots);
+ oduIfBuilder.setOduFunction(ODUCTP.class)
+ .setMonitoringMode(OduAttributes.MonitoringMode.NotTerminated)
+ .setParentOduAllocation(parentOduAllocationBuilder.build());
+ }
+ else {
+ // Set Opu attributes
+ OpuBuilder opuBldr = new OpuBuilder()
+ .setPayloadType(new PayloadTypeDef(payLoad))
+ .setExpPayloadType(new PayloadTypeDef(payLoad));
+ //.setRxPayloadType("07")
+ //.setPayloadInterface(payLoad);
+ oduIfBuilder.setOpu(opuBldr.build());
+ }
+ // Create Interface1 type object required for adding as augmentation
+ // TODO look at imports of different versions of class
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
+ oduInterfaceBldr.addAugmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1.class,
+ oduIf1Builder.setOdu(oduIfBuilder.build()).build());
+
+ // Post interface on the device
+ this.openRoadmInterfaces.postOTNInterface(nodeId, oduInterfaceBldr);
+ LOG.info("returning the ODU2e inteface {}", oduInterfaceBldr.getName());
+ return oduInterfaceBldr.getName();
+ }
+
+ public String createOpenRoadmOdu0Interface(String nodeId, String logicalConnPoint, String serviceName,
+ String payLoad, boolean isNetworkPort, int tribPortNumber, int tribSlot)
+ throws OpenRoadmInterfaceException {
+ Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
+ String supportingInterface = null;
+
+ if (isNetworkPort) {
+ supportingInterface = portMap.getSupportingOdu4();
+ } else {
+ // supportingInterface = portMap.getSupportingEthernet();
+ supportingInterface = logicalConnPoint + "-ETHERNET1G";
+ }
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format("Unable to get mapping from PortMapping for node % and logical connection port %s",
+ nodeId, logicalConnPoint));
+ }
+ InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class, logicalConnPoint
+ + "-ODU0-" + serviceName);
+ oduInterfaceBldr.setSupportingInterface(supportingInterface);
+
+ // ODU interface specific data
+ OduBuilder oduIfBuilder = new OduBuilder()
+ .setRate(ODU0.class)
+ .setOduFunction(ODUTTPCTP.class)
+ .setMonitoringMode(OduAttributes.MonitoringMode.Terminated);
+ if (isNetworkPort) {
+ List<Integer> tribSlots = new ArrayList<>();
+ tribSlots.add(tribSlot); //add trib slots
+ ParentOduAllocationBuilder parentOduAllocationBuilder = new ParentOduAllocationBuilder()
+ //set trib port numbers
+ .setTribPortNumber(tribPortNumber)
+ .setTribSlots(tribSlots);
+ oduIfBuilder.setOduFunction(ODUCTP.class)
+ .setMonitoringMode(OduAttributes.MonitoringMode.NotTerminated)
+ .setParentOduAllocation(parentOduAllocationBuilder.build());
+ }
+ else {
+ // Set Opu attributes
+ OpuBuilder opuBldr = new OpuBuilder()
+ .setPayloadType(new PayloadTypeDef(payLoad))
+ .setExpPayloadType(new PayloadTypeDef(payLoad));
+ //.setRxPayloadType("07")
+ //.setPayloadInterface(payLoad);
+ oduIfBuilder.setOpu(opuBldr.build());
+ }
+ // Create Interface1 type object required for adding as augmentation
+ // TODO look at imports of different versions of class
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
+ oduInterfaceBldr.addAugmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1.class,
+ oduIf1Builder.setOdu(oduIfBuilder.build()).build());
+
+ // Post interface on the device
+ this.openRoadmInterfaces.postOTNInterface(nodeId, oduInterfaceBldr);
+ LOG.info("returning the ODU0 inteface {}", oduInterfaceBldr.getName());
+ return oduInterfaceBldr.getName();
+ }
+
+ public String createOpenRoadmOdu2Interface(String nodeId, String logicalConnPoint, String serviceName,
+ String payLoad, boolean isNetworkPort)
+ throws OpenRoadmInterfaceException {
+ Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
+ String supportingInterface = null;
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format("Unable to get mapping from PortMapping for node % and logical connection port %s",
+ nodeId, logicalConnPoint));
+ }
+ if (isNetworkPort) {
+ supportingInterface = portMap.getSupportingOdu4();
+ } else {
+ supportingInterface = portMap.getSupportingEthernet();
+ }
+ InterfaceBuilder oduInterfaceBldr =
+ createGenericInterfaceBuilder(portMap, OtnOdu.class, logicalConnPoint + "-ODU2-" + serviceName)
+ .setSupportingInterface(supportingInterface);
+
+ OduBuilder oduIfBuilder = new OduBuilder()
+ .setRate(ODU2.class)
+ .setOduFunction(ODUTTPCTP.class)
+ .setMonitoringMode(OduAttributes.MonitoringMode.Terminated);
+ if (isNetworkPort) {
+ List<Integer> tribSlots = new ArrayList<>();
+ tribSlots.add(45); //add trib slots
+ ParentOduAllocationBuilder parentOduAllocationBuilder = new ParentOduAllocationBuilder()
+ //set trib port numbers
+ .setTribPortNumber(24)
+ .setTribSlots(tribSlots);
+ oduIfBuilder.setOduFunction(ODUCTP.class)
+ .setMonitoringMode(OduAttributes.MonitoringMode.NotTerminated)
+ .setParentOduAllocation(parentOduAllocationBuilder.build());
+ }
+ else {
+ // Set Opu attributes
+ OpuBuilder opuBldr = new OpuBuilder()
+ .setPayloadType(new PayloadTypeDef(payLoad))
+ .setExpPayloadType(new PayloadTypeDef(payLoad));
+ //.setRxPayloadType("07")
+ //.setPayloadInterface(payLoad);
+ oduIfBuilder.setOpu(opuBldr.build());
+ }
+
+ // Create Interface1 type object required for adding as augmentation
+ // TODO look at imports of different versions of class
+ // Create Interface1 type object required for adding as augmentation
+ // TODO look at imports of different versions of class
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder oduIf1Builder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1Builder();
+ oduInterfaceBldr.addAugmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev181019.Interface1.class,
+ oduIf1Builder.setOdu(oduIfBuilder.build()).build());
+
+ // Post interface on the device
+ this.openRoadmInterfaces.postOTNInterface(nodeId, oduInterfaceBldr);
+ LOG.info("returning the ODU2 inteface {}", oduInterfaceBldr.getName());
+ return oduInterfaceBldr.getName();
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2019 AT&T and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.renderer.provisiondevice;
+
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.OtnServicePathInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.OtnServicePathOutput;
+
+public interface OtnDeviceRendererService {
+ OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input);
+
+ OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input);
+}
--- /dev/null
+/*
+ * Copyright © 2019 AT&T and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.renderer.provisiondevice;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import org.opendaylight.transportpce.common.crossconnect.CrossConnect;
+import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
+import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.OtnServicePathInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.OtnServicePathOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.OtnServicePathOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.node.interfaces.NodeInterface;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.node.interfaces.NodeInterfaceBuilder;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.node.interfaces.NodeInterfaceKey;
+import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev200128.otn.renderer.input.Nodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OtnDeviceRendererServiceImpl implements OtnDeviceRendererService {
+ private static final Logger LOG = LoggerFactory.getLogger(OtnDeviceRendererServiceImpl.class);
+ private final OpenRoadmInterfaceFactory openRoadmInterfaceFactory;
+ private final CrossConnect crossConnect;
+
+ public OtnDeviceRendererServiceImpl(OpenRoadmInterfaceFactory openRoadmInterfaceFactory,
+ CrossConnect crossConnect) {
+ this.openRoadmInterfaceFactory = openRoadmInterfaceFactory;
+ this.crossConnect = crossConnect;
+ }
+
+ @Override
+ public OtnServicePathOutput setupOtnServicePath(OtnServicePathInput input) {
+ boolean success = true;
+ List<NodeInterface> nodeInterfaces = new ArrayList<>();
+ List<String> results = new ArrayList<>();
+ if (input.getServiceType().equals("Ethernet")) {
+ try {
+ nodeInterfaces = createInterface(input);
+ }
+ catch (OpenRoadmInterfaceException e) {
+ //handle exception
+ LOG.warn("Set up service path failed");
+ success = false;
+ }
+ }
+ if (success) {
+ for (NodeInterface nodeInterface: nodeInterfaces) {
+ results.add("Otn Service path was set up successfully for node :" + nodeInterface.getNodeId());
+ }
+ }
+ OtnServicePathOutputBuilder otnServicePathOutputBuilder = new OtnServicePathOutputBuilder()
+ .setSuccess(success)
+ .setNodeInterface(nodeInterfaces)
+ .setResult(String.join("\n", results));
+ return otnServicePathOutputBuilder.build();
+ }
+
+ @Override
+ public OtnServicePathOutput deleteOtnServicePath(OtnServicePathInput input) {
+ OtnServicePathOutputBuilder otnServicePathOutputBuilder = new OtnServicePathOutputBuilder()
+ .setResult("deleteServicePath was called");
+ return otnServicePathOutputBuilder.build();
+ }
+
+ private List<NodeInterface> createInterface(OtnServicePathInput input) throws OpenRoadmInterfaceException {
+ List<NodeInterface> nodeInterfaces = new ArrayList<>();
+ if (input.getServiceRate().equals("1G")) {
+ for (Nodes node: input.getNodes()) {
+ //check if the node is mounted or not?
+ List<String> createdEthInterfaces = new ArrayList<>();
+ List<String> createdOduInterfaces = new ArrayList<>();
+ createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth1GInterface(node.getNodeId(),
+ node.getClientTp()));
+ LOG.info("created ethernet interface");
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
+ node.getClientTp(), input.getServiceName(),"07", false, input.getTribPortNumber(),
+ input.getTribSlot())); //suppporting interface?, payload ?
+ LOG.info("Created odu interface client side");
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
+ node.getNetworkTp(), input.getServiceName(),"07", true, input.getTribPortNumber(),
+ input.getTribSlot()));
+ LOG.info("created odu inteface network side");
+
+ //implement cross connect
+ Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
+ List<String> createdConnections = new ArrayList<>();
+ createdConnections.add(connectionNameOpt.get());
+ LOG.info("Created cross connects");
+ NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder()
+ .withKey(new NodeInterfaceKey(node.getNodeId()))
+ .setNodeId(node.getNodeId())
+ .setConnectionId(createdConnections)
+ .setEthInterfaceId(createdEthInterfaces)
+ .setOduInterfaceId(createdOduInterfaces);
+ nodeInterfaces.add(nodeInterfaceBuilder.build());
+ }
+ }
+ else if (input.getServiceRate().equals("10G")) {
+ // implementing ODU2e for now
+
+ for (Nodes node: input.getNodes()) {
+ //check if the node is mounted or not?
+ List<String> createdEthInterfaces = new ArrayList<>();
+ List<String> createdOduInterfaces = new ArrayList<>();
+ createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth10GInterface(node.getNodeId(),
+ node.getClientTp()));
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
+ node.getClientTp(), input.getServiceName(),"03", false)); //suppporting interface?, payload ?
+ createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
+ node.getNetworkTp(), input.getServiceName(),"03" , true));// supporting interface? payload ?
+
+ //implement cross connect
+ Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
+ List<String> createdConnections = new ArrayList<>();
+ createdConnections.add(connectionNameOpt.get());
+ LOG.info("Created cross connects");
+ NodeInterfaceBuilder nodeInterfaceBuilder = new NodeInterfaceBuilder();
+ nodeInterfaceBuilder.withKey(new NodeInterfaceKey(node.getNodeId()))
+ .setNodeId(node.getNodeId())
+ .setConnectionId(createdConnections)
+ .setEthInterfaceId(createdEthInterfaces)
+ .setOduInterfaceId(createdOduInterfaces);
+ nodeInterfaces.add(nodeInterfaceBuilder.build());
+ }
+ }
+ return nodeInterfaces;
+ }
+
+ private Optional<String> postCrossConnect(List<String> createdOduInterfaces, Nodes node)
+ throws OpenRoadmInterfaceException {
+ return this.crossConnect.postOtnCrossConnect(createdOduInterfaces,node);
+ }
+}
--- /dev/null
+/*
+ * Copyright © 2019 AT&T and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.renderer.provisiondevice.otn;
+
+import java.util.List;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList;
+
+public interface OtnDeviceOperations {
+
+ /**
+ * This method checks if the client port can be used or not.
+ *
+ * @param nodeID unique identifier of a device
+ * @param circuitPackName circuit pack name of the client port
+ * @param portName port name of the client port
+ * @param capacity rate of the service needed
+ * @return String which states whether the client port is valid or not
+ */
+ String validateClientPort(String nodeID, String circuitPackName, String portName, String capacity);
+
+ /**
+ * This method retrieves the possible network ports.
+ *
+ *<p>
+ * checks for the possible network ports in odu-switching-pool
+ *</p>
+ * @param circuitPackName Circuit pack name of the client port
+ * @param portName port name of the client port
+ * @return List of all possible network ports
+ */
+ List<PortList> getPossibleNetworkPorts(String circuitPackName, String portName);
+
+
+}
--- /dev/null
+/*
+ * Copyright © 2019 AT&T and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.transportpce.renderer.provisiondevice.otn;
+
+import java.util.List;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.CircuitPacks;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.pack.Ports;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.OduSwitchingPools;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.org.openroadm.device.odu.switching.pools.NonBlockingList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.capability.rev181019.port.group.restriction.grp.PortGroupRestriction;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.capability.rev181019.port.group.restriction.grp.port.group.restriction.PortBandwidthSharing;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.capability.rev181019.port.group.restriction.grp.port.group.restriction.port.bandwidth.sharing.PortList;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.capability.rev181019.port.group.restriction.grp.port.group.restriction.port.bandwidth.sharing.PossiblePortConfig;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.port.capability.rev181019.port.group.restriction.grp.port.group.restriction.port.bandwidth.sharing.possible.port.config.PortIfTypeConfig;
+
+
+public class OtnDeviceOperationsImpl implements OtnDeviceOperations {
+
+ @Override
+ public String validateClientPort(String nodeID, String circuitPackName, String portName, String capacity) {
+
+ PortGroupRestriction portGroupRestriction = null; //should not be initiated as null
+ List<PortBandwidthSharing> portBandwidthSharingList = portGroupRestriction.getPortBandwidthSharing();
+ for (PortBandwidthSharing portBandwidthSharing: portBandwidthSharingList) {
+ List<PortList> portLists = portBandwidthSharing.getPortList();
+ for (PortList portList: portLists) {
+ if (portList.getCircuitPackName().equals(circuitPackName) && portList.getPortName().equals(portName)) {
+ if (!usageOfOtherPorts(portBandwidthSharing,
+ getConfigID(portBandwidthSharing, circuitPackName, portName))) {
+ return "valid port";
+ }
+ else {
+ return "not a valid port";
+ }
+ }
+ }
+ }
+ return "not valid circuitPackName or portName"; // if the client port is not found at all throw exception
+ }
+
+ private Integer getConfigID(PortBandwidthSharing portBandwidthSharing, String circuitPackName, String portName) {
+ List<PossiblePortConfig> possiblePortConfigList = portBandwidthSharing.getPossiblePortConfig();
+ for (PossiblePortConfig possiblePortConfig: possiblePortConfigList
+ ) {
+ List<PortIfTypeConfig> portIfTypeConfigList = possiblePortConfig.getPortIfTypeConfig();
+ for (PortIfTypeConfig portIfTypeConfig : portIfTypeConfigList) {
+ if (portIfTypeConfig.getCircuitPackName().equals(circuitPackName)
+ && portIfTypeConfig.getPortName().equals(portName)) {
+ return possiblePortConfig.getConfigId();
+ }
+ }
+ }
+ return null; // throw exception if not able to get config id
+ }
+
+
+ private boolean usageOfOtherPorts(PortBandwidthSharing portBandwidthSharing, Integer configId) {
+ return false;
+ }
+
+ @Override
+ public List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org
+ .openroadm.device.container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList>
+ getPossibleNetworkPorts(String circuitPackName, String portName) {
+ List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org
+ .openroadm.device.container.org.openroadm.device.odu.switching
+ .pools.non.blocking.list.PortList> networkPortList = null;
+
+ //need a method to get swtiching pool object from device
+
+ OduSwitchingPools oduSwitchingPools = null; // should not be initiated as null
+ List<NonBlockingList> nonBlockingLists = oduSwitchingPools.getNonBlockingList();
+
+
+ for (NonBlockingList nonBlockingList: nonBlockingLists) {
+
+ for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList port:
+ nonBlockingList.getPortList()) {
+
+ if (port.getCircuitPackName().equals(circuitPackName) && port.getPortName().equals(portName)) {
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.odu.switching.pools.non.blocking.list
+ .PortList networkPort = checkNetworkPorts(nonBlockingList.getPortList());
+ if (networkPort != null) {
+ networkPortList.add(networkPort);
+ }
+ }
+ }
+ }
+ return networkPortList;
+ }
+
+
+ private org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList
+ checkNetworkPorts(List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org
+ .openroadm.device.container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList> portList) {
+ CircuitPacks circuitPacks = null;
+
+ List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.packs
+ .CircuitPacks> circuitPackList = circuitPacks.getCircuitPacks();
+
+ for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .org.openroadm.device.odu.switching.pools.non.blocking.list.PortList port: portList) {
+ for (org.opendaylight.yang.gen.v1.http.org.openroadm.device
+ .rev181019.circuit.packs.CircuitPacks circuitPack: circuitPackList) {
+ return searchNetworkPort(port, circuitPack);
+ }
+ }
+ return null; // throw exception if no available network ports
+ }
+
+ private org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .org.openroadm.device.odu.switching.pools.non.blocking.list.PortList
+ searchNetworkPort(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.odu.switching.pools.non.blocking.list.PortList port,
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.packs.CircuitPacks circuitPack) {
+ if (port.getCircuitPackName().equals(circuitPack.getCircuitPackName())) {
+ for (Ports prt : circuitPack.getPorts()) {
+ if (port.getPortName().equals(prt.getPortName()) && prt.getPortQual().equals("xpdr-network")) {
+ return port;
+ }
+ }
+ }
+ return null; // throw exception
+ }
+
+
+ //check supported interface types
+
+}
\ No newline at end of file
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
+import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.CreateOtsOmsInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.CreateOtsOmsOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.OtnServicePathInput;
private static final Logger LOG = LoggerFactory.getLogger(DeviceRendererRPCImpl.class);
private DeviceRendererService deviceRenderer;
+ private OtnDeviceRendererService otnDeviceRendererService;
- public DeviceRendererRPCImpl(DeviceRendererService deviceRenderer) {
+ public DeviceRendererRPCImpl(DeviceRendererService deviceRenderer,
+ OtnDeviceRendererService otnDeviceRendererService) {
this.deviceRenderer = deviceRenderer;
+ this.otnDeviceRendererService = otnDeviceRendererService;
}
/**
@Override
public ListenableFuture<RpcResult<OtnServicePathOutput>> otnServicePath(OtnServicePathInput input) {
- return RpcResultBuilder
- .success(new OtnServicePathOutputBuilder().setResult("Unsupported operation"))
- .buildFuture();
+ if (input.getOperation().getIntValue() == 1) {
+ LOG.info("Create operation request received");
+ return RpcResultBuilder.success(this.otnDeviceRendererService.setupOtnServicePath(input)).buildFuture();
+ } else if (input.getOperation().getIntValue() == 2) {
+ LOG.info("Delete operation request received");
+ return RpcResultBuilder.success(this.otnDeviceRendererService.deleteOtnServicePath(input)).buildFuture();
+ }
+ return RpcResultBuilder.success(new OtnServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();
}
/**
<argument ref="FixedFlexImpl"/>
</bean>
+ <bean id="openRoadmOtnInterface"
+ class="org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOTNInterface">
+ <argument ref="portMapping"/>
+ <argument ref="openRoadmInterfaces"/>
+ </bean>
+
<bean id="openRoadmInterfaceFactory"
class="org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory">
<argument ref="mappingUtils"/>
<argument ref="openRoadmInterface121"/>
<argument ref="openRoadmInterface221"/>
+ <argument ref="openRoadmOtnInterface"/>
</bean>
<bean id="deviceRenderer" class="org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererServiceImpl" >
<argument ref="portMapping" />
</bean>
+ <bean id="otnDeviceRenderer" class="org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererServiceImpl" >
+ <argument ref="openRoadmInterfaceFactory" />
+ <argument ref="crossConnect" />
+ </bean>
+
<bean id="deviceRendererRPCImpl" class="org.opendaylight.transportpce.renderer.rpcs.DeviceRendererRPCImpl" >
<argument ref="deviceRenderer" />
+ <argument ref="otnDeviceRenderer" />
</bean>
<bean id="networkModelWavelengthService"
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
+import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOTNInterface;
import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
import org.opendaylight.transportpce.renderer.utils.CreateOtsOmsDataUtils;
import org.opendaylight.transportpce.renderer.utils.MountPointUtils;
OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces,
fixedFlexInterface);
+ OpenRoadmOTNInterface openRoadmOTNInterface = new OpenRoadmOTNInterface(portMapping, openRoadmInterfaces);
this.openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,openRoadmInterface121,
- openRoadmInterface221);
+ openRoadmInterface221, openRoadmOTNInterface);
this.crossConnectImpl121 = new CrossConnectImpl121(this.deviceTransactionManager);
this.crossConnectImpl221 = new CrossConnectImpl221(this.deviceTransactionManager);
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
+import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOTNInterface;
import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
import org.opendaylight.transportpce.renderer.stub.MountPointStub;
import org.opendaylight.transportpce.renderer.stub.OlmServiceStub;
OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces,
fixedFlexInterface);
+ OpenRoadmOTNInterface openRoadmOTNInterface = new OpenRoadmOTNInterface(portMapping, openRoadmInterfaces);
OpenRoadmInterfaceFactory openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,
- openRoadmInterface121,openRoadmInterface221);
+ openRoadmInterface121, openRoadmInterface221, openRoadmOTNInterface);
this.deviceRenderer = new DeviceRendererServiceImpl(this.getDataBroker(),
this.deviceTransactionManager, openRoadmInterfaceFactory, openRoadmInterfaces, crossConnect,
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface121;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterface221;
import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmInterfaceFactory;
+import org.opendaylight.transportpce.renderer.openroadminterface.OpenRoadmOTNInterface;
import org.opendaylight.transportpce.renderer.stub.MountPointServiceStub;
import org.opendaylight.transportpce.renderer.stub.MountPointStub;
import org.opendaylight.transportpce.renderer.stub.OlmServiceStub;
OpenRoadmInterface121 openRoadmInterface121 = new OpenRoadmInterface121(portMapping,openRoadmInterfaces);
OpenRoadmInterface221 openRoadmInterface221 = new OpenRoadmInterface221(portMapping,openRoadmInterfaces,
fixedFlexInterface);
+ OpenRoadmOTNInterface openRoadmOTNInterface = new OpenRoadmOTNInterface(portMapping, openRoadmInterfaces);
this.openRoadmInterfaceFactory = new OpenRoadmInterfaceFactory(this.mappingUtils,openRoadmInterface121,
- openRoadmInterface221);
+ openRoadmInterface221, openRoadmOTNInterface);
this.crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
this.crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
this.crossConnect = new CrossConnectImpl(deviceTransactionManager, this.mappingUtils, this.crossConnectImpl121,
import org.mockito.Mockito;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.transportpce.renderer.provisiondevice.DeviceRendererService;
+import org.opendaylight.transportpce.renderer.provisiondevice.OtnDeviceRendererService;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.CreateOtsOmsInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.device.rev200128.RendererRollbackInput;
public class DeviceRendererRPCImplTest extends AbstractTest {
private final DeviceRendererService deviceRenderer = Mockito.mock(DeviceRendererService.class);
+ private final OtnDeviceRendererService otnDeviceRenderer = Mockito.mock(OtnDeviceRendererService.class);
private final ServicePathInput servicePathInput = Mockito.spy(ServicePathInput.class);
private final CreateOtsOmsInput createOtsOmsInput = Mockito.mock(CreateOtsOmsInput.class);
private final RendererRollbackInput rendererRollbackInput = Mockito.mock(RendererRollbackInput.class);
@Before
public void setup() {
- deviceRendererRPC = new DeviceRendererRPCImpl(deviceRenderer);
+ deviceRendererRPC = new DeviceRendererRPCImpl(deviceRenderer, otnDeviceRenderer);
}
private RpcConsumerRegistry rpcConsumerRegistry;
public MountPointStub(DataBroker dataBroker) {
-
this.dataBroker = dataBroker;
}