}
import org-openroadm-otn-common-types {
prefix org-openroadm-otn-common-types;
- revision-date 2018-11-30;
}
organization
package org.opendaylight.transportpce.common.crossconnect;
-import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.otn.renderer.nodes.Nodes;
+import org.opendaylight.yangtools.yang.common.Decimal64;
public interface CrossConnect {
* Name of the cross connect.
* @return true/false based on status of operation.
*/
- boolean setPowerLevel(String deviceId, String mode, BigDecimal powerValue,
- String connectionNumber);
+ boolean setPowerLevel(String deviceId, String mode, Decimal64 powerValue, String connectionNumber);
Optional<String> postOtnCrossConnect(List<String> createdOduInterfaces, Nodes node) throws
OpenRoadmInterfaceException;
import static org.opendaylight.transportpce.common.StringConstants.OPENROADM_DEVICE_VERSION_2_2_1;
import static org.opendaylight.transportpce.common.StringConstants.OPENROADM_DEVICE_VERSION_7_1;
-import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.otn.renderer.nodes.Nodes;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
return null;
}
- public boolean setPowerLevel(String nodeId, String mode, BigDecimal powerValue, String connectionNumber) {
+ @Override
+ public boolean setPowerLevel(String nodeId, String mode, Decimal64 powerValue, String connectionNumber) {
String openRoadmVersion = mappingUtils.getOpenRoadmVersion(nodeId);
if (OPENROADM_DEVICE_VERSION_1_2_1.equals(openRoadmVersion) && OpticalControlMode.forName(mode).isPresent()) {
- return crossConnectImpl121.setPowerLevel(nodeId,OpticalControlMode.forName(mode).get(),
- powerValue,connectionNumber);
+ return crossConnectImpl121.setPowerLevel(nodeId,OpticalControlMode.forName(mode).get(), powerValue,
+ connectionNumber);
}
else if (OPENROADM_DEVICE_VERSION_2_2_1.equals(openRoadmVersion)
&& org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode)
.isPresent()) {
return crossConnectImpl221.setPowerLevel(nodeId,
org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode.forName(mode)
- .get(), powerValue,connectionNumber);
+ .get(), powerValue, connectionNumber);
}
return false;
}
package org.opendaylight.transportpce.common.crossconnect;
import com.google.common.util.concurrent.FluentFuture;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.PowerDBm;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.GetConnectionPortTrailOutput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.connection.DestinationBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.connection.SourceBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
rdmConnBldr.setDestination(new DestinationBuilder()
.setDstIf(spectrumInformation.getIdentifierFromParams(destTp))
.build());
- InstanceIdentifier<RoadmConnections> rdmConnectionIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(rdmConnBldr.getConnectionNumber()));
+ InstanceIdentifier<RoadmConnections> rdmConnectionIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(rdmConnBldr.getConnectionNumber()))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
DeviceTransaction deviceTx;
}
private InstanceIdentifier<RoadmConnections> generateRdmConnectionIID(String connectionNumber) {
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber));
+ return InstanceIdentifier.builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber))
+ .build();
}
private String generateConnectionNumber(String srcTp, String destTp, String spectralSlotName) {
return String.join(GridConstant.NAME_PARAMETERS_SEPARATOR, srcTp, destTp, spectralSlotName);
}
- public boolean setPowerLevel(String deviceId, OpticalControlMode mode, BigDecimal powerValue, String ctNumber) {
+ public boolean setPowerLevel(String deviceId, OpticalControlMode mode, Decimal64 powerValue, String ctNumber) {
Optional<RoadmConnections> rdmConnOpt = getCrossConnect(deviceId, ctNumber);
if (rdmConnOpt.isPresent()) {
}
// post the cross connect on the device
- InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(ctNumber));
+ InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(ctNumber))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, roadmConnIID, newRdmConn);
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
package org.opendaylight.transportpce.common.crossconnect;
import com.google.common.util.concurrent.FluentFuture;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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.OrgOpenroadmDeviceData;
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.OduConnection;
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.RoadmConnectionsKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.otn.renderer.nodes.Nodes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
.setDstIf(spectrumInformation.getIdentifierFromParams(destTp,"nmc"))
.build());
- InstanceIdentifier<RoadmConnections> rdmConnectionIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(rdmConnBldr.getConnectionName()));
+ InstanceIdentifier<RoadmConnections> rdmConnectionIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(rdmConnBldr.getConnectionName()))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
DeviceTransaction deviceTx;
}
- public boolean setPowerLevel(String deviceId, OpticalControlMode mode, BigDecimal powerValue, String ctName) {
+ public boolean setPowerLevel(String deviceId, OpticalControlMode mode, Decimal64 powerValue, String ctName) {
Optional<RoadmConnections> rdmConnOpt = getCrossConnect(deviceId, ctName);
if (rdmConnOpt.isPresent()) {
RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder(rdmConnOpt.get());
}
// post the cross connect on the device
- InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(ctName));
+ InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(ctName))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, roadmConnIID, newRdmConn);
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
}
private InstanceIdentifier<RoadmConnections> generateRdmConnectionIID(String connectionNumber) {
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber))
+ .build();
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
- .container.org.openroadm.device.OduConnection> generateOduConnectionIID(String connectionNumber) {
- return 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(connectionNumber));
+ private InstanceIdentifier<OduConnection> generateOduConnectionIID(String connectionNumber) {
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(OduConnection.class, new OduConnectionKey(connectionNumber))
+ .build();
}
private String generateConnectionName(String srcTp, String destTp, String spectralSlotName) {
public Optional<String> postOtnCrossConnect(List<String> createdOduInterfaces, Nodes node) {
String deviceId = node.getNodeId();
- String srcTp = createdOduInterfaces.get(0);
- String dstTp = createdOduInterfaces.get(1);
+ List<String> sortedCreatedOduInterfaces = new ArrayList<>(createdOduInterfaces);
+ sortedCreatedOduInterfaces.sort((s1,s2) -> s1.compareTo(s2));
+ String srcTp = sortedCreatedOduInterfaces.get(0);
+ String dstTp = sortedCreatedOduInterfaces.get(1);
OduConnectionBuilder oduConnectionBuilder = new OduConnectionBuilder()
.setConnectionName(srcTp + "-x-" + dstTp)
.setDestination(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())
- );
+ InstanceIdentifier<OduConnection> oduConnectionIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(OduConnection.class, new OduConnectionKey(oduConnectionBuilder.getConnectionName()))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
DeviceTransaction deviceTx;
import org.opendaylight.transportpce.common.device.DeviceTransaction;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OduConnection.Direction;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.OrgOpenroadmDevice;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org.openroadm.device.OduConnection;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org.openroadm.device.OduConnectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container.org.openroadm.device.OduConnectionKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.otn.renderer.nodes.Nodes;
this.deviceTransactionManager = deviceTransactionManager;
}
- public Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container
- .org.openroadm.device.OduConnection> getOtnCrossConnect(String deviceId, String connectionNumber) {
-
+ public Optional<OduConnection> getOtnCrossConnect(String deviceId, String connectionNumber) {
return deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL,
generateOduConnectionIID(connectionNumber), Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
- private InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device
- .container.org.openroadm.device.OduConnection> generateOduConnectionIID(String connectionNumber) {
-
- return InstanceIdentifier.create(OrgOpenroadmDevice.class).child(org.opendaylight.yang.gen.v1.http.org
- .openroadm.device.rev200529.org.openroadm.device.container.org.openroadm.device.OduConnection.class,
- new OduConnectionKey(connectionNumber));
+ private InstanceIdentifier<OduConnection> generateOduConnectionIID(String connectionNumber) {
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(OduConnection.class, new OduConnectionKey(connectionNumber))
+ .build();
}
public Optional<String> postOtnCrossConnect(List<String> createdOduInterfaces, Nodes node) {
.SourceBuilder().setSrcIf(srcTp).build())
.setDirection(Direction.Bidirectional);
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device
- .container.org.openroadm.device.OduConnection> oduConnectionIID =
- InstanceIdentifier.create(
- org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device.container
- .OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.org.openroadm.device
- .container.org.openroadm.device.OduConnection.class,
- new OduConnectionKey(oduConnectionBuilder.getConnectionName())
- );
+ InstanceIdentifier<OduConnection> oduConnectionIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(OduConnection.class, new OduConnectionKey(oduConnectionBuilder.getConnectionName()))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
DeviceTransaction deviceTx;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.available.freq.map.AvailFreqMaps;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.available.freq.map.AvailFreqMapsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.available.freq.map.AvailFreqMapsKey;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
Arrays.fill(byteArray, (byte) GridConstant.AVAILABLE_SLOT_VALUE);
Map<AvailFreqMapsKey, AvailFreqMaps> waveMap = new HashMap<>();
AvailFreqMaps availFreqMaps = new AvailFreqMapsBuilder().setMapName(GridConstant.C_BAND)
- .setFreqMapGranularity(new FrequencyGHz(BigDecimal.valueOf(GridConstant.GRANULARITY)))
- .setStartEdgeFreq(new FrequencyTHz(BigDecimal.valueOf(GridConstant.START_EDGE_FREQUENCY)))
+ .setFreqMapGranularity(
+ new FrequencyGHz(Decimal64.valueOf(BigDecimal.valueOf(GridConstant.GRANULARITY))))
+ .setStartEdgeFreq(
+ new FrequencyTHz(Decimal64.valueOf(BigDecimal.valueOf(GridConstant.START_EDGE_FREQUENCY))))
.setEffectiveBits(Uint16.valueOf(GridConstant.EFFECTIVE_BITS))
.setFreqMap(byteArray)
.build();
/**
* Get the bit index for the frequency.
*
- * @param frequency BigDecimal
+ * @param atozMinFrequency BigDecimal
* @return the bit index of the frequency. Throw IllegalArgumentException if
* index not in range of 0 GridConstant.EFFECTIVE_BITS
*/
- public static int getIndexFromFrequency(BigDecimal frequency) {
- double nvalue = (frequency.doubleValue() - GridConstant.CENTRAL_FREQUENCY) * (1000 / GridConstant.GRANULARITY);
+ public static int getIndexFromFrequency(Decimal64 atozMinFrequency) {
+ double nvalue = (atozMinFrequency.doubleValue() - GridConstant.CENTRAL_FREQUENCY)
+ * (1000 / GridConstant.GRANULARITY);
int index = (int) Math.round(nvalue + 284);
if (index < 0 || index > GridConstant.EFFECTIVE_BITS) {
- throw new IllegalArgumentException("Frequency not in range " + frequency);
+ throw new IllegalArgumentException("Frequency not in range " + atozMinFrequency);
}
return index;
}
* @return central frequency in THz
*/
public static FrequencyTHz getCentralFrequency(BigDecimal minFrequency, BigDecimal maxFrequency) {
- return new FrequencyTHz(computeCentralFrequency(minFrequency, maxFrequency));
+ return new FrequencyTHz(Decimal64.valueOf(computeCentralFrequency(minFrequency, maxFrequency)));
}
getCentralFrequencyWithPrecision(BigDecimal minFrequency,
BigDecimal maxFrequency, int precision) {
return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyTHz(
- computeCentralFrequency(minFrequency, maxFrequency).setScale(precision, RoundingMode.HALF_EVEN));
+ Decimal64.valueOf(computeCentralFrequency(minFrequency, maxFrequency)
+ .setScale(precision, RoundingMode.HALF_EVEN)));
}
* @param frequency BigDecimal
* @return the lower spectral index
*/
- public static int getLowerSpectralIndexFromFrequency(BigDecimal frequency) {
+ public static int getLowerSpectralIndexFromFrequency(Decimal64 frequency) {
return getIndexFromFrequency(frequency) + 1;
}
* @param frequency BigDecimal
* @return the lower spectral index
*/
- public static int getHigherSpectralIndexFromFrequency(BigDecimal frequency) {
+ public static int getHigherSpectralIndexFromFrequency(Decimal64 frequency) {
return getIndexFromFrequency(frequency);
}
spectrumInformation.setWaveLength(input.getWaveNumber());
}
if (input.getMinFreq() != null) {
- spectrumInformation.setMinFrequency(input.getMinFreq().getValue());
+ spectrumInformation.setMinFrequency(input.getMinFreq().getValue().decimalValue());
} else {
spectrumInformation.setMinFrequency(
GridUtils.getStartFrequencyFromIndex(input.getLowerSpectralSlotNumber().intValue() - 1));
}
if (input.getMaxFreq() != null) {
- spectrumInformation.setMaxFrequency(input.getMaxFreq().getValue());
+ spectrumInformation.setMaxFrequency(input.getMaxFreq().getValue().decimalValue());
} else {
spectrumInformation.setMaxFrequency(
GridUtils.getStopFrequencyFromIndex(input.getHigherSpectralSlotNumber().intValue() - 1));
}
if (input.getCenterFreq() != null) {
- spectrumInformation.setCenterFrequency(input.getCenterFreq().getValue());
+ spectrumInformation.setCenterFrequency(input.getCenterFreq().getValue().decimalValue());
} else {
- spectrumInformation.setCenterFrequency(GridUtils
- .getCentralFrequency(spectrumInformation.getMinFrequency(),
- spectrumInformation.getMaxFrequency()).getValue());
+ spectrumInformation.setCenterFrequency(GridUtils.getCentralFrequency(spectrumInformation.getMinFrequency(),
+ spectrumInformation.getMaxFrequency()).getValue().decimalValue());
}
if (input.getNmcWidth() != null) {
- spectrumInformation.setWidth(input.getNmcWidth().getValue());
+ spectrumInformation.setWidth(input.getNmcWidth().getValue().decimalValue()
+ .setScale(0, RoundingMode.CEILING));
}
if (input.getModulationFormat() != null) {
spectrumInformation.setModulationFormat(input.getModulationFormat());
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.nodes.NodeInfoBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.Direction;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.CircuitPack;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.Port;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.PortsKey;
public boolean createMappingData(String nodeId) {
LOG.info(PortMappingUtils.CREATE_MAPPING_DATA_LOGMSG, nodeId, "1.2.1");
List<Mapping> portMapList = new ArrayList<>();
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class).child(Info.class).build();
Optional<Info> deviceInfoOptional = this.deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType
.OPERATIONAL, infoIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (deviceInfoOptional.isEmpty()) {
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.UPDATE, "a null value");
return false;
}
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(oldMapping.getSupportingCircuitPackName()))
- .child(Ports.class, new PortsKey(oldMapping.getSupportingPort()));
+ .child(Ports.class, new PortsKey(oldMapping.getSupportingPort()))
+ .build();
try {
Ports port = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
portId, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
private boolean createXpdrPortMapping(String nodeId, List<Mapping> portMapList) {
// Creating for Xponder Line and Client Ports
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class).build();
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.srg.CircuitPacks> srgCps
= new ArrayList<>();
LOG.debug(PortMappingUtils.GETTING_CP_LOGMSG, deviceId, srgCounter);
- InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)));
+ InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)))
+ .build();
Optional<SharedRiskGroup> ordmSrgObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, srgIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
nodeId, port.getPortName(), circuitPackName);
return null;
}
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> port2ID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
- .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
+ .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()))
+ .build();
Optional<Ports> port2Object = this.deviceTransactionManager
.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
private List<Ports> getPortList(String circuitPackName, String nodeId) {
- InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .build();
Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, cpIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
return null;
}
+ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+ value = "SLF4J_UNKNOWN_ARRAY",
+ justification = "False positive")
private Map<Integer, Degree> getDegreesMap(String deviceId, Info ordmInfo) {
Map<Integer, Degree> degrees = new HashMap<>();
for (int degreeCounter = 1; degreeCounter <= maxDegree; degreeCounter++) {
LOG.debug(PortMappingUtils.GETTING_CONPORT_LOGMSG, deviceId, degreeCounter);
- InstanceIdentifier<Degree> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Degree.class, new DegreeKey(Uint16.valueOf(degreeCounter)));
+ InstanceIdentifier<Degree> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(degreeCounter)))
+ .build();
Optional<Degree> ordmDegreeObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private Map<String, String> getEthInterfaceList(String nodeId) {
LOG.info(PortMappingUtils.GETTING_ETH_LIST_LOGMSG, nodeId);
- InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Protocols.class);
+ InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, protocoliid, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (!portConfig.getAdminStatus().equals(PortConfig.AdminStatus.Txandrx)) {
continue;
}
- InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(portConfig.getIfName()));
+ InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(portConfig.getIfName()))
+ .build();
Optional<Interface> interfaceObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, interfaceIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
String supportingCircuitPackName = interfaceObject.get().getSupportingCircuitPackName();
cpToInterfaceMap.put(supportingCircuitPackName, portConfig.getIfName());
InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier
- .create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(supportingCircuitPackName));
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(supportingCircuitPackName))
+ .build();
Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(
nodeId, LogicalDatastoreType.OPERATIONAL, circuitPacksIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
String logicalConnectionPoint, String partnerLcp) {
- List<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
- .SupportedIfCapability>> supportedIntf = new ArrayList<>();
+ Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
+ .SupportedIfCapability>> supportedIntf = new HashSet<>();
for (String sup: getSupIfCapList(port)) {
if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
}
private List<String> getSupIfCapList(Ports port) {
- List<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+ Set<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
return
supIfCapClassList == null
? Collections.emptyList()
}
private Ports getTtpPort(ConnectionPorts cp, String cpName, String nodeId) {
- InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(cpName))
- .child(Ports.class, new PortsKey(cp.getPortName()));
+ .child(Ports.class, new PortsKey(cp.getPortName()))
+ .build();
LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp.getPortName(), cpName);
Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
}
private Optional<Interface> getInterfaceFromDevice(String nodeId, String interfaceName) {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
return deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
interfacesIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.PortQual;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.XpdrNodeTypes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.CircuitPack;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
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.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.packs.CircuitPacks;
LOG.info(PortMappingUtils.CREATE_MAPPING_DATA_LOGMSG, nodeId, "2.2.1");
List<Mapping> portMapList = new ArrayList<>();
Map<McCapabilitiesKey, McCapabilities> mcCapabilities = new HashMap<>();
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Info.class)
+ .build();
Optional<Info> deviceInfoOptional = this.deviceTransactionManager.getDataFromDevice(
nodeId, LogicalDatastoreType.OPERATIONAL, infoIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.UPDATE, "a null value");
return false;
}
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(oldMapping.getSupportingCircuitPackName()))
- .child(Ports.class, new PortsKey(oldMapping.getSupportingPort()));
+ InstanceIdentifier<Ports> portId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(oldMapping.getSupportingCircuitPackName()))
+ .child(Ports.class, new PortsKey(oldMapping.getSupportingPort()))
+ .build();
try {
Ports port = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
portId, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
}
private OrgOpenroadmDevice getXpdrDevice(String nodeId) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (nbl.getPortList() == null) {
continue;
}
- List<String> lcpList = new ArrayList<>();
+ Set<String> lcpList = new HashSet<>();
for (PortList item : nbl.nonnullPortList().values()) {
String key = item.getCircuitPackName() + "+" + item.getPortName();
if (!lcpMap.containsKey(key)) {
List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.srg.CircuitPacks> srgCps
= new ArrayList<>();
LOG.debug(PortMappingUtils.GETTING_CP_LOGMSG, deviceId, srgCounter);
- InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)));
+ InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)))
+ .build();
Optional<SharedRiskGroup> ordmSrgObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, srgIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
nodeId, port.getPortName(), circuitPackName);
return null;
}
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> port2ID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
- .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
+ .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()))
+ .build();
Optional<Ports> port2Object = this.deviceTransactionManager
.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
private List<Ports> getPortList(String circuitPackName, String nodeId) {
- InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .build();
Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, cpIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
return null;
}
+ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+ value = "SLF4J_UNKNOWN_ARRAY",
+ justification = "False positive")
private Map<Integer, Degree> getDegreesMap(String deviceId, Info ordmInfo) {
Map<Integer, Degree> degrees = new HashMap<>();
for (int degreeCounter = 1; degreeCounter <= maxDegree; degreeCounter++) {
LOG.debug(PortMappingUtils.GETTING_CONPORT_LOGMSG, deviceId, degreeCounter);
- InstanceIdentifier<Degree> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Degree.class, new DegreeKey(Uint16.valueOf(degreeCounter)));
+ InstanceIdentifier<Degree> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(degreeCounter)))
+ .build();
Optional<Degree> ordmDegreeObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
// if not present assume to be 20 (temporary)
Integer maxSrg = ordmInfo.getMaxSrgs() == null ? 20 : ordmInfo.getMaxSrgs().toJava();
for (int srgCounter = 1; srgCounter <= maxSrg; srgCounter++) {
- InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)));
+ InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)))
+ .build();
Optional<SharedRiskGroup> ordmSrgObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, srgIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private Map<String, String> getEthInterfaceList(String nodeId) {
LOG.info(PortMappingUtils.GETTING_ETH_LIST_LOGMSG, nodeId);
- InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Protocols.class);
+ InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, protocoliid, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (!portConfig.getAdminStatus().equals(PortConfig.AdminStatus.Txandrx)) {
continue;
}
- InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(portConfig.getIfName()));
+ InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(portConfig.getIfName()))
+ .build();
Optional<Interface> interfaceObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, interfaceIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
String supportingCircuitPackName = interfaceObject.get().getSupportingCircuitPackName();
cpToInterfaceMap.put(supportingCircuitPackName, portConfig.getIfName());
- InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(supportingCircuitPackName));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(supportingCircuitPackName))
+ .build();
Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(
nodeId, LogicalDatastoreType.OPERATIONAL, circuitPacksIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private Mapping createNewXpdrMapping(String nodeId, Ports port, String circuitPackName,
String logicalConnectionPoint, String partnerLcp, XpdrNodeTypes xpdrNodeType) {
- List<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
- .SupportedIfCapability>> supportedIntf = new ArrayList<>();
+ Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
+ .SupportedIfCapability>> supportedIntf = new HashSet<>();
for (String sup: getSupIfCapList(port)) {
if (MappingUtilsImpl.convertSupIfCapa(sup) != null) {
supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sup));
}
private List<String> getSupIfCapList(Ports port) {
- List<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
+ Set<Class<? extends SupportedIfCapability>> supIfCapClassList = port.getSupportedInterfaceCapability();
if (supIfCapClassList != null) {
return supIfCapClassList
.stream().map(e -> e.getSimpleName())
}
private Ports getTtpPort(ConnectionPorts cp, String cpName, String nodeId) {
- InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(cpName))
- .child(Ports.class, new PortsKey(cp.getPortName()));
+ .child(Ports.class, new PortsKey(cp.getPortName()))
+ .build();
LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp.getPortName(), cpName);
Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
}
private Optional<Interface> getInterfaceFromDevice(String nodeId, String interfaceName) {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
return deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
interfacesIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.alarm.pm.types.rev191129.Direction;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.FrequencyGHz;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.CircuitPack;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.packs.CircuitPacks;
LOG.info(PortMappingUtils.CREATE_MAPPING_DATA_LOGMSG, nodeId, "7.1");
List<Mapping> portMapList = new ArrayList<>();
Map<McCapabilitiesKey, McCapabilities> mcCapabilities = new HashMap<>();
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Info.class)
+ .build();
Optional<Info> deviceInfoOptional = this.deviceTransactionManager.getDataFromDevice(
nodeId, LogicalDatastoreType.OPERATIONAL, infoIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
LOG.error(PortMappingUtils.UNABLE_MAPPING_LOGMSG, nodeId, PortMappingUtils.UPDATE, "a null value");
return false;
}
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(oldMapping.getSupportingCircuitPackName()))
- .child(Ports.class, new PortsKey(oldMapping.getSupportingPort()));
+ .child(Ports.class, new PortsKey(oldMapping.getSupportingPort()))
+ .build();
try {
Ports port = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
portId, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
|| !splBldr.getNonBlockingList().containsKey(new NonBlockingListKey(entry.getKey()))
? new NonBlockingListBuilder().setNblNumber(entry.getKey()).setInterconnectBandwidth(interconnectBw)
: new NonBlockingListBuilder(splBldr.getNonBlockingList().get(new NonBlockingListKey(entry.getKey())));
- List<String> lcpList = nblBldr.getLcpList() != null ? nblBldr.getLcpList() : new ArrayList<>();
+ Set<String> lcpList = nblBldr.getLcpList() != null ? nblBldr.getLcpList() : new HashSet<>();
for (InstanceIdentifier<PortList> id : entry.getValue()) {
PortList portList = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
id, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
}
private OrgOpenroadmDevice getXpdrDevice(String nodeId) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (nbl.getPortList() == null) {
continue;
}
- List<String> lcpList = new ArrayList<>();
+ Set<String> lcpList = new HashSet<>();
for (PortList item : nbl.nonnullPortList().values()) {
String key = item.getCircuitPackName() + "+" + item.getPortName();
if (!lcpMap.containsKey(key)) {
List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.srg.CircuitPacks> srgCps
= new ArrayList<>();
LOG.debug(PortMappingUtils.GETTING_CP_LOGMSG, deviceId, srgCounter);
- InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)));
+ InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)))
+ .build();
Optional<SharedRiskGroup> ordmSrgObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, srgIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
nodeId, port.getPortName(), circuitPackName);
return null;
}
- InstanceIdentifier<Ports> port2ID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> port2ID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(port.getPartnerPort().getCircuitPackName()))
- .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()));
+ .child(Ports.class, new PortsKey(port.getPartnerPort().getPortName()))
+ .build();
Optional<Ports> port2Object = this.deviceTransactionManager
.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, port2ID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
private List<Ports> getPortList(String circuitPackName, String nodeId) {
- InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .build();
Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, cpIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private Map<McCapabilityProfileKey, McCapabilityProfile> getMcCapabilityProfiles(String deviceId, Info ordmInfo) {
Map<McCapabilityProfileKey, McCapabilityProfile> mcCapabilityProfiles = new HashMap<>();
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
return mcCapabilityProfiles;
}
+ @edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+ value = "SLF4J_UNKNOWN_ARRAY",
+ justification = "False positive")
private Map<Integer, Degree> getDegreesMap(String deviceId, Info ordmInfo) {
Map<Integer, Degree> degrees = new HashMap<>();
for (int degreeCounter = 1; degreeCounter <= maxDegree; degreeCounter++) {
LOG.debug(PortMappingUtils.GETTING_CONPORT_LOGMSG, deviceId, degreeCounter);
- InstanceIdentifier<Degree> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Degree.class, new DegreeKey(Uint16.valueOf(degreeCounter)));
+ InstanceIdentifier<Degree> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(degreeCounter)))
+ .build();
Optional<Degree> ordmDegreeObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
// if not present assume to be 20 (temporary)
Integer maxSrg = ordmInfo.getMaxSrgs() == null ? 20 : ordmInfo.getMaxSrgs().toJava();
for (int srgCounter = 1; srgCounter <= maxSrg; srgCounter++) {
- InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)));
+ InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(srgCounter)))
+ .build();
Optional<SharedRiskGroup> ordmSrgObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, srgIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private Map<String, String> getEthInterfaceList(String nodeId) {
LOG.info(PortMappingUtils.GETTING_ETH_LIST_LOGMSG, nodeId);
- InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Protocols.class);
+ InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, protocoliid, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (!portConfig.getAdminStatus().equals(PortConfig.AdminStatus.Txandrx)) {
continue;
}
- InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(portConfig.getIfName()));
+ InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(portConfig.getIfName()))
+ .build();
Optional<Interface> interfaceObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, interfaceIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
String supportingCircuitPackName = interfaceObject.get().getSupportingCircuitPackName();
cpToInterfaceMap.put(supportingCircuitPackName, portConfig.getIfName());
- InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(supportingCircuitPackName));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(supportingCircuitPackName))
+ .build();
Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(
nodeId, LogicalDatastoreType.OPERATIONAL, circuitPacksIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
Collection<SupportedInterfaceCapability> supIntfCapaList = getSupIntfCapaList(port);
if (supIntfCapaList != null) {
- List<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
- .SupportedIfCapability>> supportedIntf = new ArrayList<>();
+ Set<Class<? extends org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211
+ .SupportedIfCapability>> supportedIntf = new HashSet<>();
SupportedInterfaceCapability sic1 = null;
for (SupportedInterfaceCapability sic : supIntfCapaList) {
supportedIntf.add(MappingUtilsImpl.convertSupIfCapa(sic.getIfCapType().getSimpleName()));
&& !sic1.getOtnCapability().getMpdrClientRestriction().isEmpty()) {
// Here we assume all the supported-interfaces has the support same rates, and the
// trib-slot numbers are assumed to be the same
- String mxpProfileName =
- sic1.getOtnCapability().getMpdrClientRestriction().get(0).getMuxpProfileName().get(0);
+ String mxpProfileName = sic1.getOtnCapability().getMpdrClientRestriction().get(0).getMuxpProfileName()
+ .stream().findFirst().get();
// From this muxponder-profile get the min-trib-slot and the max-trib-slot
LOG.info("{}: Muxp-profile used for trib information {}", nodeId, mxpProfileName);
// This provides the tribSlot information from muxProfile
ArrayList<OpucnTribSlotDef> minMaxOpucnTribSlots = new ArrayList<>(2);
LOG.info("{} : Getting Min/Max Trib-slots from {}", deviceId, mxpProfileName);
- InstanceIdentifier<MuxpProfile> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(MuxpProfile.class, new MuxpProfileKey(mxpProfileName));
+ InstanceIdentifier<MuxpProfile> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(MuxpProfile.class, new MuxpProfileKey(mxpProfileName))
+ .build();
Optional<MuxpProfile> muxpProfileObject = this.deviceTransactionManager.getDataFromDevice(deviceId,
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- List<OpucnTribSlotDef> ntwHoOduOpucnTribSlots = muxpProfileObject.get().getNetworkHoOduOpucnTribSlots();
+ Set<OpucnTribSlotDef> ntwHoOduOpucnTribSlots = muxpProfileObject.get().getNetworkHoOduOpucnTribSlots();
// Sort the tib-slots in ascending order and pick min and max
List<OpucnTribSlotDef> sortedNtwHoOduOpucnTribSlots = ntwHoOduOpucnTribSlots.stream().sorted(
Comparator.comparingDouble(x -> Double.parseDouble(
}
private Ports getTtpPort(ConnectionPorts cp, String cpName, String nodeId) {
- InstanceIdentifier<Ports> portID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(cpName))
- .child(Ports.class, new PortsKey(cp.getPortName()));
+ .child(Ports.class, new PortsKey(cp.getPortName()))
+ .build();
LOG.debug(PortMappingUtils.FETCH_CONNECTIONPORT_LOGMSG, nodeId, cp.getPortName(), cpName);
Optional<Ports> portObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, portID, Timeouts.DEVICE_READ_TIMEOUT,
}
private Optional<Interface> getInterfaceFromDevice(String nodeId, String interfaceName) {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
return deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
interfacesIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.device.DeviceTransaction;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.packs.CircuitPacks;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev161014.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev161014.States;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
nodeId), e);
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- Interface.class, new InterfaceKey(ifBuilder.getName()));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(ifBuilder.getName()))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, interfacesIID, ifBuilder.build());
FluentFuture<? extends @NonNull CommitInfo> txSubmitFuture =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
public Optional<Interface> getInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
return deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
interfacesIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
+ " deleting it!", interfaceName, AdminStates.OutOfService), ex);
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = this.deviceTransactionManager.getDeviceTransaction(
nodeId);
DeviceTransaction deviceTx;
public void postEquipmentState(String nodeId, String circuitPackName, boolean activate)
throws OpenRoadmInterfaceException {
- InstanceIdentifier<CircuitPacks> circuitPackIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- CircuitPacks.class, new CircuitPacksKey(circuitPackName));
+ InstanceIdentifier<CircuitPacks> circuitPackIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .build();
Optional<CircuitPacks> cpOpt = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.CONFIGURATION, circuitPackIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
private boolean checkIfDevicePortIsUpdatedWithInterface(String nodeId, InterfaceBuilder ifBuilder) {
- KeyedInstanceIdentifier<Ports, PortsKey> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(ifBuilder.getSupportingCircuitPackName()))
- .child(Ports.class, new PortsKey(ifBuilder.getSupportingPort()));
+ .child(Ports.class, new PortsKey(ifBuilder.getSupportingPort()))
+ .build();
Ports port = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
portIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
if (port.getInterfaces() == null) {
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.mapping.PortMappingVersion221;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
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.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.packs.CircuitPacks;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev171215.States;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
nodeId), e);
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- Interface.class, new InterfaceKey(ifBuilder.getName()));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(ifBuilder.getName()))
+ .build();
LOG.info("POST INTERF for {} : InterfaceBuilder : name = {} \t type = {}", nodeId, ifBuilder.getName(),
ifBuilder.getType().toString());
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, interfacesIID, ifBuilder.build());
public Optional<Interface> getInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
return deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
interfacesIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
+ " deleting it!", interfaceName, AdminStates.OutOfService), ex);
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = this.deviceTransactionManager.getDeviceTransaction(
nodeId);
DeviceTransaction deviceTx;
public void postEquipmentState(String nodeId, String circuitPackName, boolean activate)
throws OpenRoadmInterfaceException {
- InstanceIdentifier<CircuitPacks> circuitPackIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- CircuitPacks.class, new CircuitPacksKey(circuitPackName));
+ InstanceIdentifier<CircuitPacks> circuitPackIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .build();
Optional<CircuitPacks> cpOpt = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.CONFIGURATION, circuitPackIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
private boolean checkIfDevicePortIsUpdatedWithInterface(String nodeId, InterfaceBuilder ifBuilder) {
- KeyedInstanceIdentifier<Ports, PortsKey> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(ifBuilder.getSupportingCircuitPackName()))
- .child(Ports.class, new PortsKey(ifBuilder.getSupportingPort()));
+ .child(Ports.class, new PortsKey(ifBuilder.getSupportingPort()))
+ .build();
Ports port = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
portIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
if (port.getInterfaces() == null) {
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.mapping.PortMappingVersion710;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.packs.CircuitPacks;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates;
import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.States;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
nodeId), e);
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- Interface.class, new InterfaceKey(ifBuilder.getName()));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(ifBuilder.getName()))
+ .build();
LOG.info("POST INTERF for {} : InterfaceBuilder : name = {} \t type = {}", nodeId, ifBuilder.getName(),
ifBuilder.getType().toString());
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, interfacesIID, ifBuilder.build());
public Optional<Interface> getInterface(String nodeId, String interfaceName) throws OpenRoadmInterfaceException {
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
return deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
interfacesIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
+ " deleting it!", interfaceName, AdminStates.OutOfService), ex);
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
Future<Optional<DeviceTransaction>> deviceTxFuture = this.deviceTransactionManager.getDeviceTransaction(
nodeId);
DeviceTransaction deviceTx;
public void postEquipmentState(String nodeId, String circuitPackName, boolean activate)
throws OpenRoadmInterfaceException {
- InstanceIdentifier<CircuitPacks> circuitPackIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(
- CircuitPacks.class, new CircuitPacksKey(circuitPackName));
+ InstanceIdentifier<CircuitPacks> circuitPackIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .build();
Optional<CircuitPacks> cpOpt = this.deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.CONFIGURATION, circuitPackIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
try {
supInterfOpt = getInterface(nodeId, interf);
if (supInterfOpt.isPresent()) {
- return supInterfOpt.get().getSupportingInterfaceList().get(0);
+ return supInterfOpt.get().getSupportingInterfaceList().stream().findFirst().get();
} else {
return null;
}
}
private boolean checkIfDevicePortIsUpdatedWithInterface(String nodeId, InterfaceBuilder ifBuilder) {
- KeyedInstanceIdentifier<Ports, PortsKey> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(ifBuilder.getSupportingCircuitPackName()))
- .child(Ports.class, new PortsKey(ifBuilder.getSupportingPort()));
+ .child(Ports.class, new PortsKey(ifBuilder.getSupportingPort()))
+ .build();
Ports port = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL,
portIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT).get();
if (port.getInterfaces() == null) {
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.math.BigDecimal;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import org.junit.Assert;
import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.OpticalControlMode;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnectionsKey;
import org.opendaylight.yangtools.util.concurrent.FluentFutures;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
public class CrossConnectImpl121Test {
crossConnectImpl121 = new CrossConnectImpl121(deviceTransactionManager);
//mock responses for deviceTransactionManager calls
- InstanceIdentifier<RoadmConnections> deviceIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey("1"));
+ InstanceIdentifier<RoadmConnections> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey("1"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("deviceId",
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
// TODO : fix commit
@Test(expected = NullPointerException.class)
public void setPowerLevelTest() {
- InstanceIdentifier<RoadmConnections> deviceIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey("1"));
+ InstanceIdentifier<RoadmConnections> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey("1"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("deviceId",
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
Mockito.when(deviceTransactionManager.getDeviceTransaction("deviceId"))
.thenReturn(CompletableFuture.completedFuture(Optional.of(mock(DeviceTransaction.class))));
- crossConnectImpl121.setPowerLevel("deviceId", OpticalControlMode.Power, new BigDecimal(100), "1");
+ crossConnectImpl121.setPowerLevel("deviceId", OpticalControlMode.Power, Decimal64.valueOf("100"), "1");
Assert.assertTrue("set Level should be true", true);
}
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
-import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import org.opendaylight.transportpce.common.device.DeviceTransactionManagerImpl;
import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
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.RoadmConnections;
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.rev210930.otn.renderer.nodes.Nodes;
import org.opendaylight.yangtools.util.concurrent.FluentFutures;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
public class CrossConnectImpl221Test {
crossConnectImpl221 = new CrossConnectImpl221(deviceTransactionManager);
//mock responses for deviceTransactionManager calls
- InstanceIdentifier<RoadmConnections> deviceIID =
- InstanceIdentifier
- .create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey("1"));
+ InstanceIdentifier<RoadmConnections> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey("1"))
+ .build();
Mockito.when(deviceTransactionManager.getDataFromDevice("deviceId",
LogicalDatastoreType.CONFIGURATION, deviceIID,
@Test(expected = NullPointerException.class)
public void setPowerLevelTest() {
- InstanceIdentifier<RoadmConnections> deviceIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey("1"));
+ InstanceIdentifier<RoadmConnections> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey("1"))
+ .build();
Mockito.when(deviceTransactionManager.getDataFromDevice("deviceId",
LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
Mockito.when(deviceTransactionManager.getDeviceTransaction("deviceId"))
.thenReturn(CompletableFuture.completedFuture(Optional.of(mock(DeviceTransaction.class))));
- crossConnectImpl221.setPowerLevel("deviceId", OpticalControlMode.GainLoss, new BigDecimal(100), "1");
+ crossConnectImpl221.setPowerLevel("deviceId", OpticalControlMode.GainLoss, Decimal64.valueOf("100"), "1");
Assert.assertTrue("set Level should be true", true);
}
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.math.BigDecimal;
import java.util.List;
import java.util.Optional;
import org.junit.Assert;
import org.opendaylight.transportpce.common.fixedflex.SpectrumInformation;
import org.opendaylight.transportpce.common.mapping.MappingUtils;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.RoadmConnections;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
@Ignore
@Test
public void setPowerLevel() {
- boolean res = crossConnectImpl.setPowerLevel("100", "srcTp", new BigDecimal(100), "power");
+ boolean res = crossConnectImpl.setPowerLevel("100", "srcTp", Decimal64.valueOf("100"), "power");
Assert.assertFalse("Power Level sgould be false",res);
String devV121 = "(http://org/openroadm/device?revision=2017-02-06)org-openroadm-device";
when(crossConnectImpl121.setPowerLevel(any(), any(), any(), any()))
.thenReturn(true);
//FIXME: this part of the test needs to be reviewed
- crossConnectImpl.setPowerLevel("100", "srcTp", new BigDecimal(100), "power");
+ crossConnectImpl.setPowerLevel("100", "srcTp", Decimal64.valueOf("100"), "power");
Assert.assertTrue(true);
}
}
import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkBuilder;
import org.opendaylight.yangtools.util.concurrent.FluentFutures;
private DeviceTransactionManagerImpl transactionManager;
private String defaultDeviceId = "device-id";
private LogicalDatastoreType defaultDatastore = LogicalDatastoreType.OPERATIONAL;
- private InstanceIdentifier<Network> defaultIid = InstanceIdentifier.create(Network.class);
+ private InstanceIdentifier<Network> defaultIid = InstanceIdentifier
+ .builder(Networks.class).child(Network.class).build();
private Network defaultData;
private long defaultTimeout = 1000;
private TimeUnit defaultTimeUnit = TimeUnit.MILLISECONDS;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.available.freq.map.AvailFreqMaps;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.available.freq.map.AvailFreqMapsKey;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
public class GridUtilsTest {
@Test
public void getIndexFromFrequencyTest() {
- assertEquals("Index should be 693", 693, GridUtils.getIndexFromFrequency(BigDecimal.valueOf(195.65625)));
- assertEquals("Index should be 0", 0, GridUtils.getIndexFromFrequency(BigDecimal.valueOf(191.325)));
- assertEquals("Index should be 767", 767, GridUtils.getIndexFromFrequency(BigDecimal.valueOf(196.11875)));
- assertEquals("Index should be 8", 8, GridUtils.getIndexFromFrequency(BigDecimal.valueOf(191.375)));
- assertEquals("Index should be 15", 15, GridUtils.getIndexFromFrequency(BigDecimal.valueOf(191.41875)));
- assertEquals("Index should be 768", 768, GridUtils.getIndexFromFrequency(BigDecimal.valueOf(196.125)));
+ assertEquals("Index should be 693", 693, GridUtils.getIndexFromFrequency(Decimal64.valueOf("195.65625")));
+ assertEquals("Index should be 0", 0, GridUtils.getIndexFromFrequency(Decimal64.valueOf("191.325")));
+ assertEquals("Index should be 767", 767, GridUtils.getIndexFromFrequency(Decimal64.valueOf("196.11875")));
+ assertEquals("Index should be 8", 8, GridUtils.getIndexFromFrequency(Decimal64.valueOf("191.375")));
+ assertEquals("Index should be 15", 15, GridUtils.getIndexFromFrequency(Decimal64.valueOf("191.41875")));
+ assertEquals("Index should be 768", 768, GridUtils.getIndexFromFrequency(Decimal64.valueOf("196.125")));
}
@Test(expected = IllegalArgumentException.class)
public void getIndexFromFrequencyExceptionTest() {
- GridUtils.getIndexFromFrequency(BigDecimal.valueOf(196.13125));
+ GridUtils.getIndexFromFrequency(Decimal64.valueOf("196.13125"));
}
@Test(expected = IllegalArgumentException.class)
public void getIndexFromFrequencyException2Test() {
- GridUtils.getIndexFromFrequency(BigDecimal.valueOf(191.31875));
+ GridUtils.getIndexFromFrequency(Decimal64.valueOf("191.31875"));
}
@Test
public void getWidthFromRateAndModulationFormatTest() {
- assertEquals("Width should be 75", new FrequencyGHz(GridConstant.WIDTH_75),
+ assertEquals("Width should be 75", new FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_75)),
GridUtils.getWidthFromRateAndModulationFormat(ServiceRateConstant.RATE_400,
ModulationFormat.DpQam16));
}
@Test
public void getWidthFromRateAndModulationFormatNotFoundTest() {
- assertEquals("As not found width should be 40", new FrequencyGHz(GridConstant.WIDTH_40),
+ assertEquals("As not found width should be 40", new FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_40)),
GridUtils.getWidthFromRateAndModulationFormat(ServiceRateConstant.RATE_100,
ModulationFormat.DpQam16));
}
@Test
public void getCentralFrequencyTest() {
assertEquals("Central frequency should be 191.350",
- new FrequencyTHz(BigDecimal.valueOf(191.35).setScale(3)),
+ new FrequencyTHz(Decimal64.valueOf(BigDecimal.valueOf(191.35).setScale(3))),
GridUtils.getCentralFrequency(BigDecimal.valueOf(191.325), BigDecimal.valueOf(191.375)));
}
public void getCentralFrequencyWithPrecisionTest() {
assertEquals("Central frequency should be 191.3500",
new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyTHz(
- BigDecimal.valueOf(191.35).setScale(4)),
+ Decimal64.valueOf(BigDecimal.valueOf(191.35).setScale(4))),
GridUtils.getCentralFrequencyWithPrecision(BigDecimal.valueOf(191.325),
BigDecimal.valueOf(191.375), 4));
}
public void getCentralFrequencyWithPrecisionAndRoundTest() {
assertEquals("Central frequency should be 191.3499",
new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyTHz(
- BigDecimal.valueOf(191.3499)),
+ Decimal64.valueOf("191.3499")),
GridUtils.getCentralFrequencyWithPrecision(BigDecimal.valueOf(191.3244445),
BigDecimal.valueOf(191.3754457788), 4));
}
ServicePathInput input = new ServicePathInputBuilder()
.setWaveNumber(Uint32.valueOf(1))
.setCenterFreq(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyTHz(BigDecimal.valueOf(196.1)))
+ .FrequencyTHz(Decimal64.valueOf("196.1")))
.setHigherSpectralSlotNumber(Uint32.valueOf(768))
.setLowerSpectralSlotNumber(Uint32.valueOf(761))
.setMaxFreq(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyTHz(BigDecimal.valueOf(196.125)))
+ .FrequencyTHz(Decimal64.valueOf("196.125")))
.setMinFreq(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyTHz(BigDecimal.valueOf(196.075)))
+ .FrequencyTHz(Decimal64.valueOf("196.075")))
.setNmcWidth(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyGHz(GridConstant.WIDTH_40))
+ .FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_40)))
.build();
SpectrumInformation spectrumInformation = GridUtils.initSpectrumInformationFromServicePathInput(input);
assertEquals("Width should be 40", BigDecimal.valueOf(40), spectrumInformation.getWidth());
.setHigherSpectralSlotNumber(Uint32.valueOf(768))
.setLowerSpectralSlotNumber(Uint32.valueOf(761))
.setMaxFreq(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyTHz(BigDecimal.valueOf(196.125)))
+ .FrequencyTHz(Decimal64.valueOf("196.125")))
.setMinFreq(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyTHz(BigDecimal.valueOf(196.075)))
+ .FrequencyTHz(Decimal64.valueOf("196.075")))
.setNmcWidth(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyGHz(GridConstant.WIDTH_40))
+ .FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_40)))
.build();
SpectrumInformation spectrumInformation = GridUtils.initSpectrumInformationFromServicePathInput(input);
assertEquals("Width should be 40", BigDecimal.valueOf(40), spectrumInformation.getWidth());
.setHigherSpectralSlotNumber(Uint32.valueOf(768))
.setLowerSpectralSlotNumber(Uint32.valueOf(761))
.setNmcWidth(new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019
- .FrequencyGHz(GridConstant.WIDTH_40))
+ .FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_40)))
.build();
SpectrumInformation spectrumInformation = GridUtils.initSpectrumInformationFromServicePathInput(input);
assertEquals("Width should be 40", BigDecimal.valueOf(40), spectrumInformation.getWidth());
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.Direction;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.NodeTypes;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.Port;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.ParentCircuitPackBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
Protocols protocols = new ProtocolsBuilder().addAugmentation(augmentation).build();
// mock responses for deviceTransactionManager calls
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device
- .rev170206.org.openroadm.device.container.org.openroadm.device.Degree> deviceIID = InstanceIdentifier
- .create(OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device
- .rev170206.org.openroadm.device.container.org.openroadm.device.Degree.class,
- new DegreeKey(Uint16.valueOf(1)));
+ InstanceIdentifier<Degree> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(1)))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(ordmDegreeObject));
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .org.openroadm.device.container.org.openroadm.device.Degree> deviceIID3 = InstanceIdentifier
- .create(OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .org.openroadm.device.container.org.openroadm.device.Degree.class,
- new DegreeKey(Uint16.valueOf(2)));
+ InstanceIdentifier<Degree> deviceIID3 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(2)))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID3,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(ordmDegreeObject3));
- InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .org.openroadm.device.container.org.openroadm.device.Degree> deviceIID5 = InstanceIdentifier
- .create(OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .org.openroadm.device.container.org.openroadm.device.Degree.class,
- new DegreeKey(Uint16.valueOf(3)));
+ InstanceIdentifier<Degree> deviceIID5 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(3)))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID5,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(ordmDegreeObject5));
- InstanceIdentifier<Protocols> protocoliid =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocoliid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, protocoliid,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(protocols));
Interface interfaceObject = new InterfaceBuilder().withKey(new InterfaceKey("itf1"))
.setSupportingCircuitPackName("sc1").build();
- InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(portConfig.getIfName()));
+ InstanceIdentifier<Interface> interfaceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(portConfig.getIfName()))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, interfaceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(interfaceObject));
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, portID55,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(ports55));
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Info.class)
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, infoIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(info));
- InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c1"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c1"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject));
- InstanceIdentifier<CircuitPacks> circuitPacksIID2 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c2"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID2 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c2"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID2,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject2));
- InstanceIdentifier<CircuitPacks> circuitPacksIID3 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c3"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID3 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c3"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID3,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject3));
- InstanceIdentifier<CircuitPacks> circuitPacksIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c4"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID4 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c4"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID4,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject4));
- InstanceIdentifier<CircuitPacks> circuitPacksIID5 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c5"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID5 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c5"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID5,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject5));
- InstanceIdentifier<CircuitPacks> circuitPacksIID6 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c6"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID6 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c6"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID6,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject6));
- InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(1)));
+ InstanceIdentifier<SharedRiskGroup> srgIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(1)))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, srgIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(ordmSrgObject));
- InstanceIdentifier<SharedRiskGroup> srgIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(2)));
+ InstanceIdentifier<SharedRiskGroup> srgIID4 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(2)))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, srgIID4,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(ordmSrgObject4));
- InstanceIdentifier<SharedRiskGroup> srgIID6 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(3)));
+ InstanceIdentifier<SharedRiskGroup> srgIID6 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(SharedRiskGroup.class, new SharedRiskGroupKey(Uint16.valueOf(3)))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, srgIID6,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(ordmSrgObject6));
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, portID5,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(ports5));
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Info.class)
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, infoIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(info));
CircuitPacks circuitPackObject3 = getCircuitPacks(portsList2, "c3", "pc3");
CircuitPacks circuitPackObject4 = getCircuitPacks(portsList4, "c4", "pc4");
- InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c1"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c1"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject));
- InstanceIdentifier<CircuitPacks> circuitPacksIID2 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c2"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID2 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c2"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID2,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject2));
- InstanceIdentifier<CircuitPacks> circuitPacksIID3 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c3"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID3 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c3"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID3,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject3));
- InstanceIdentifier<CircuitPacks> circuitPacksIID4 = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("c4"));
+ InstanceIdentifier<CircuitPacks> circuitPacksIID4 = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("c4"))
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, circuitPacksIID4,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT))
.thenReturn(Optional.of(circuitPackObject4));
OrgOpenroadmDevice deviceObject = new OrgOpenroadmDeviceBuilder().setCircuitPacks(circuitPacksMap)
.setConnectionMap(connectionMapMap).build();
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
when(deviceTransactionManager.getDataFromDevice("node", LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(Optional.of(deviceObject));
}
@NonNull
- private KeyedInstanceIdentifier<Ports, PortsKey> getChild(String c4, String p5) {
- return InstanceIdentifier.create(OrgOpenroadmDevice.class).child(CircuitPacks.class, new CircuitPacksKey(c4))
- .child(Ports.class, new PortsKey(p5));
+ private InstanceIdentifier<Ports> getChild(String c4, String p5) {
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(c4))
+ .child(Ports.class, new PortsKey(p5))
+ .build();
}
private ConnectionMap getConnectionMap(List<Destination> destinationList) {
-{"gnpy-api:request":{"topology":{"connections":[{"from_node":"127.0.0.51","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"127.0.0.31"},{"from_node":"127.0.0.10","to_node":"243.0.0.1"},{"from_node":"243.0.0.1","to_node":"127.0.0.30"},{"from_node":"127.0.0.20","to_node":"127.0.0.21"},{"from_node":"127.0.0.20","to_node":"243.0.0.2"},{"from_node":"243.0.0.2","to_node":"127.0.0.10"},{"from_node":"127.0.0.20","to_node":"243.0.0.3"},{"from_node":"243.0.0.3","to_node":"127.0.0.50"},{"from_node":"127.0.0.40","to_node":"127.0.0.41"},{"from_node":"127.0.0.40","to_node":"243.0.0.4"},{"from_node":"243.0.0.4","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"243.0.0.5"},{"from_node":"243.0.0.5","to_node":"127.0.0.30"},{"from_node":"127.0.0.31","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"127.0.0.51"},{"from_node":"127.0.0.20","to_node":"243.0.0.6"},{"from_node":"243.0.0.6","to_node":"127.0.0.30"},{"from_node":"127.0.0.30","to_node":"243.0.0.7"},{"from_node":"243.0.0.7","to_node":"127.0.0.40"},{"from_node":"127.0.0.11","to_node":"127.0.0.10"},{"from_node":"127.0.0.30","to_node":"243.0.0.8"},{"from_node":"243.0.0.8","to_node":"127.0.0.10"},{"from_node":"127.0.0.40","to_node":"243.0.0.9"},{"from_node":"243.0.0.9","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"243.0.0.10"},{"from_node":"243.0.0.10","to_node":"127.0.0.50"},{"from_node":"127.0.0.50","to_node":"243.0.0.11"},{"from_node":"243.0.0.11","to_node":"127.0.0.20"},{"from_node":"127.0.0.50","to_node":"243.0.0.12"},{"from_node":"243.0.0.12","to_node":"127.0.0.40"},{"from_node":"127.0.0.21","to_node":"127.0.0.20"},{"from_node":"127.0.0.41","to_node":"127.0.0.40"},{"from_node":"127.0.0.30","to_node":"243.0.0.13"},{"from_node":"243.0.0.13","to_node":"127.0.0.20"},{"from_node":"127.0.0.10","to_node":"127.0.0.11"},{"from_node":"127.0.0.10","to_node":"243.0.0.14"},{"from_node":"243.0.0.14","to_node":"127.0.0.20"}],"elements":[{"uid":"127.0.0.11","metadata":{"location":{"latitude":0,"longitude":0,"region":"XPONDER-1"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.10","metadata":{"location":{"latitude":0,"longitude":0,"region":"OpenROADM-1"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20}},{"uid":"127.0.0.51","metadata":{"location":{"latitude":0,"longitude":0,"region":"XPONDER-5"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.50","metadata":{"location":{"latitude":0,"longitude":0,"region":"OpenROADM-5"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20}},{"uid":"127.0.0.31","metadata":{"location":{"latitude":0,"longitude":0,"region":"XPONDER-3"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.30","metadata":{"location":{"latitude":0,"longitude":0,"region":"OpenROADM-3"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20}},{"uid":"127.0.0.21","metadata":{"location":{"latitude":0,"longitude":0,"region":"XPONDER-2"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.40","metadata":{"location":{"latitude":0,"longitude":0,"region":"OpenROADM-4"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20}},{"uid":"127.0.0.20","metadata":{"location":{"latitude":0,"longitude":0,"region":"OpenROADM-2"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20}},{"uid":"127.0.0.41","metadata":{"location":{"latitude":0,"longitude":0,"region":"XPONDER-4"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"243.0.0.12","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.29}},{"uid":"243.0.0.11","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":60,"con_out":0,"loss_coef":0.12}},{"uid":"243.0.0.10","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":60,"con_out":0,"loss_coef":0.12}},{"uid":"243.0.0.14","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.29}},{"uid":"243.0.0.13","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":140,"con_out":0,"loss_coef":0.2127659574468085124099303584443987347185611724853515625}},{"uid":"243.0.0.8","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.11999999999999999555910790149937383830547332763671875}},{"uid":"243.0.0.9","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.29}},{"uid":"243.0.0.4","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.29}},{"uid":"243.0.0.5","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":60,"con_out":0,"loss_coef":0.12}},{"uid":"243.0.0.6","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":140,"con_out":0,"loss_coef":0.2127659574468085124099303584443987347185611724853515625}},{"uid":"243.0.0.7","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.29}},{"uid":"243.0.0.1","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.11999999999999999555910790149937383830547332763671875}},{"uid":"243.0.0.2","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":100,"con_out":0,"loss_coef":0.29}},{"uid":"243.0.0.3","metadata":{"location":{"latitude":0,"city":"N/A","longitude":0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0,"con_in":0,"length":60,"con_out":0,"loss_coef":0.12}}]},"service":{"path-request":[{"request-id":"2","bidirectional":false,"dst-tp-id":"ZHN0VHBJZA\u003d\u003d","src-tp-id":"c3JjVHBJZA\u003d\u003d","path-constraints":{"te-bandwidth":{"spacing":50000000000,"trx_mode":"W100G","trx_type":"openroadm-beta1","effective-freq-slot":[{"N":0,"M":4}],"path_bandwidth":100,"technology":"flexi-grid"}},"source":"127.0.0.11","explicit-route-objects":{"route-object-include-exclude":[{"index":0,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.20"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"},{"index":1,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.30"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"}]},"destination":"127.0.0.41"}]}}}
\ No newline at end of file
+{"gnpy-api:request":{"topology":{"connections":[{"from_node":"127.0.0.51","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"127.0.0.31"},{"from_node":"127.0.0.10","to_node":"243.0.0.1"},{"from_node":"243.0.0.1","to_node":"127.0.0.30"},{"from_node":"127.0.0.20","to_node":"127.0.0.21"},{"from_node":"127.0.0.20","to_node":"243.0.0.2"},{"from_node":"243.0.0.2","to_node":"127.0.0.10"},{"from_node":"127.0.0.20","to_node":"243.0.0.3"},{"from_node":"243.0.0.3","to_node":"127.0.0.50"},{"from_node":"127.0.0.40","to_node":"127.0.0.41"},{"from_node":"127.0.0.40","to_node":"243.0.0.4"},{"from_node":"243.0.0.4","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"243.0.0.5"},{"from_node":"243.0.0.5","to_node":"127.0.0.30"},{"from_node":"127.0.0.31","to_node":"127.0.0.30"},{"from_node":"127.0.0.50","to_node":"127.0.0.51"},{"from_node":"127.0.0.20","to_node":"243.0.0.6"},{"from_node":"243.0.0.6","to_node":"127.0.0.30"},{"from_node":"127.0.0.30","to_node":"243.0.0.7"},{"from_node":"243.0.0.7","to_node":"127.0.0.40"},{"from_node":"127.0.0.11","to_node":"127.0.0.10"},{"from_node":"127.0.0.30","to_node":"243.0.0.8"},{"from_node":"243.0.0.8","to_node":"127.0.0.10"},{"from_node":"127.0.0.40","to_node":"243.0.0.9"},{"from_node":"243.0.0.9","to_node":"127.0.0.50"},{"from_node":"127.0.0.30","to_node":"243.0.0.10"},{"from_node":"243.0.0.10","to_node":"127.0.0.50"},{"from_node":"127.0.0.50","to_node":"243.0.0.11"},{"from_node":"243.0.0.11","to_node":"127.0.0.20"},{"from_node":"127.0.0.50","to_node":"243.0.0.12"},{"from_node":"243.0.0.12","to_node":"127.0.0.40"},{"from_node":"127.0.0.21","to_node":"127.0.0.20"},{"from_node":"127.0.0.41","to_node":"127.0.0.40"},{"from_node":"127.0.0.30","to_node":"243.0.0.13"},{"from_node":"243.0.0.13","to_node":"127.0.0.20"},{"from_node":"127.0.0.10","to_node":"127.0.0.11"},{"from_node":"127.0.0.10","to_node":"243.0.0.14"},{"from_node":"243.0.0.14","to_node":"127.0.0.20"}],"elements":[{"uid":"127.0.0.11","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-1"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.10","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-1"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.51","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-5"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.50","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-5"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.31","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-3"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.30","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-3"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.21","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-2"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"127.0.0.40","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-4"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.20","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"OpenROADM-2"}},"type":"gnpy-network-topology:Roadm","params":{"target_pch_out_db":-20.0}},{"uid":"127.0.0.41","metadata":{"location":{"latitude":0.0,"longitude":0.0,"region":"XPONDER-4"}},"type":"gnpy-network-topology:Transceiver"},{"uid":"243.0.0.12","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.11","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.10","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.14","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.13","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21000}},{"uid":"243.0.0.8","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.9","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.4","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.5","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.6","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":140.0,"con_out":0.0,"loss_coef":0.21000}},{"uid":"243.0.0.7","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.1","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.12000}},{"uid":"243.0.0.2","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":100.0,"con_out":0.0,"loss_coef":0.29000}},{"uid":"243.0.0.3","metadata":{"location":{"latitude":0.0,"city":"N/A","longitude":0.0,"region":"N/A"}},"type":"gnpy-network-topology:Fiber","type_variety":"SSMF","params":{"length_units":"gnpy-network-topology:km","att_in":0.0,"con_in":0.0,"length":60.0,"con_out":0.0,"loss_coef":0.12000}}]},"service":{"path-request":[{"request-id":"2","bidirectional":false,"dst-tp-id":"ZHN0VHBJZA\u003d\u003d","src-tp-id":"c3JjVHBJZA\u003d\u003d","path-constraints":{"te-bandwidth":{"spacing":50000000000.0,"trx_mode":"W100G","trx_type":"openroadm-beta1","effective-freq-slot":[{"N":0,"M":4}],"path_bandwidth":100.0,"technology":"flexi-grid"}},"source":"127.0.0.11","explicit-route-objects":{"route-object-include-exclude":[{"index":0,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.20"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"},{"index":1,"num-unnum-hop":{"hop-type":"STRICT","link-tp-id":"1","node-id":"127.0.0.30"},"explicit-route-usage":"gnpy-path-computation-simplified:route-include-ero"}]},"destination":"127.0.0.41"}]}}}
\ No newline at end of file
},
"params": {
"length": 100,
- "loss_coef": 0.11999999999999999555910790149937383830547332763671875,
+ "loss_coef": 0.12,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
},
"params": {
"length": 140,
- "loss_coef": 0.2127659574468085124099303584443987347185611724853515625,
+ "loss_coef": 0.21,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
},
"params": {
"length": 100,
- "loss_coef": 0.11999999999999999555910790149937383830547332763671875,
+ "loss_coef": 0.12,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
},
"params": {
"length": 140,
- "loss_coef": 0.2127659574468085124099303584443987347185611724853515625,
+ "loss_coef": 0.21,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.inventory.query.Queries;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlots;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlotsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
public boolean addNode(String deviceId) {
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Info.class)
+ .build();
Optional<Info> infoOpt =
deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, infoIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
public void getCircuitPacks(String nodeId) throws InterruptedException, ExecutionException {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevInterfaces(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevProtocols(String nodeId, Connection connection) {
- InstanceIdentifier<Protocols> protocolsIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevProtocolLldpPortConfig(String nodeId, Connection connection) {
- InstanceIdentifier<Protocols> protocolsIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevProtocolLldpNbrList(String nodeId, Connection connection) {
- InstanceIdentifier<Protocols> protocolsIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevInternalLinks(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevExternalLinks(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevPhysicalLinks(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevDegree(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevSrg(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
//int opticalcontrolmodeEnu=-1;
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevConnectionMap(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevWavelengthMap(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
import org.opendaylight.transportpce.common.Timeouts;
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.transportpce.inventory.query.Queries;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlots;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.CpSlotsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.packs.CircuitPacks;
public boolean addNode(String deviceId) {
- InstanceIdentifier<Info> infoIID = InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Info.class);
+ InstanceIdentifier<Info> infoIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Info.class)
+ .build();
Optional<Info> infoOpt =
deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, infoIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
public void getRoadmShelves(String nodeId) throws InterruptedException, ExecutionException {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.OPERATIONAL, deviceIID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
public void getCircuitPacks(String nodeId) throws InterruptedException, ExecutionException {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevInterfaces(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevProtocols(String nodeId, Connection connection) {
- InstanceIdentifier<Protocols> protocolsIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevProtocolLldpPortConfig(String nodeId, Connection connection) {
- InstanceIdentifier<Protocols> protocolsIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevProtocolLldpNbrList(String nodeId, Connection connection) {
- InstanceIdentifier<Protocols> protocolsIID =
- InstanceIdentifier.create(OrgOpenroadmDevice.class).child(Protocols.class);
+ InstanceIdentifier<Protocols> protocolsIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevInternalLinks(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevExternalLinks(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevPhysicalLinks(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevDegree(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevSrg(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevRoadmConnections(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
private void persistDevConnectionMap(String nodeId, Connection connection) {
- InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ InstanceIdentifier<OrgOpenroadmDevice> deviceIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
Optional<OrgOpenroadmDevice> deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
if (!linkOptional.isPresent()) {
LOG.info("Link not present");
return RpcResultBuilder
- .success(new DeleteLinkOutputBuilder().setResult(
- "Fail"))
+ .success(new DeleteLinkOutputBuilder().setResult("Fail").build())
.buildFuture();
}
} catch (ExecutionException | InterruptedException e) {
LOG.error("readMdSal: Error reading link {}", input.getLinkId());
return RpcResultBuilder
- .success(new DeleteLinkOutputBuilder().setResult(
- "Fail"))
+ .success(new DeleteLinkOutputBuilder().setResult("Fail").build())
.buildFuture();
}
LOG.info("Link with linkId: {} deleted from {} layer.",
input.getLinkId(), NetworkUtils.OVERLAY_NETWORK_ID);
return RpcResultBuilder
- .success(new DeleteLinkOutputBuilder().setResult(
- "Link {} deleted successfully"))
+ .success(new DeleteLinkOutputBuilder().setResult("Link {} deleted successfully").build())
.buildFuture();
} catch (InterruptedException | ExecutionException e) {
return RpcResultBuilder.<DeleteLinkOutput>failed().buildFuture();
boolean createRdmLinks = OrdLink.createRdm2RdmLinks(input, this.dataBroker);
if (createRdmLinks) {
return RpcResultBuilder
- .success(new InitRoadmNodesOutputBuilder().setResult(
- "Unidirectional Roadm-to-Roadm Link created successfully"))
+ .success(new InitRoadmNodesOutputBuilder()
+ .setResult("Unidirectional Roadm-to-Roadm Link created successfully")
+ .build())
.buildFuture();
} else {
return RpcResultBuilder.<InitRoadmNodesOutput>failed().buildFuture();
boolean createXpdrRdmLinks = Rdm2XpdrLink.createXpdrRdmLinks(input.getLinksInput(), this.dataBroker);
if (createXpdrRdmLinks) {
return RpcResultBuilder
- .success(new InitXpdrRdmLinksOutputBuilder().setResult("Xponder Roadm Link created successfully"))
+ .success(new InitXpdrRdmLinksOutputBuilder()
+ .setResult("Xponder Roadm Link created successfully")
+ .build())
.buildFuture();
} else {
LOG.error("init-xpdr-rdm-links rpc failed due to a bad input parameter");
boolean createRdmXpdrLinks = Rdm2XpdrLink.createRdmXpdrLinks(input.getLinksInput(), this.dataBroker);
if (createRdmXpdrLinks) {
return RpcResultBuilder
- .success(new InitRdmXpdrLinksOutputBuilder().setResult("Roadm Xponder links created successfully"))
+ .success(new InitRdmXpdrLinksOutputBuilder()
+ .setResult("Roadm Xponder links created successfully")
+ .build())
.buildFuture();
} else {
LOG.error("init-rdm-xpdr-links rpc failed due to a bad input parameter");
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.NodesKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev170929.Direction;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Protocols;
import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.Protocols1;
public boolean readLLDP(NodeId nodeId, String nodeVersion) {
switch (nodeVersion) {
case OPENROADM_DEVICE_VERSION_1_2_1:
- InstanceIdentifier<Protocols> protocols121IID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Protocols.class);
+ InstanceIdentifier<Protocols> protocols121IID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocol121Object = this.deviceTransactionManager.getDataFromDevice(
nodeId.getValue(), LogicalDatastoreType.OPERATIONAL, protocols121IID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
return rdm2rdmLinkCreatedv121(nodeId, nbr121List);
case OPENROADM_DEVICE_VERSION_2_2_1:
InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
- .container.org.openroadm.device.Protocols> protocols221IID =
- InstanceIdentifier.create(org.opendaylight.yang.gen.v1.http
- .org.openroadm.device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
- .org.openroadm.device.container.org.openroadm.device.Protocols.class);
+ .container.org.openroadm.device.Protocols> protocols221IID = InstanceIdentifier
+ .builderOfInherited(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData.class,
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .OrgOpenroadmDevice.class)
+ .child(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .org.openroadm.device.Protocols.class)
+ .build();
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
.container.org.openroadm.device.Protocols> protocol221Object = this.deviceTransactionManager
.getDataFromDevice(nodeId.getValue(), LogicalDatastoreType.OPERATIONAL, protocols221IID,
* @param notification ChangeNotification object
*/
@Override
- @SuppressWarnings("unchecked")
public void onChangeNotification(ChangeNotification notification) {
if (notification.getEdit() == null) {
LOG.warn("unable to handle {} notificatin received - list of edit is null", ChangeNotification.QNAME);
case "Ports":
LinkedList<PathArgument> path = new LinkedList<>();
edit.getTarget().getPathArguments().forEach(p -> path.add(p));
- InstanceIdentifier<Ports> portIID = (InstanceIdentifier<Ports>) InstanceIdentifier
- .create(path);
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier.unsafeOf(path);
String portName = InstanceIdentifier.keyOf(portIID).getPortName();
path.removeLast();
- InstanceIdentifier<CircuitPacks> cpIID = (InstanceIdentifier<CircuitPacks>) InstanceIdentifier
- .create(path);
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.unsafeOf(path);
String cpName = InstanceIdentifier.keyOf(cpIID).getCircuitPackName();
LOG.info("port {} of circruit-pack {} modified on device {}", portName, cpName, this.nodeId);
Mapping oldMapping = portMapping.getMapping(nodeId, cpName, portName);
* ChangeNotification object
*/
@Override
- @SuppressWarnings("unchecked")
public void onChangeNotification(ChangeNotification notification) {
if (notification.getEdit() == null) {
LOG.warn("unable to handle {} notificatin received - list of edit is null", ChangeNotification.QNAME);
case "Ports":
LinkedList<PathArgument> path = new LinkedList<>();
edit.getTarget().getPathArguments().forEach(p -> path.add(p));
- InstanceIdentifier<Ports> portIID = (InstanceIdentifier<Ports>) InstanceIdentifier
- .create(path);
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier.unsafeOf(path);
String portName = InstanceIdentifier.keyOf(portIID).getPortName();
path.removeLast();
- InstanceIdentifier<CircuitPacks> cpIID = (InstanceIdentifier<CircuitPacks>) InstanceIdentifier
- .create(path);
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.unsafeOf(path);
String cpName = InstanceIdentifier.keyOf(cpIID).getCircuitPackName();
LOG.info("port {} of circruit-pack {} modified on device {}", portName, cpName, this.nodeId);
Mapping oldMapping = portMapping.getMapping(nodeId, cpName, portName);
* ChangeNotification object
*/
@Override
- @SuppressWarnings("unchecked")
public void onChangeNotification(ChangeNotification notification) {
LOG.debug("device71 notification received = {}", notification);
if (notification.getEdit() == null) {
switch (edit.getTarget().getTargetType().getSimpleName()) {
case "Ports":
edit.getTarget().getPathArguments().forEach(p -> path.add(p));
- InstanceIdentifier<Ports> portIID = (InstanceIdentifier<Ports>) InstanceIdentifier
- .create(path);
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier.unsafeOf(path);
String portName = InstanceIdentifier.keyOf(portIID).getPortName();
path.removeLast();
- InstanceIdentifier<CircuitPacks> cpIID = (InstanceIdentifier<CircuitPacks>) InstanceIdentifier
- .create(path);
+ InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.unsafeOf(path);
String cpName = InstanceIdentifier.keyOf(cpIID).getCircuitPackName();
LOG.info("port {} of circruit-pack {} modified on device {}", portName, cpName, this.nodeId);
Mapping oldMapping = portMapping.getMapping(nodeId, cpName, portName);
case "OduSwitchingPools":
LOG.info("odu-switching-pools modified on device {}", nodeId);
edit.getTarget().getPathArguments().forEach(p -> path.add(p));
- ospIID = (InstanceIdentifier<OduSwitchingPools>) InstanceIdentifier.create(path);
+ ospIID = InstanceIdentifier.unsafeOf(path);
break;
case "PortList":
edit.getTarget().getPathArguments().forEach(p -> path.add(p));
- InstanceIdentifier<PortList> plIID = (InstanceIdentifier<PortList>) InstanceIdentifier.create(path);
+ InstanceIdentifier<PortList> plIID = InstanceIdentifier.unsafeOf(path);
path.removeLast();
- InstanceIdentifier<NonBlockingList> nblIID =
- (InstanceIdentifier<NonBlockingList>) InstanceIdentifier.create(path);
+ InstanceIdentifier<NonBlockingList> nblIID = InstanceIdentifier.unsafeOf(path);
Uint16 nblNb = InstanceIdentifier.keyOf(nblIID).getNblNumber();
List<InstanceIdentifier<PortList>> iidList = nbliidMap.containsKey(nblNb)
? nbliidMap.get(nblNb) : new ArrayList<>();
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class PortMappingListener implements DataTreeChangeListener<Mapping> {
- private static final Logger LOG = LoggerFactory.getLogger(PortMappingListener.class);
-
private final NetworkModelService networkModelService;
public PortMappingListener(NetworkModelService networkModelService) {
path.addAll((Collection<? extends PathArgument>) change.getRootPath().getRootIdentifier()
.getPathArguments());
path.removeLast();
- @SuppressWarnings("unchecked") InstanceIdentifier<Nodes> portmappintNodeID =
- (InstanceIdentifier<Nodes>) InstanceIdentifier.create(path);
+ InstanceIdentifier<Nodes> portmappintNodeID = InstanceIdentifier.unsafeOf(path);
+ // @SuppressWarnings("unchecked") InstanceIdentifier<Nodes> portmappintNodeID =
+// (InstanceIdentifier<Nodes>) InstanceIdentifier.create(path);
String nodeId = InstanceIdentifier.keyOf(portmappintNodeID).getNodeId();
networkModelService.updateOpenRoadmTopologies(nodeId, newMapping);
}
*/
package org.opendaylight.transportpce.networkmodel.service;
-import java.math.BigDecimal;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ztoa.direction.ZToA;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
if (atoZDirection != null && atoZDirection.getAToZMinFrequency() != null) {
LOG.info("Update frequencies for a to z direction {}, used {}", atoZDirection, used);
List<NodeIdPair> atozTpIds = getAToZTpList(atoZDirection);
- BigDecimal atozMinFrequency = atoZDirection.getAToZMinFrequency().getValue();
- BigDecimal atozMaxFrequency = atoZDirection.getAToZMaxFrequency().getValue();
+ Decimal64 atozMinFrequency = atoZDirection.getAToZMinFrequency().getValue();
+ Decimal64 atozMaxFrequency = atoZDirection.getAToZMaxFrequency().getValue();
Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
.forName(atoZDirection.getModulationFormat());
if (!optionalModulationFormat.isPresent()) {
if (ztoADirection != null && ztoADirection.getZToAMinFrequency() != null) {
LOG.info("Update frequencies for z to a direction {}, used {}", ztoADirection, used);
List<NodeIdPair> ztoaTpIds = getZToATpList(ztoADirection);
- BigDecimal ztoaMinFrequency = ztoADirection.getZToAMinFrequency().getValue();
- BigDecimal ztoaMaxFrequency = ztoADirection.getZToAMaxFrequency().getValue();
+ Decimal64 ztoaMinFrequency = ztoADirection.getZToAMinFrequency().getValue();
+ Decimal64 ztoaMaxFrequency = ztoADirection.getZToAMaxFrequency().getValue();
Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
.forName(ztoADirection.getModulationFormat());
if (!optionalModulationFormat.isPresent()) {
/**
* Set frequency map for nodes in nodeIds.
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param nodeIds List of node id
* @param used boolean true if min and max frequencies are used, false otherwise.
*/
- private void setFrequencies4Nodes(BigDecimal minFrequency, BigDecimal maxFrequency,
+ private void setFrequencies4Nodes(Decimal64 atozMinFrequency, Decimal64 atozMaxFrequency,
List<String> nodeIds, boolean used) {
- updateFreqMaps4Nodes(nodeIds, minFrequency, maxFrequency, used);
+ updateFreqMaps4Nodes(nodeIds, atozMinFrequency, atozMaxFrequency, used);
}
/**
* Update availFreqMapsMap for min and max frequencies for termination point in tpIds.
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param rate Uint32
* @param modulationFormat ModulationFormat
* @param tpIds List of NodeIdPair
* @param sed boolean true if min and max frequencies are used, false otherwise.
*/
- private void setFrequencies4Tps(BigDecimal minFrequency, BigDecimal maxFrequency, Uint32 rate,
+ private void setFrequencies4Tps(Decimal64 atozMinFrequency, Decimal64 atozMaxFrequency, Uint32 rate,
ModulationFormat modulationFormat, List<NodeIdPair> tpIds, boolean used) {
String strTpIdsList = String.join(", ", tpIds.stream().map(NodeIdPair::toString).collect(Collectors.toList()));
LOG.debug("Update frequencies for termination points {}, rate {}, modulation format {},"
+ "min frequency {}, max frequency {}, used {}", strTpIdsList, rate, modulationFormat,
- minFrequency, maxFrequency, used);
+ atozMinFrequency, atozMaxFrequency, used);
WriteTransaction updateFrequenciesTransaction = this.dataBroker.newWriteOnlyTransaction();
for (NodeIdPair idPair : tpIds) {
org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1
case DEGREETXTTP:
case DEGREETXRXTTP:
networkTerminationPointBuilder.setTxTtpAttributes(updateTxTtpAttributes(networkTerminationPoint,
- minFrequency,maxFrequency,used));
+ atozMinFrequency,atozMaxFrequency,used));
break;
case DEGREERXTTP:
networkTerminationPointBuilder.setRxTtpAttributes(updateRxTtpAttributes(networkTerminationPoint,
- minFrequency,maxFrequency,used));
+ atozMinFrequency,atozMaxFrequency,used));
break;
case DEGREETXCTP:
case DEGREERXCTP:
case DEGREETXRXCTP:
networkTerminationPointBuilder.setCtpAttributes(updateCtpAttributes(networkTerminationPoint,
- minFrequency,maxFrequency,used));
+ atozMinFrequency,atozMaxFrequency,used));
break;
case SRGTXCP:
case SRGRXCP:
case SRGTXRXCP:
networkTerminationPointBuilder.setCpAttributes(updateCpAttributes(networkTerminationPoint,
- minFrequency,maxFrequency,used));
+ atozMinFrequency,atozMaxFrequency,used));
break;
case SRGTXRXPP:
case SRGRXPP:
case SRGTXPP:
networkTerminationPointBuilder.setPpAttributes(updatePpAttributes(networkTerminationPoint,
- minFrequency,maxFrequency,used));
+ atozMinFrequency,atozMaxFrequency,used));
break;
case XPONDERNETWORK:
networkTerminationPointBuilder.setXpdrNetworkAttributes(
updateXpdrNetworkAttributes(networkTerminationPoint,
- minFrequency, maxFrequency, rate, modulationFormat, used)).build();
+ atozMinFrequency, atozMaxFrequency, rate, modulationFormat, used)).build();
break;
case XPONDERCLIENT:
break;
case XPONDERPORT:
networkTerminationPointBuilder.setXpdrPortAttributes(
updateXpdrPortAttributes(networkTerminationPoint,
- minFrequency, maxFrequency, rate, modulationFormat, used)).build();
+ atozMinFrequency, atozMaxFrequency, rate, modulationFormat, used)).build();
break;
default:
LOG.warn("Termination point type {} not managed", commonNetworkTerminationPoint.getTpType());
} catch (ExecutionException | TimeoutException e) {
LOG.error(
"Something went wrong for frequencies update (min frequency {}, max frequency {}, used {} for TPs {}",
- minFrequency, maxFrequency, used, strTpIdsList, e);
+ atozMinFrequency, atozMaxFrequency, used, strTpIdsList, e);
} catch (InterruptedException e) {
LOG.error("Frequencies update (min frequency {}, max frequency {}, used {} for TPs {} was interrupted",
- minFrequency, maxFrequency, used,
+ atozMinFrequency, atozMaxFrequency, used,
strTpIdsList, e);
Thread.currentThread().interrupt();
}
/**
* Update availFreqMapsMap for min and max frequencies for nodes in nodeIds.
* @param nodeIds List of node id
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
*/
- private void updateFreqMaps4Nodes(List<String> nodeIds, BigDecimal minFrequency, BigDecimal maxFrequency,
+ private void updateFreqMaps4Nodes(List<String> nodeIds, Decimal64 atozMinFrequency, Decimal64 atozMaxFrequency,
boolean used) {
String strNodesList = String.join(", ", nodeIds);
LOG.debug("Update frequencies for nodes {}, min frequency {}, max frequency {}, used {}",
- strNodesList, minFrequency, maxFrequency, used);
+ strNodesList, atozMinFrequency, atozMaxFrequency, used);
WriteTransaction updateFrequenciesTransaction = this.dataBroker.newWriteOnlyTransaction();
for (String nodeId : nodeIds) {
Node1 networkNode = getNetworkNodeFromDatastore(nodeId);
switch (commonNetworkNode.getNodeType()) {
case DEGREE:
networkNodeBuilder.setDegreeAttributes(
- updateDegreeAttributes(networkNode.getDegreeAttributes(), minFrequency,
- maxFrequency, used));
+ updateDegreeAttributes(networkNode.getDegreeAttributes(), atozMinFrequency,
+ atozMaxFrequency, used));
break;
case SRG:
- networkNodeBuilder.setSrgAttributes(
- updateSrgAttributes(networkNode.getSrgAttributes(), minFrequency, maxFrequency, used));
+ networkNodeBuilder.setSrgAttributes(updateSrgAttributes(
+ networkNode.getSrgAttributes(), atozMinFrequency, atozMaxFrequency, used));
break;
default:
LOG.warn("Node type not managed {}", commonNetworkNode.getNodeType());
try {
updateFrequenciesTransaction.commit().get(Timeouts.DATASTORE_WRITE, TimeUnit.MILLISECONDS);
} catch (ExecutionException | TimeoutException e) {
- LOG.error("Cannot update frequencies {} {} for nodes {}", minFrequency, maxFrequency,
+ LOG.error("Cannot update frequencies {} {} for nodes {}", atozMinFrequency, atozMaxFrequency,
strNodesList, e);
} catch (InterruptedException e) {
- LOG.error("Update of frequencies {} {} for nodes {} was interrupted", minFrequency, maxFrequency,
+ LOG.error("Update of frequencies {} {} for nodes {} was interrupted", atozMinFrequency, atozMaxFrequency,
strNodesList, e);
Thread.currentThread().interrupt();
}
/**
* Update Wavelength for xpdr port attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param rate Uint32
* @param modulationFormat ModulationFormat
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return XpdrPortAttributes with Wavelength updated
*/
private XpdrPortAttributes updateXpdrPortAttributes(TerminationPoint1 networkTerminationPoint,
- BigDecimal minFrequency, BigDecimal maxFrequency, Uint32 rate, ModulationFormat modulationFormat,
+ Decimal64 atozMinFrequency, Decimal64 atozMaxFrequency, Uint32 rate, ModulationFormat modulationFormat,
boolean used) {
LOG.debug("Update xpdr node attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
XpdrPortAttributesBuilder xpdrPortAttributesBuilder;
if (networkTerminationPoint != null) {
xpdrPortAttributesBuilder = new XpdrPortAttributesBuilder(networkTerminationPoint.getXpdrPortAttributes());
WavelengthBuilder waveLengthBuilder = new WavelengthBuilder();
if (used) {
waveLengthBuilder.setWidth(GridUtils.getWidthFromRateAndModulationFormat(rate, modulationFormat))
- .setFrequency(GridUtils.getCentralFrequency(minFrequency, maxFrequency));
+ .setFrequency(GridUtils
+ .getCentralFrequency(atozMinFrequency.decimalValue(), atozMaxFrequency.decimalValue()));
}
return xpdrPortAttributesBuilder.setWavelength(waveLengthBuilder.build()).build();
}
/**
* Update Wavelength for xpdr network attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param rate Uint32
* @param modulationFormat ModulationFormat
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return XpdrNetworkAttributes with Wavelength updated
*/
private XpdrNetworkAttributes updateXpdrNetworkAttributes(TerminationPoint1 networkTerminationPoint,
- BigDecimal minFrequency, BigDecimal maxFrequency, Uint32 rate, ModulationFormat modulationFormat,
+ Decimal64 atozMinFrequency, Decimal64 atozMaxFrequency, Uint32 rate, ModulationFormat modulationFormat,
boolean used) {
LOG.debug("Update xpdr node attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
XpdrNetworkAttributesBuilder xpdrNetworkAttributesBuilder;
if (networkTerminationPoint != null) {
xpdrNetworkAttributesBuilder = new XpdrNetworkAttributesBuilder(
WavelengthBuilder waveLengthBuilder = new WavelengthBuilder();
if (used) {
waveLengthBuilder.setWidth(GridUtils.getWidthFromRateAndModulationFormat(rate, modulationFormat))
- .setFrequency(GridUtils.getCentralFrequency(minFrequency, maxFrequency));
+ .setFrequency(GridUtils
+ .getCentralFrequency(atozMinFrequency.decimalValue(), atozMaxFrequency.decimalValue()));
xpdrNetworkAttributesBuilder.setWavelength(waveLengthBuilder.build());
} else {
xpdrNetworkAttributesBuilder.setWavelength(null);
/**
* Update freqMaps for pp attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return PpAttributes with frequency map updated
*/
- private PpAttributes updatePpAttributes(TerminationPoint1 networkTerminationPoint, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private PpAttributes updatePpAttributes(TerminationPoint1 networkTerminationPoint, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
LOG.debug("Update pp attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
PpAttributesBuilder ppAttributesBuilder;
if (networkTerminationPoint != null) {
ppAttributesBuilder = new PpAttributesBuilder(networkTerminationPoint.getPpAttributes());
ppAttributesBuilder = new PpAttributesBuilder();
}
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap = ppAttributesBuilder.getAvailFreqMaps();
- return ppAttributesBuilder.setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used))
- .build();
+ return ppAttributesBuilder
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update freqMaps for cp attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return CpAttributes with frequency map updated
*/
- private CpAttributes updateCpAttributes(TerminationPoint1 networkTerminationPoint, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private CpAttributes updateCpAttributes(TerminationPoint1 networkTerminationPoint, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
LOG.debug("Update cp attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
CpAttributesBuilder cpAttributesBuilder;
if (networkTerminationPoint != null) {
cpAttributesBuilder = new CpAttributesBuilder(networkTerminationPoint.getCpAttributes());
cpAttributesBuilder = new CpAttributesBuilder();
}
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap = cpAttributesBuilder.getAvailFreqMaps();
- return cpAttributesBuilder.setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used))
- .build();
+ return cpAttributesBuilder
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update freqMaps for ctp attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return CtpAttributes with frequency map updated
*/
- private CtpAttributes updateCtpAttributes(TerminationPoint1 networkTerminationPoint, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private CtpAttributes updateCtpAttributes(TerminationPoint1 networkTerminationPoint, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
LOG.debug("Update ctp attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
CtpAttributesBuilder ctpAttributesBuilder;
if (networkTerminationPoint != null) {
ctpAttributesBuilder = new CtpAttributesBuilder(networkTerminationPoint.getCtpAttributes());
ctpAttributesBuilder = new CtpAttributesBuilder();
}
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap = ctpAttributesBuilder.getAvailFreqMaps();
- return ctpAttributesBuilder.setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used))
- .build();
+ return ctpAttributesBuilder
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update freqMaps for rxtp attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return RxTtpAttributes with frequency map updated
*/
- private RxTtpAttributes updateRxTtpAttributes(TerminationPoint1 networkTerminationPoint, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private RxTtpAttributes updateRxTtpAttributes(TerminationPoint1 networkTerminationPoint, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
LOG.debug("Update rx attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
RxTtpAttributesBuilder rxTtpAttributesBuilder;
if (networkTerminationPoint != null) {
rxTtpAttributesBuilder = new RxTtpAttributesBuilder(networkTerminationPoint.getRxTtpAttributes());
}
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap = rxTtpAttributesBuilder.getAvailFreqMaps();
return rxTtpAttributesBuilder
- .setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used)).build();
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update freqMaps for txtp attributes.
* @param networkTerminationPoint TerminationPoint1
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return TxTtpAttributes with frequency map updated
*/
- private TxTtpAttributes updateTxTtpAttributes(TerminationPoint1 networkTerminationPoint, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private TxTtpAttributes updateTxTtpAttributes(TerminationPoint1 networkTerminationPoint, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
LOG.debug("Update tx attributes for termination point {}, min frequency {}, max frequency {}, used {}",
- networkTerminationPoint, minFrequency, maxFrequency, used);
+ networkTerminationPoint, atozMinFrequency, atozMaxFrequency, used);
TxTtpAttributesBuilder txTtpAttributesBuilder;
if (networkTerminationPoint != null) {
txTtpAttributesBuilder = new TxTtpAttributesBuilder(networkTerminationPoint.getTxTtpAttributes());
}
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap = txTtpAttributesBuilder.getAvailFreqMaps();
return txTtpAttributesBuilder
- .setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used)).build();
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update freqMaps for srg attributes of srgAttributes.
* @param srgAttributes SrgAttributes
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return SrgAttributes with frequency map updated
*/
- private SrgAttributes updateSrgAttributes(SrgAttributes srgAttributes, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private SrgAttributes updateSrgAttributes(SrgAttributes srgAttributes, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap;
SrgAttributesBuilder srgAttributesBuilder;
if (srgAttributes == null) {
srgAttributesBuilder = new SrgAttributesBuilder(srgAttributes);
}
availFreqMapsMap = srgAttributesBuilder.getAvailFreqMaps();
- return srgAttributesBuilder.setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used))
- .build();
+ return srgAttributesBuilder
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update freqMaps for degree attributes of degreeAttributes.
* @param degreeAttributes DegreeAttributes
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param used boolean true if min and max frequencies are used, false otherwise.
* @return DegreeAttributes with frequency map updated
*/
- private DegreeAttributes updateDegreeAttributes(DegreeAttributes degreeAttributes, BigDecimal minFrequency,
- BigDecimal maxFrequency, boolean used) {
+ private DegreeAttributes updateDegreeAttributes(DegreeAttributes degreeAttributes, Decimal64 atozMinFrequency,
+ Decimal64 atozMaxFrequency, boolean used) {
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap;
DegreeAttributesBuilder degreeAttributesBuilder;
if (degreeAttributes == null) {
}
availFreqMapsMap = degreeAttributesBuilder.getAvailFreqMaps();
return degreeAttributesBuilder
- .setAvailFreqMaps(updateFreqMaps(minFrequency, maxFrequency, availFreqMapsMap, used)).build();
+ .setAvailFreqMaps(updateFreqMaps(atozMinFrequency, atozMaxFrequency, availFreqMapsMap, used))
+ .build();
}
/**
* Update availFreqMapsMap for min and max frequencies for cband AvailFreqMaps.
- * @param minFrequency BigDecimal
- * @param maxFrequency BigDecimal
+ * @param atozMinFrequency BigDecimal
+ * @param atozMaxFrequency BigDecimal
* @param availFreqMapsMap Map
* @param used boolean
* @return updated Update availFreqMapsMap for min and max frequencies for cband AvailFreqMaps.
*/
- private Map<AvailFreqMapsKey, AvailFreqMaps> updateFreqMaps(BigDecimal minFrequency, BigDecimal maxFrequency,
+ private Map<AvailFreqMapsKey, AvailFreqMaps> updateFreqMaps(Decimal64 atozMinFrequency, Decimal64 atozMaxFrequency,
Map<AvailFreqMapsKey, AvailFreqMaps> availFreqMapsMap, boolean used) {
- int beginIndex = GridUtils.getIndexFromFrequency(minFrequency);
- int endIndex = GridUtils.getIndexFromFrequency(maxFrequency);
+ int beginIndex = GridUtils.getIndexFromFrequency(atozMinFrequency);
+ int endIndex = GridUtils.getIndexFromFrequency(atozMaxFrequency);
if (availFreqMapsMap == null) {
availFreqMapsMap = GridUtils.initFreqMaps4FixedGrid2Available();
}
BitSet bitSetFreq = BitSet.valueOf(availFreqMaps.getFreqMap());
LOG.debug(
"Update frequency map from index {}, to index {}, min frequency {}, max frequency {}, available {} {}",
- beginIndex, endIndex, minFrequency, maxFrequency, !used, bitSetFreq);
+ beginIndex, endIndex, atozMinFrequency, atozMaxFrequency, !used, bitSetFreq);
//if used = true then bit must be set to false to indicate the slot is no more available
bitSetFreq.set(beginIndex, endIndex, !used);
LOG.debug(
"Updated frequency map from index {}, to index {}, min frequency {}, max frequency {}, available {} {}",
- beginIndex, endIndex, minFrequency, maxFrequency, !used, bitSetFreq);
+ beginIndex, endIndex, atozMinFrequency, atozMaxFrequency, !used, bitSetFreq);
Map<AvailFreqMapsKey, AvailFreqMaps> updatedFreqMaps = new HashMap<>();
byte[] frequenciesByteArray = bitSetFreq.toByteArray();
AvailFreqMaps updatedAvailFreqMaps = new AvailFreqMapsBuilder(availFreqMaps)
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.transportpce.common.NetworkUtils;
XpdrTpPortConnectionAttributesBuilder xtpcaBldr =
new XpdrTpPortConnectionAttributesBuilder(otnTp1Bldr.getXpdrTpPortConnectionAttributes());
if (addingTsTpnPoolTermination) {
- List<Uint16> tsPool = new ArrayList<>();
+ Set<Uint16> tsPool = new HashSet<>();
for (int i = 1; i <= NB_TRIB_SLOTS; i++) {
tsPool.add(Uint16.valueOf(i));
}
xtpcaBldr.setTsPool(tsPool);
- List<Uint16> tpnPool = new ArrayList<>();
+ Set<Uint16> tpnPool = new HashSet<>();
int nbTribPort = NB_TRIB_PORTS;
if (OtnLinkType.ODUC4.equals(linkType)) {
nbTribPort = 4;
XpdrTpPortConnectionAttributesBuilder xtpcaBldr =
new XpdrTpPortConnectionAttributesBuilder(
tpBldr.augmentation(TerminationPoint1.class).getXpdrTpPortConnectionAttributes());
- List<Uint16> tsPool = new ArrayList<>(xtpcaBldr.getTsPool());
+ Set<Uint16> tsPool = new HashSet<>(xtpcaBldr.getTsPool());
if (isDeletion) {
for (int i = minTribSlotNb; i <= maxTribSlotNb; i++) {
tsPool.add(Uint16.valueOf(i));
}
}
xtpcaBldr.setTsPool(tsPool);
- List<Uint16> tpnPool;
+ Set<Uint16> tpnPool;
List<OdtuTpnPool> odtuTpnPoolValues = new ArrayList<>(xtpcaBldr.getOdtuTpnPool().values());
if (odtuTpnPoolValues.get(0).getTpnPool() == null) {
- tpnPool = new ArrayList<>();
+ tpnPool = new HashSet<>();
} else {
- tpnPool = new ArrayList<>(odtuTpnPoolValues.get(0).getTpnPool());
+ tpnPool = new HashSet<>(odtuTpnPoolValues.get(0).getTpnPool());
if (isDeletion) {
tpnPool.add(Uint16.valueOf(tribPortNb));
} else {
// TODO: will need to be completed
Map<NonBlockingListKey, NonBlockingList> nbMap = new HashMap<>();
for (int i = 1; i <= node.getNbTpClient(); i++) {
- List<TpId> tpList = new ArrayList<>();
+ Set<TpId> tpList = new HashSet<>();
tpList.add(new TpId("XPDR" + node.getXpdrNb() + CLIENT + i));
tpList.add(new TpId("XPDR" + node.getXpdrNb() + "-NETWORK1"));
NonBlockingList nbl = new NonBlockingListBuilder()
private static Node createSwitch(OtnTopoNode node) {
- List<TpId> tpl = new ArrayList<>();
+ Set<TpId> tpl = new HashSet<>();
for (int i = 1; i <= node.getNbTpClient(); i++) {
tpl.add(new TpId("XPDR" + node.getXpdrNb() + CLIENT + i));
}
}
}
- private static Class<? extends OduRateIdentity> fixRate(List<Class<? extends SupportedIfCapability>> list) {
+ private static Class<? extends OduRateIdentity> fixRate(Set<Class<? extends SupportedIfCapability>> list) {
for (Class<? extends SupportedIfCapability> class1 : list) {
if (RATE_MAP.containsKey(class1.getSimpleName())) {
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.ChangeNotification;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.change.notification.EditBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
}
private ImmutableList<Edit> createEditList() {
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
- .child(Ports.class, new PortsKey("port1"));
+ .child(Ports.class, new PortsKey("port1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(portId)
}
private ImmutableList<Edit> createBadEditList() {
- InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"));
+ InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(cpId)
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.ChangeNotification;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.change.notification.EditBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.pack.Ports;
}
private ImmutableList<Edit> createEditList() {
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
- .child(Ports.class, new PortsKey("port1"));
+ .child(Ports.class, new PortsKey("port1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(portId)
}
private ImmutableList<Edit> createBadEditList() {
- InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"));
+ InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(cpId)
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.ChangeNotification;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.change.notification.Edit;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.change.notification.EditBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
}
private ImmutableList<Edit> createEditList() {
- InstanceIdentifier<Ports> portId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ InstanceIdentifier<Ports> portId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
- .child(Ports.class, new PortsKey("port1"));
+ .child(Ports.class, new PortsKey("port1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(portId)
}
private ImmutableList<Edit> createBadEditList() {
- InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"));
+ InstanceIdentifier<CircuitPacks> cpId = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey("circuit-pack1"))
+ .build();
Edit edit = new EditBuilder()
.setOperation(EditOperationType.Merge)
.setTarget(cpId)
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.mdsal.binding.api.ReadTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.transportpce.test.converter.DataObjectConverter;
import org.opendaylight.transportpce.test.converter.JSONDataObjectConverter;
import org.opendaylight.transportpce.test.utils.TopologyDataUtils;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.service.path.rpc.result.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev211210.Node1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev211210.TerminationPoint1;
import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.available.freq.map.AvailFreqMapsKey;
-import org.opendaylight.yang.gen.v1.pathdescription.stub.rev201211.PathDescription;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Ignore
public class FrequenciesServiceTest extends AbstractTest {
private static final Logger LOG = LoggerFactory.getLogger(FrequenciesServiceTest.class);
private static final String OPENROADM_TOPOLOGY_FILE = "src/test/resources/openroadm-topology.xml";
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.opendaylight.transportpce.common.NetworkUtils;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingBuilder;
XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder()
.setRate(ODU4.class);
if (withTpnTsPool) {
- List<Uint16> tsPool = new ArrayList<>();
+ Set<Uint16> tsPool = new HashSet<>();
for (int i = 0; i < 80; i++) {
tsPool.add(Uint16.valueOf(i + 1));
}
xtpcaBldr.setTsPool(tsPool);
- List<Uint16> tpnPool = new ArrayList<>();
+ Set<Uint16> tpnPool = new HashSet<>();
for (int i = 1; i <= 80; i++) {
tpnPool.add(Uint16.valueOf(i));
}
int networkPortNb, int clientPortNb,
XpdrNodeTypes xpdrNodeType) {
for (int i = 1; i <= networkPortNb; i++) {
- List<Class<? extends SupportedIfCapability>> supportedIntf = new ArrayList<>();
+ Set<Class<? extends SupportedIfCapability>> supportedIntf = new HashSet<>();
supportedIntf.add(IfOCH.class);
MappingBuilder mappingBldr = new MappingBuilder()
.setLogicalConnectionPoint("XPDR1-NETWORK" + i)
mappingMap.put(mapping.key(),mapping);
}
for (int i = 1; i <= clientPortNb; i++) {
- List<Class<? extends SupportedIfCapability>> supportedIntf = new ArrayList<>();
+ Set<Class<? extends SupportedIfCapability>> supportedIntf = new HashSet<>();
supportedIntf.add(If100GE.class);
Mapping mapping = new MappingBuilder()
.setLogicalConnectionPoint("XPDR1-CLIENT" + i)
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.Interface;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.Interface1;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
spanLossTx);
return false;
}
- BigDecimal powerValue = getRdmPowerValue(spanLossTx, input);
+ Decimal64 powerValue = Decimal64.valueOf(getRdmPowerValue(spanLossTx, input));
try {
if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(), powerValue,
connectionNumber)) {
}
return interfaceOpt.get()
.augmentation(Interface1.class)
- .getOts().getSpanLossTransmit().getValue();
+ .getOts().getSpanLossTransmit().getValue().decimalValue();
case 2:
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
.interfaces.grp.Interface> interfaceOpt1 =
return interfaceOpt1.get()
.augmentation(org.opendaylight.yang.gen.v1.http.org
.openroadm.optical.transport.interfaces.rev181019.Interface1.class)
- .getOts().getSpanLossTransmit().getValue();
+ .getOts().getSpanLossTransmit().getValue().decimalValue();
// TODO no case 3 ?
default:
return null;
input.getNodes().get(i).getSrcTp(), destTpId, spectralSlotName);
try {
if (destTpId.toUpperCase(Locale.getDefault()).contains("DEG")) {
- if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(), new BigDecimal(-60),
- connectionNumber)) {
+ if (!crossConnect.setPowerLevel(nodeId, OpticalControlMode.Power.getName(),
+ Decimal64.valueOf("-60"), connectionNumber)) {
LOG.warn("Power down failed for Roadm-connection: {}", connectionNumber);
return false;
}
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.PowerDBm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.circuit.packs.CircuitPacks;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1Builder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.och.container.OchBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public static Map<String, Double> getXponderPowerRange(String circuitPackName, String portName, String deviceId,
DeviceTransactionManager deviceTransactionManager) {
- InstanceIdentifier<Ports> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
- .child(Ports.class, new PortsKey(portName));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .child(Ports.class, new PortsKey(portName))
+ .build();
Map<String, Double> powerRangeMap = new HashMap<>();
LOG.debug("Fetching logical Connection Point value for port {} at circuit pack {}", portName, circuitPackName);
Optional<Ports> portObject =
Map<String, Double> powerRangeMap = new HashMap<>();
LOG.debug("Coming inside SRG power range");
LOG.debug("Mapping object exists.");
- InstanceIdentifier<Ports> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
- .child(Ports.class, new PortsKey(portName));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .child(Ports.class, new PortsKey(portName))
+ .build();
LOG.debug("Fetching logical Connection Point value for port {} at circuit pack {}{}", portName,
circuitPackName, portIID);
Optional<Ports> portObject =
OchBuilder ochBuilder = new OchBuilder(ochInterfaceBuilder.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014
.Interface1.class).getOch());
- ochBuilder.setTransmitPower(new PowerDBm(txPower));
+ ochBuilder.setTransmitPower(new PowerDBm(Decimal64.valueOf(txPower)));
ochInterfaceBuilder.addAugmentation(new Interface1Builder().setOch(ochBuilder.build()).build());
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(nodeId);
DeviceTransaction deviceTx;
+ "setup!", nodeId, e);
return false;
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, interfacesIID, ochInterfaceBuilder.build());
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder(rdmConnOpt.get());
rdmConnBldr.setOpticalControlMode(mode);
if (powerValue != null) {
- rdmConnBldr.setTargetOutputPower(new PowerDBm(powerValue));
+ rdmConnBldr.setTargetOutputPower(new PowerDBm(Decimal64.valueOf(powerValue)));
}
RoadmConnections newRdmConn = rdmConnBldr.build();
Future<Optional<DeviceTransaction>> deviceTxFuture =
return false;
}
// post the cross connect on the device
- InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber));
+ InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, roadmConnIID, newRdmConn);
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.PowerDBm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
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.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.packs.CircuitPacks;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019.Interface1Builder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019.och.container.OchBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public static Map<String, Double> getXponderPowerRange(String circuitPackName, String portName, String deviceId,
DeviceTransactionManager deviceTransactionManager) {
- InstanceIdentifier<Ports> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
- .child(Ports.class, new PortsKey(portName));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .child(Ports.class, new PortsKey(portName))
+ .build();
Map<String, Double> powerRangeMap = new HashMap<>();
LOG.debug("Fetching logical Connection Point value for port {} at circuit pack {}", portName, circuitPackName);
Optional<Ports> portObject =
Map<String, Double> powerRangeMap = new HashMap<>();
LOG.debug("Coming inside SRG power range");
LOG.debug("Mapping object exists.");
- InstanceIdentifier<Ports> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
- .child(Ports.class, new PortsKey(portName));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .child(Ports.class, new PortsKey(portName))
+ .build();
LOG.debug("Fetching logical Connection Point value for port {} at circuit pack {}{}", portName,
circuitPackName, portIID);
Optional<Ports> portObject =
new InterfaceBuilder(interfaceObj);
OchBuilder ochBuilder = new OchBuilder(ochInterfaceBuilder.augmentation(
Interface1.class).getOch());
- ochBuilder.setTransmitPower(new PowerDBm(txPower));
+ ochBuilder.setTransmitPower(new PowerDBm(Decimal64.valueOf(txPower)));
ochInterfaceBuilder.addAugmentation(new Interface1Builder().setOch(ochBuilder.build()).build());
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(nodeId);
DeviceTransaction deviceTx;
+ "setup!", nodeId, e);
return false;
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, interfacesIID, ochInterfaceBuilder.build());
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder(rdmConnOpt.get());
rdmConnBldr.setOpticalControlMode(mode);
if (powerValue != null) {
- rdmConnBldr.setTargetOutputPower(new PowerDBm(powerValue));
+ rdmConnBldr.setTargetOutputPower(new PowerDBm(Decimal64.valueOf(powerValue)));
}
RoadmConnections newRdmConn = rdmConnBldr.build();
Future<Optional<DeviceTransaction>> deviceTxFuture =
return false;
}
// post the cross connect on the device
- InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber));
+ InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, roadmConnIID, newRdmConn);
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
import org.opendaylight.transportpce.common.device.DeviceTransactionManager;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev191129.OpticalControlMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev191129.PowerDBm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.packs.CircuitPacks;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.Interface1Builder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.tributary.signal.interfaces.rev200529.otsi.container.OtsiBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
*/
public static Map<String, Double> getXponderPowerRange(String circuitPackName, String portName, String deviceId,
DeviceTransactionManager deviceTransactionManager) {
- InstanceIdentifier<Ports> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
- .child(Ports.class, new PortsKey(portName));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .child(Ports.class, new PortsKey(portName))
+ .build();
LOG.debug("Fetching logical Connection Point value for port {} at circuit pack {}", portName, circuitPackName);
Optional<Ports> portObject =
deviceTransactionManager.getDataFromDevice(deviceId, LogicalDatastoreType.OPERATIONAL, portIID,
String circuitPackName, String portName) {
LOG.debug("Coming inside SRG power range");
LOG.debug("Mapping object exists.");
- InstanceIdentifier<Ports> portIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
- .child(Ports.class, new PortsKey(portName));
+ InstanceIdentifier<Ports> portIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName))
+ .child(Ports.class, new PortsKey(portName))
+ .build();
LOG.debug("Fetching logical Connection Point value for port {} at circuit pack {}{}", portName,
circuitPackName, portIID);
Optional<Ports> portObject =
nodeId, interfaceName);
InterfaceBuilder otsiInterfaceBuilder = new InterfaceBuilder(interfaceObj);
OtsiBuilder otsiBuilder = new OtsiBuilder(otsiInterfaceBuilder.augmentation(Interface1.class).getOtsi());
- otsiBuilder.setTransmitPower(new PowerDBm(txPower));
+ otsiBuilder.setTransmitPower(new PowerDBm(Decimal64.valueOf(txPower)));
otsiInterfaceBuilder.addAugmentation(new Interface1Builder().setOtsi(otsiBuilder.build()).build());
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(nodeId);
DeviceTransaction deviceTx;
LOG.error("Unable to get transaction for device {} during transponder power setup!", nodeId, e);
return false;
}
- InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(interfaceName));
+ InstanceIdentifier<Interface> interfacesIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(interfaceName))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, interfacesIID, otsiInterfaceBuilder.build());
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
RoadmConnectionsBuilder rdmConnBldr = new RoadmConnectionsBuilder(rdmConnOpt.get());
rdmConnBldr.setOpticalControlMode(mode);
if (powerValue != null) {
- rdmConnBldr.setTargetOutputPower(new PowerDBm(powerValue));
+ rdmConnBldr.setTargetOutputPower(new PowerDBm(Decimal64.valueOf(powerValue)));
}
RoadmConnections newRdmConn = rdmConnBldr.build();
Future<Optional<DeviceTransaction>> deviceTxFuture = deviceTransactionManager.getDeviceTransaction(deviceId);
return false;
}
// post the cross connect on the device
- InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber));
+ InstanceIdentifier<RoadmConnections> roadmConnIID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(connectionNumber))
+ .build();
deviceTx.merge(LogicalDatastoreType.CONFIGURATION, roadmConnIID, newRdmConn);
FluentFuture<? extends @NonNull CommitInfo> commit =
deviceTx.commit(Timeouts.DEVICE_WRITE_TIMEOUT, Timeouts.DEVICE_WRITE_TIMEOUT_UNIT);
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.LinkKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
spanLossRx = ots.getSpanLossReceive();
spanLossTx = ots.getSpanLossTransmit();
} else {
- spanLossRx = new RatioDB(spanLoss);
- spanLossTx = new RatioDB(spanLoss);
+ spanLossRx = new RatioDB(Decimal64.valueOf(spanLoss));
+ spanLossTx = new RatioDB(Decimal64.valueOf(spanLoss));
}
Interface1Builder intf1Builder = new Interface1Builder();
if (direction.equals("TX")) {
- otsBuilder.setSpanLossTransmit(new RatioDB(spanLoss));
+ otsBuilder.setSpanLossTransmit(new RatioDB(Decimal64.valueOf(spanLoss)));
otsBuilder.setSpanLossReceive(spanLossRx);
} else {
- otsBuilder.setSpanLossTransmit(spanLossTx).setSpanLossReceive(new RatioDB(spanLoss));
+ otsBuilder
+ .setSpanLossTransmit(spanLossTx)
+ .setSpanLossReceive(new RatioDB(Decimal64.valueOf(spanLoss)));
}
interfaceBuilder.addAugmentation(intf1Builder.setOts(otsBuilder.build()).build());
openRoadmInterfaces.postInterface(realNodeId,interfaceBuilder);
spanLossTx = ots.getSpanLossTransmit();
} else {
spanLossRx = new org.opendaylight.yang.gen.v1.http.org
- .openroadm.common.types.rev181019.RatioDB(spanLoss);
+ .openroadm.common.types.rev181019.RatioDB(Decimal64.valueOf(spanLoss));
spanLossTx = new org.opendaylight.yang.gen.v1.http.org
- .openroadm.common.types.rev181019.RatioDB(spanLoss);
+ .openroadm.common.types.rev181019.RatioDB(Decimal64.valueOf(spanLoss));
}
org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces
.rev181019.Interface1Builder intf1Builder =
.transport.interfaces.rev181019.Interface1Builder();
if (direction.equals("TX")) {
otsBuilder.setSpanLossTransmit(new org.opendaylight.yang.gen.v1.http.org
- .openroadm.common.types.rev181019.RatioDB(spanLoss));
+ .openroadm.common.types.rev181019.RatioDB(Decimal64.valueOf(spanLoss)));
otsBuilder.setSpanLossReceive(spanLossRx);
} else {
- otsBuilder.setSpanLossTransmit(spanLossTx).setSpanLossReceive(
- new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.RatioDB(spanLoss)
- );
+ otsBuilder
+ .setSpanLossTransmit(spanLossTx)
+ .setSpanLossReceive(
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.RatioDB(
+ Decimal64.valueOf(spanLoss)));
}
interfaceBuilder.addAugmentation(intf1Builder.setOts(otsBuilder.build()).build());
openRoadmInterfaces.postInterface(realNodeId,interfaceBuilder);
measurement.setPmparameterName(measure.getMeasurement().getPmParameterName().getType().toString());
if (measure.getMeasurement().getPmParameterValue().getDecimal64() != null) {
measurement.setPmparameterValue(measure.getMeasurement().getPmParameterValue().getDecimal64()
- .toPlainString());
+ .toString());
} else if (measure.getMeasurement().getPmParameterValue().getUint64() != null) {
measurement.setPmparameterValue(measure.getMeasurement().getPmParameterValue().getUint64().toString());
}
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutputBuilder;
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.olm.rev210618.get.pm.output.MeasurementsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
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.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.circuit.packs.CircuitPacks;
}
switch (wantedResourceType) {
case Device:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
case Degree:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Degree.class, new DegreeKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())))
+ .build();
case SharedRiskGroup:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class,
- new SharedRiskGroupKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(
+ SharedRiskGroup.class,
+ new SharedRiskGroupKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())))
+ .build();
case Connection:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(wantedResourceIdentifier
- .getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case CircuitPack:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case Port:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getCircuitPackName()))
- .child(Ports.class, new PortsKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getCircuitPackName()))
+ .child(Ports.class, new PortsKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case Interface:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case InternalLink:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(InternalLink.class, new InternalLinkKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(InternalLink.class, new InternalLinkKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case PhysicalLink:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(PhysicalLink.class, new PhysicalLinkKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(PhysicalLink.class, new PhysicalLinkKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case Shelf:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Shelves.class, new ShelvesKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Shelves.class, new ShelvesKey(wantedResourceIdentifier.getResourceName()))
+ .build();
default:
LOG.error("Unknown resource type {}", wantedResourceType);
return null;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutputBuilder;
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.olm.rev210618.get.pm.output.MeasurementsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.Ports;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.pack.PortsKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev200529.circuit.packs.CircuitPacks;
ResourceIdentifier wantedResourceIdentifier) {
switch (wantedResourceType) {
case Device:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class);
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .build();
case Degree:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Degree.class, new DegreeKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Degree.class, new DegreeKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())))
+ .build();
case SharedRiskGroup:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(SharedRiskGroup.class,
- new SharedRiskGroupKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(
+ SharedRiskGroup.class,
+ new SharedRiskGroupKey(Uint16.valueOf(wantedResourceIdentifier.getResourceName())))
+ .build();
case Connection:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case CircuitPack:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case Port:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
.child(CircuitPacks.class, new CircuitPacksKey(wantedResourceIdentifier.getCircuitPackName()))
- .child(Ports.class, new PortsKey(wantedResourceIdentifier.getResourceName()));
+ .child(Ports.class, new PortsKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case Interface:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case InternalLink:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(InternalLink.class, new InternalLinkKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(InternalLink.class, new InternalLinkKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case PhysicalLink:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(PhysicalLink.class, new PhysicalLinkKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(PhysicalLink.class, new PhysicalLinkKey(wantedResourceIdentifier.getResourceName()))
+ .build();
case Shelf:
- return InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Shelves.class, new ShelvesKey(wantedResourceIdentifier.getResourceName()));
+ return InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Shelves.class, new ShelvesKey(wantedResourceIdentifier.getResourceName()))
+ .build();
default:
LOG.error("Unknown resource type {}", wantedResourceType);
return null;
package org.opendaylight.transportpce.olm.power;
-import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mockito;
import org.opendaylight.mdsal.binding.api.MountPoint;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.Interface1Builder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.ots.container.Ots;
import org.opendaylight.yang.gen.v1.http.org.openroadm.optical.transport.interfaces.rev161014.ots.container.OtsBuilder;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
+import org.opendaylight.yangtools.yang.common.Decimal64;
@Ignore
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({OlmUtils.class,PowerMgmtVersion121.class})
-@PowerMockIgnore("org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.*")
public class PowerMgmtPowerMockTest extends AbstractTest {
private MountPoint mountPoint;
@Test
public void testSetPowerMockingUtil() {
- PowerMockito.mockStatic(OlmUtils.class);
- PowerMockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
+ Mockito.mockStatic(OlmUtils.class);
+ Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getXpdrNodesFromNodesBuilderDeg()));
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput2();
boolean output = this.powerMgmt.setPower(input);
@Test
public void testSetPowerMockingUtilNetwokType() throws OpenRoadmInterfaceException {
- PowerMockito.mockStatic(OlmUtils.class);
- PowerMockito.mockStatic(PowerMgmtVersion121.class);
- PowerMockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
+ Mockito.mockStatic(OlmUtils.class);
+ Mockito.mockStatic(PowerMgmtVersion121.class);
+ Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getXpdrNodesFromNodesBuilderNetwork()));
Map<String, Double> txPowerRangeMap = new HashMap<>();
- PowerMockito.when(PowerMgmtVersion121.getXponderPowerRange(
+ Mockito.when(PowerMgmtVersion121.getXponderPowerRange(
Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
ArgumentMatchers.eq(deviceTransactionManager)))
.thenReturn(txPowerRangeMap);
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput2();
- OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = PowerMockito.mock(OpenRoadmInterfacesImpl121.class);
+ OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = Mockito.mock(OpenRoadmInterfacesImpl121.class);
Mockito.when(openRoadmInterfacesImpl121Spy.getInterface(Mockito.anyString(), Mockito.anyString()))
.thenReturn(Optional.empty());
PowerMgmtImpl powerMgmtImpl = getNewPowerMgmt(openRoadmInterfacesImpl121Spy,this.crossConnect);
@Test
public void testSetPowerMockingUtilNetwokTypeMoreThanOneNode() throws OpenRoadmInterfaceException {
- PowerMockito.mockStatic(OlmUtils.class);
- PowerMockito.mockStatic(PowerMgmtVersion121.class);
- PowerMockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
+ Mockito.mockStatic(OlmUtils.class);
+ Mockito.mockStatic(PowerMgmtVersion121.class);
+ Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getXpdrNodesFromNodesBuilderNetwork()));
Map<String, Double> txPowerRangeMap = new HashMap<>();
- PowerMockito.when(PowerMgmtVersion121
+ Mockito.when(PowerMgmtVersion121
.getXponderPowerRange(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(),
ArgumentMatchers.eq(deviceTransactionManager)))
.thenReturn(txPowerRangeMap);
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput2();
- OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = PowerMockito.mock(OpenRoadmInterfacesImpl121.class);
+ OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = Mockito.mock(OpenRoadmInterfacesImpl121.class);
Mockito.when(openRoadmInterfacesImpl121Spy.getInterface(Mockito.anyString(), Mockito.anyString()))
.thenReturn(Optional.empty());
PowerMgmtImpl powerMgmtImpl = getNewPowerMgmt(openRoadmInterfacesImpl121Spy,this.crossConnect);
@Test
public void testSetPowerXpdrNodes() {
- PowerMockito.mockStatic(OlmUtils.class);
- PowerMockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
+ Mockito.mockStatic(OlmUtils.class);
+ Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getXpdrNodesFromNodesBuilderDeg()));
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3();
boolean output = this.powerMgmt.setPower(input);
@Test
public void testSetPowerRdmNodesReturnInterfaceEmpty() throws OpenRoadmInterfaceException {
- PowerMockito.mockStatic(OlmUtils.class);
+ Mockito.mockStatic(OlmUtils.class);
Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getRdmNodesFromNodesBuilder()));
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3();
- OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = PowerMockito.mock(OpenRoadmInterfacesImpl121.class);
+ OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = Mockito.mock(OpenRoadmInterfacesImpl121.class);
Mockito.when(openRoadmInterfacesImpl121Spy.getInterface(Mockito.anyString(), Mockito.anyString()))
.thenReturn(Optional.empty());
PowerMgmtImpl powerMgmtImpl = getNewPowerMgmt(openRoadmInterfacesImpl121Spy,this.crossConnect);
@Test
public void testSetPowerRdmNodesThrowsException() throws OpenRoadmInterfaceException {
- PowerMockito.mockStatic(OlmUtils.class);
+ Mockito.mockStatic(OlmUtils.class);
Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getRdmNodesFromNodesBuilder()));
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3();
- OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = PowerMockito.mock(OpenRoadmInterfacesImpl121.class);
+ OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = Mockito.mock(OpenRoadmInterfacesImpl121.class);
Mockito.when(openRoadmInterfacesImpl121Spy.getInterface(Mockito.anyString(), Mockito.anyString()))
.thenThrow(new OpenRoadmInterfaceException("error thrown by unit tests "));
PowerMgmtImpl powerMgmtImpl = getNewPowerMgmt(openRoadmInterfacesImpl121Spy,this.crossConnect);
@Test
public void testSetPowerRdmNodesReturnInterface() throws OpenRoadmInterfaceException {
- PowerMockito.mockStatic(OlmUtils.class);
+ Mockito.mockStatic(OlmUtils.class);
Mockito.when(OlmUtils.getNode(Mockito.anyString(), ArgumentMatchers.eq(getDataBroker())))
.thenReturn(Optional.of(getRdmNodesFromNodesBuilder()));
ServicePowerSetupInput input = OlmPowerServiceRpcImplUtil.getServicePowerSetupInput3();
- OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = PowerMockito.mock(OpenRoadmInterfacesImpl121.class);
+ OpenRoadmInterfacesImpl121 openRoadmInterfacesImpl121Spy = Mockito.mock(OpenRoadmInterfacesImpl121.class);
- Ots ots = new OtsBuilder().setSpanLossTransmit(new RatioDB(new BigDecimal(23))).build();
+ Ots ots = new OtsBuilder().setSpanLossTransmit(new RatioDB(Decimal64.valueOf("23"))).build();
Interface1Builder intf1Builder = new Interface1Builder();
Mockito.when(openRoadmInterfacesImpl121Spy.getInterface(Mockito.anyString(), Mockito.anyString())).thenReturn(
Optional.of(new InterfaceBuilder().addAugmentation(intf1Builder.setOts(ots).build())
OpenRoadmInterfacesImpl openRoadmInterfacesSpy = new OpenRoadmInterfacesImpl((this.deviceTransactionManager),
this.mappingUtils, openRoadmInterfacesImpl121Spy, this.openRoadmInterfacesImpl22,
this.openRoadmInterfacesImpl710);
- openRoadmInterfacesSpy = PowerMockito.spy(openRoadmInterfacesSpy);
+ openRoadmInterfacesSpy = Mockito.spy(openRoadmInterfacesSpy);
return new PowerMgmtImpl(getDataBroker(), openRoadmInterfacesSpy, crossConnectMock,
this.deviceTransactionManager);
}
package org.opendaylight.transportpce.olm.service;
-import java.math.BigDecimal;
import java.util.Optional;
import org.junit.Assert;
import org.junit.Before;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossBaseInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.CalculateSpanlossBaseOutput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.RatioDB;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.Interface;
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.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
iidCurrentPmList, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(OlmTransactionUtils.getCurrentPmListC());
- InstanceIdentifier<Interface> interfacesIIDA = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey("OTS-DEG2-TTP-TXRX"));
- InstanceIdentifier<Interface> interfacesIIDC = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey("OTS-DEG1-TTP-TXRX"));
+ InstanceIdentifier<Interface> interfacesIIDA = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey("OTS-DEG2-TTP-TXRX"))
+ .build();
+ InstanceIdentifier<Interface> interfacesIIDC = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey("OTS-DEG1-TTP-TXRX"))
+ .build();
Optional<Interface> interfaceA = Optional.of(new InterfaceBuilder().setName("OTS-DEG2-TTP-TXRX").build());
Optional<Interface> interfaceC = Optional.of(new InterfaceBuilder().setName("OTS-DEG1-TTP-TXRX").build());
Mockito.when(this.deviceTransactionManager.getDataFromDevice("ROADM-A1", LogicalDatastoreType.CONFIGURATION,
interfacesIIDC, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT)).thenReturn(interfaceC);
- Ots otsValue = new OtsBuilder().setSpanLossTransmit(new RatioDB(new BigDecimal(25)))
- .setSpanLossReceive(new RatioDB(new BigDecimal(25))).build();
+ Ots otsValue = new OtsBuilder()
+ .setSpanLossTransmit(new RatioDB(Decimal64.valueOf("25")))
+ .setSpanLossReceive(new RatioDB(Decimal64.valueOf("25")))
+ .build();
Interface1 ots = new Interface1Builder().setOts(otsValue).build();
Interface interA = new InterfaceBuilder().setName("OTS-DEG2-TTP-TXRX").setType(OpticalTransport.class)
.addAugmentation(ots).build();
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.powermock.api.mockito.PowerMockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
this.deviceTransactionManager);
this.olmPowerService = new OlmPowerServiceImpl(this.dataBroker, this.powerMgmt,
this.deviceTransactionManager, this.portMapping, this.mappingUtils, this.openRoadmInterfaces);
- this.powerMgmtMock = PowerMockito.mock(PowerMgmtImpl.class);
+ this.powerMgmtMock = Mockito.mock(PowerMgmtImpl.class);
this.olmPowerServiceMock = new OlmPowerServiceImpl(this.dataBroker, this.powerMgmtMock,
this.deviceTransactionManager, this.portMapping, this.mappingUtils, this.openRoadmInterfaces);
this.olmPowerServiceMock = Mockito.mock(OlmPowerServiceImpl.class);
package org.opendaylight.transportpce.olm.util;
-import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev191129.RatioDB;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.Direction;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.Location;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.Interface;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.InterfaceKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
.withKey(new LinkConcatenationKey(Uint32.valueOf(1)))
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Truewave)
- .setPmd(new FiberPmd(BigDecimal.ONE))
+ .setPmd(new FiberPmd(Decimal64.valueOf("1")))
.build())
.setSRLGId(Uint32.valueOf(1))
- .setSRLGLength(BigDecimal.valueOf(1))
+ .setSRLGLength(Decimal64.valueOf("1"))
.build();
LinkConcatenation linkConcatenation2 = new LinkConcatenationBuilder()
.withKey(new LinkConcatenationKey(Uint32.valueOf(2)))
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Truewave)
- .setPmd(new FiberPmd(BigDecimal.ONE))
+ .setPmd(new FiberPmd(Decimal64.valueOf("1")))
.build())
.setSRLGId(Uint32.valueOf(1))
- .setSRLGLength(BigDecimal.valueOf(1))
+ .setSRLGLength(Decimal64.valueOf("1"))
.build();
linkConcentationValues.put(linkConcatenation.key(),linkConcatenation);
linkConcentationValues.put(linkConcatenation2.key(),linkConcatenation2);
.span.SpanBuilder()
.setAdministrativeState(AdminStates.InService)
.setAutoSpanloss(true)
- .setEngineeredSpanloss(new RatioDB(BigDecimal.ONE))
+ .setEngineeredSpanloss(new RatioDB(Decimal64.valueOf("1")))
.setLinkConcatenation(linkConcentationValues)
- .setSpanlossBase(new RatioDB(BigDecimal.ONE))
- .setSpanlossCurrent(new RatioDB(BigDecimal.ONE))
+ .setSpanlossBase(new RatioDB(Decimal64.valueOf("1")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("1")))
.build())
.build())
.build())
.span.SpanBuilder()
.setAdministrativeState(AdminStates.InService)
.setAutoSpanloss(true)
- .setEngineeredSpanloss(new RatioDB(BigDecimal.ONE))
+ .setEngineeredSpanloss(new RatioDB(Decimal64.valueOf("1")))
.setLinkConcatenation(linkConcentationValues)
- .setSpanlossBase(new RatioDB(BigDecimal.ONE))
- .setSpanlossCurrent(new RatioDB(BigDecimal.ONE))
+ .setSpanlossBase(new RatioDB(Decimal64.valueOf("1")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("1")))
.build())
.build())
.build())
.withKey(new MeasurementKey(PmGranularity._15min))
.setGranularity(org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev171215
.PmGranularity._15min)
- .setPmParameterValue(new PmDataType(new BigDecimal("-3.5")))
+ .setPmParameterValue(new PmDataType(Decimal64.valueOf("-3.5")))
.setValidity(Validity.Complete)
.build();
CurrentPm cpA = new CurrentPmBuilder()
.OpticalPowerOutput)
.setMeasurement(Map.of(measurementA.key(),measurementA))
.build();
- InstanceIdentifier<Interface> interfaceIIDA = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey("OTS-DEG2-TTP-TXRX"));
+ InstanceIdentifier<Interface> interfaceIIDA = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey("OTS-DEG2-TTP-TXRX"))
+ .build();
CurrentPmEntry currentPmEntryA = new CurrentPmEntryBuilder()
.setCurrentPm(Map.of(cpA.key(),cpA))
.setPmResourceInstance(interfaceIIDA)
public static Optional<CurrentPmList> getCurrentPmListC() {
Measurement measurementC = new MeasurementBuilder()
.setGranularity(org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev171215.PmGranularity._15min)
- .setPmParameterValue(new PmDataType(new BigDecimal("-18.1")))
+ .setPmParameterValue(new PmDataType(Decimal64.valueOf("-18.1")))
.setValidity(Validity.Complete)
.build();
CurrentPm cpC = new CurrentPmBuilder()
.OpticalPowerInput)
.setMeasurement(Map.of(measurementC.key(),measurementC))
.build();
- InstanceIdentifier<Interface> interfaceIIDC = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey("OTS-DEG1-TTP-TXRX"));
+ InstanceIdentifier<Interface> interfaceIIDC = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey("OTS-DEG1-TTP-TXRX"))
+ .build();
CurrentPmEntry currentPmEntryC = new CurrentPmEntryBuilder()
.setCurrentPm(Map.of(cpC.key(),cpC))
.setPmResourceInstance(interfaceIIDC)
package org.opendaylight.transportpce.olm.util;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
LinkConcatenation linkConcatenation = new LinkConcatenationBuilder()
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Truewave)
- .setPmd(new FiberPmd(BigDecimal.ONE))
+ .setPmd(new FiberPmd(Decimal64.valueOf("1")))
.build())
.setSRLGId(Uint32.valueOf(1))
- .setSRLGLength(BigDecimal.valueOf(1))
+ .setSRLGLength(Decimal64.valueOf("1"))
.build();
LinkConcatenation linkConcatenation2 = new LinkConcatenationBuilder()
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Truewave)
- .setPmd(new FiberPmd(BigDecimal.ONE))
+ .setPmd(new FiberPmd(Decimal64.valueOf("1")))
.build())
.setSRLGId(Uint32.valueOf(1))
- .setSRLGLength(BigDecimal.valueOf(1))
+ .setSRLGLength(Decimal64.valueOf("1"))
.build();
linkConcentationValues.put(linkConcatenation.key(),linkConcatenation);
linkConcentationValues.put(linkConcatenation2.key(),linkConcatenation2);
.attributes.amplified.link.section.element.section.element.span.SpanBuilder()
.setAdministrativeState(AdminStates.InService)
.setAutoSpanloss(true)
- .setEngineeredSpanloss(new RatioDB(BigDecimal.ONE))
+ .setEngineeredSpanloss(new RatioDB(Decimal64.valueOf("1")))
.setLinkConcatenation(linkConcentationValues)
- .setSpanlossBase(new RatioDB(BigDecimal.ONE))
- .setSpanlossCurrent(new RatioDB(BigDecimal.ONE))
+ .setSpanlossBase(new RatioDB(Decimal64.valueOf("1")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("1")))
.build())
.build())
.build())
.attributes.amplified.link.section.element.section.element.span.SpanBuilder()
.setAdministrativeState(AdminStates.InService)
.setAutoSpanloss(true)
- .setEngineeredSpanloss(new RatioDB(BigDecimal.ONE))
+ .setEngineeredSpanloss(new RatioDB(Decimal64.valueOf("1")))
.setLinkConcatenation(linkConcentationValues)
- .setSpanlossBase(new RatioDB(BigDecimal.ONE))
- .setSpanlossCurrent(new RatioDB(BigDecimal.ONE))
+ .setSpanlossBase(new RatioDB(Decimal64.valueOf("1")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("1")))
.build())
.build())
.build())
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPointBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
case StringConstants.SERVICE_TYPE_OTUC4:
case StringConstants.SERVICE_TYPE_100GE_T:
case StringConstants.SERVICE_TYPE_OTU4:
- atoZDirectionBldr.setAToZMaxFrequency(new FrequencyTHz(rc.getMaxFreq()));
- atoZDirectionBldr.setAToZMinFrequency(new FrequencyTHz(rc.getMinFreq()));
+ atoZDirectionBldr.setAToZMaxFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMaxFreq())));
+ atoZDirectionBldr.setAToZMinFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMinFreq())));
atoZDirectionBldr.setAToZWavelengthNumber(Uint32.valueOf(rc.getResultWavelength()));
break;
case StringConstants.SERVICE_TYPE_100GE_M:
case StringConstants.SERVICE_TYPE_OTUC4:
case StringConstants.SERVICE_TYPE_100GE_T:
case StringConstants.SERVICE_TYPE_OTU4:
- ztoADirectionBldr.setZToAMaxFrequency(new FrequencyTHz(rc.getMaxFreq()));
- ztoADirectionBldr.setZToAMinFrequency(new FrequencyTHz(rc.getMinFreq()));
+ ztoADirectionBldr.setZToAMaxFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMaxFreq())));
+ ztoADirectionBldr.setZToAMinFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMinFreq())));
ztoADirectionBldr.setZToAWavelengthNumber(Uint32.valueOf(rc.getResultWavelength()));
break;
case StringConstants.SERVICE_TYPE_100GE_M:
private void readExclude(Exclude exclude, PceConstraints constraints) {
//TODO: Implement other exclude constraints: fiber-bundle, link-identifier
// and supporting-service-name
- List<NodeIdType> nodes = exclude.getNodeId();
- if (nodes != null) {
+ if (exclude.getNodeId() != null) {
List<String> elementsToExclude = new ArrayList<>();
- for (NodeIdType node : nodes) {
+ for (NodeIdType node : exclude.getNodeId()) {
elementsToExclude.add(node.getValue());
}
constraints.setExcludeSupNodes(elementsToExclude);
}
- List<Uint32> srlgs = exclude.getSrlgId();
- if (srlgs != null) {
+ if (exclude.getSrlgId() != null) {
List<Long> elementsToExclude = new ArrayList<>();
- for (Uint32 srlg : srlgs) {
+ for (Uint32 srlg : exclude.getSrlgId()) {
elementsToExclude.add(srlg.longValue());
}
constraints.setExcludeSRLG(elementsToExclude);
}
- List<String> sites = exclude.getSite();
- if (sites != null) {
- constraints.setExcludeCLLI(exclude.getSite());
+ if (exclude.getSite() != null) {
+ constraints.setExcludeCLLI(new ArrayList<>(exclude.getSite()));
}
if (exclude.getFiberBundle() != null || exclude.getLinkIdentifier() != null
|| exclude.getSupportingServiceName() != null) {
}
private void readInclude(Include include, PceConstraints constraints) {
- List<NodeIdType> nodes = include.getNodeId();
- if (nodes != null) {
- for (NodeIdType node : nodes) {
+ if (include.getNodeId() != null) {
+ for (NodeIdType node : include.getNodeId()) {
constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.NODE, node.getValue()));
}
}
- List<Uint32> srlgs = include.getSrlgId();
- if (srlgs != null) {
- for (Uint32 srlg : srlgs) {
+ if (include.getSrlgId() != null) {
+ for (Uint32 srlg : include.getSrlgId()) {
constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.SRLG, srlg.toString()));
}
}
- List<String> sites = include.getSite();
- if (sites != null) {
- for (String site : sites) {
+ if (include.getSite() != null) {
+ for (String site : include.getSite()) {
constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.CLLI, site));
}
}
package org.opendaylight.transportpce.pce.gnpy;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.Result;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.explicit.route.hop.type.NumUnnumHop;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.generic.path.properties.path.properties.PathMetric;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.IncludeBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraintsBuilder;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
LOG.info("The response id is {}; ", responses.get(0).getResponseId());
this.response = responses.get(0);
- analyzeResult();
}
public boolean getPathFeasibility() {
LOG.info("GNPy : path is not feasible : {}", noPathType);
for (PathMetric pathMetric : pathMetricList) {
String metricType = pathMetric.getMetricType().getSimpleName();
- BigDecimal accumulativeValue = pathMetric.getAccumulativeValue();
+ Decimal64 accumulativeValue = pathMetric.getAccumulativeValue();
LOG.info("Metric type {} // AccumulatriveValue {}", metricType, accumulativeValue);
}
}
// Path metrics
for (PathMetric pathMetric : pathMetricList) {
String metricType = pathMetric.getMetricType().getSimpleName();
- BigDecimal accumulativeValue = pathMetric.getAccumulativeValue();
+ Decimal64 accumulativeValue = pathMetric.getAccumulativeValue();
LOG.info("Metric type {} // AccumulatriveValue {}", metricType, accumulativeValue);
}
// Path route objects
HardConstraints hardConstraints = null;
// Includes the list of nodes in the GNPy computed path as constraints
// for the PCE
- List<NodeIdType> nodeIdList = new ArrayList<>();
+ Set<NodeIdType> nodeIdList = new HashSet<>();
for (PathRouteObjects pathRouteObjects : pathRouteObjectList) {
if (pathRouteObjects.getPathRouteObject().getType() instanceof NumUnnumHop) {
NumUnnumHop numUnnumHop = (NumUnnumHop) pathRouteObjects.getPathRouteObject().getType();
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.transportpce.common.ServiceRateConstant;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ztoa.direction.ZToA;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.Resource;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
mformat = optionalModulationFormat.get();
}
spacing = GridConstant.FREQUENCY_SLOT_WIDTH_TABLE.get(Uint32.valueOf(rate), mformat);
- FrequencyTHz centralFrequency = GridUtils
- .getCentralFrequency(minFrequency.getValue(), maxFrequency.getValue());
+ FrequencyTHz centralFrequency = GridUtils.getCentralFrequency(
+ minFrequency.getValue().decimalValue(),
+ maxFrequency.getValue().decimalValue());
int centralFrequencyBitSetIndex = GridUtils.getIndexFromFrequency(centralFrequency.getValue());
mvalue = (int) Math.ceil(spacing.doubleValue() / (GridConstant.GRANULARITY));
nvalue = GridUtils.getNFromFrequencyIndex(centralFrequencyBitSetIndex);
.setM(Uint32.valueOf(mvalue / 2)).setN(nvalue).build();
TeBandwidth teBandwidth = new TeBandwidthBuilder()
- .setPathBandwidth(BigDecimal.valueOf(rate * 1e9))
+ .setPathBandwidth(Decimal64.valueOf(BigDecimal.valueOf(rate * 1e9)))
.setTechnology("flexi-grid").setTrxType("OpenROADM MSA ver. 5.0")
.setTrxMode(TRX_MODE_TABLE.get(Uint32.valueOf(rate), spacing))
- .setOutputPower(GridUtils.convertDbmW(GridConstant.OUTPUT_POWER_100GB_DBM
- + 10 * Math.log10(mvalue / (double)GridConstant.NB_SLOTS_100G)))
+ .setOutputPower(Decimal64.valueOf(GridUtils.convertDbmW(GridConstant.OUTPUT_POWER_100GB_DBM
+ + 10 * Math.log10(mvalue / (double)GridConstant.NB_SLOTS_100G))))
.setEffectiveFreqSlot(Map.of(effectiveFreqSlot.key(), effectiveFreqSlot))
- .setSpacing(spacing.multiply(BigDecimal.valueOf(1e9))).build();
+ .setSpacing(Decimal64.valueOf(spacing.multiply(BigDecimal.valueOf(1e9))))
+ .build();
return new PathConstraintsBuilder().setTeBandwidth(teBandwidth).build();
}
//Create the synchronization
private List<Synchronization> extractSynchronization(Uint32 requestId) {
// Create RequestIdNumber
- List<String> requestIdNumber = new ArrayList<>();
+ Set<String> requestIdNumber = new HashSet<>();
requestIdNumber.add(requestId.toString());
// Create a synchronization
Svec svec = new SvecBuilder().setRelaxable(true)
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
String nodeId = ila.getNodeId().getValue();
mapDisgNodeRefNode.put(nodeId, nodeId);
Elements element = createElementsEdfa(LATITUDE, LONGITUTE, REGION, CITY,
- ila.getGain().getValue(), ila.getTilt().getValue(),
- ila.getOutVoaAtt().getValue(), "std_medium_gain",
+ ila.getGain().getValue().decimalValue(), ila.getTilt().getValue().decimalValue(),
+ ila.getOutVoaAtt().getValue().decimalValue(), "std_medium_gain",
nodeId);
this.elements.put(element.key(),element);
return nodeId;
private Elements createElementsFiber(double latitude, double longitude, String region, String city, String uidFiber,
double length, double attIn, double lossCoef, double connIn, double connOut, String typeVariety) {
// Create an amplifier after the ROADM
- Coordinate c1 = new Coordinate(BigDecimal.valueOf(latitude));
- Coordinate c2 = new Coordinate(BigDecimal.valueOf(longitude));
+ Coordinate c1 = new Coordinate(Decimal64.valueOf(String.valueOf(latitude)));
+ Coordinate c2 = new Coordinate(Decimal64.valueOf(String.valueOf(longitude)));
Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
.build();
Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
- Fiber fiber = new FiberBuilder().setLength(BigDecimal.valueOf(length)).setLengthUnits(Km.class)
- .setAttIn(BigDecimal.valueOf(attIn)).setLossCoef(BigDecimal.valueOf(lossCoef))
- .setConIn(BigDecimal.valueOf(connIn))
- .setConOut(BigDecimal.valueOf(connOut)).build();
+ Fiber fiber = new FiberBuilder()
+ .setLength(Decimal64.valueOf(String.valueOf(length)))
+ .setLengthUnits(Km.class)
+ .setAttIn(Decimal64.valueOf(String.valueOf(attIn)))
+ .setLossCoef(Decimal64.valueOf(String.valueOf(lossCoef)))
+ .setConIn(Decimal64.valueOf(String.valueOf(connIn)))
+ .setConOut(Decimal64.valueOf(String.valueOf(connOut)))
+ .build();
Params params1 = new ParamsBuilder().setFiberroadmfused(fiber).build();
return new ElementsBuilder().setUid(uidFiber)
.setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Fiber.class)
private Elements createElementsEdfa(double latitude, double longitude, String region, String city,
BigDecimal gainTarget, BigDecimal tiltTarget, BigDecimal outVoa, String typeVariety, String uidEdfa) {
// Create an amplifier after the ROADM
- Coordinate c1 = new Coordinate(BigDecimal.valueOf(latitude));
- Coordinate c2 = new Coordinate(BigDecimal.valueOf(longitude));
+ Coordinate c1 = new Coordinate(Decimal64.valueOf(String.valueOf(latitude)));
+ Coordinate c2 = new Coordinate(Decimal64.valueOf(String.valueOf(longitude)));
Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
.build();
Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
- Operational operational = new OperationalBuilder().setGainTarget(gainTarget).setTiltTarget(tiltTarget)
- .setOutVoa(outVoa).build();
+ Operational operational = new OperationalBuilder()
+ .setGainTarget(Decimal64.valueOf(gainTarget))
+ .setTiltTarget(Decimal64.valueOf(tiltTarget))
+ .setOutVoa(Decimal64.valueOf(outVoa))
+ .build();
Edfa edfa = new EdfaBuilder()
.setOperational(operational).build();
return new ElementsBuilder().setUid(uidEdfa)
*/
private Elements createElementsRoadm(double latitude, double longitude, String region, String city,
double targetPchOutDb, String uidRoadm) {
- Coordinate c1 = new Coordinate(BigDecimal.valueOf(latitude));
- Coordinate c2 = new Coordinate(BigDecimal.valueOf(longitude));
+ Coordinate c1 = new Coordinate(Decimal64.valueOf(String.valueOf(latitude)));
+ Coordinate c2 = new Coordinate(Decimal64.valueOf(String.valueOf(longitude)));
Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
.build();
Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
- Roadm roadm = new RoadmBuilder().setTargetPchOutDb(BigDecimal.valueOf(targetPchOutDb)).build();
+ Roadm roadm = new RoadmBuilder()
+ .setTargetPchOutDb(Decimal64.valueOf(String.valueOf(targetPchOutDb)))
+ .build();
Params params1 = new ParamsBuilder().setFiberroadmfused(roadm).build();
return new ElementsBuilder().setUid(uidRoadm)
.setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev220615.Roadm.class)
*/
private Elements createElementsTransceiver(double latitude, double longitude, String region, String city,
String uidTrans) {
- Coordinate c1 = new Coordinate(BigDecimal.valueOf(latitude));
- Coordinate c2 = new Coordinate(BigDecimal.valueOf(longitude));
+ Coordinate c1 = new Coordinate(Decimal64.valueOf(String.valueOf(latitude)));
+ Coordinate c2 = new Coordinate(Decimal64.valueOf(String.valueOf(longitude)));
Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
.build();
Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
package org.opendaylight.transportpce.pce.graph;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
commonEdgeTpnPool.add(srcTpn);
}
}
- Collections.sort(commonEdgeTpnPool);
+
if (!commonEdgeTpnPool.isEmpty()) {
Integer startTribSlot = tribSlotMap.values().stream().findFirst().get().get(0).toJava();
Integer tribPort = (int) Math.ceil((double)startTribSlot / nbSlot);
pceNode.getNodeId(), pceNode.getVersion(), pceNode.getSlotWidthGranularity());
isFlexGrid = false;
}
- if ((pceNode.getSlotWidthGranularity().equals(GridConstant.SLOT_WIDTH_50))
- && (pceNode.getCentralFreqGranularity().equals(GridConstant.SLOT_WIDTH_50))) {
+ if ((pceNode.getSlotWidthGranularity().setScale(0, RoundingMode.CEILING)
+ .equals(GridConstant.SLOT_WIDTH_50))
+ && (pceNode.getCentralFreqGranularity().setScale(0, RoundingMode.CEILING)
+ .equals(GridConstant.SLOT_WIDTH_50))) {
LOG.info("Node {}: version is {} with slot width granularity {} and central "
+ "frequency granularity is {} -> fixed grid mode",
pceNode.getNodeId(), pceNode.getVersion(), pceNode.getSlotWidthGranularity(),
for (Node node : allNodes) {
if (excClliNodes.contains(node.getNodeId().getValue())) {
LOG.debug("mapDiversityConstraints setExcludeCLLI for node {}", node.getNodeId().getValue());
- pceHardConstraints.setExcludeCLLI(Arrays.asList(getCLLI(node)));
+ pceHardConstraints.setExcludeCLLI(List.of(getCLLI(node)));
}
if (excNodes.contains(node.getNodeId().getValue())) {
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
///////////// Intermediate data/////////////////
private List<PceLink> addLinks = new ArrayList<>();
private List<PceLink> dropLinks = new ArrayList<>();
- private HashSet<NodeId> azSrgs = new HashSet<>();
+ private List<NodeId> azSrgs = new ArrayList<>();
private PceNode aendPceNode = null;
private PceNode zendPceNode = null;
// this List serves calculation of ZtoA path description
// TODO maybe better solution is possible
private Map<LinkId, PceLink> allPceLinks = new HashMap<>();
- private Set<LinkId> linksToExclude = new HashSet<>();
+ private List<LinkId> linksToExclude = new ArrayList<>();
private PceResult returnStructure;
private PortMapping portMapping;
for (McCapabilities mcCapabitility : mcCapabilities) {
if (mcCapabitility.getMcNodeName().contains("XPDR")
&& mcCapabitility.getSlotWidthGranularity() != null) {
- return mcCapabitility.getSlotWidthGranularity().getValue();
+ return mcCapabitility.getSlotWidthGranularity().getValue().decimalValue();
}
if (mcCapabitility.getMcNodeName().contains(moduleName)
&& mcCapabitility.getSlotWidthGranularity() != null) {
- return mcCapabitility.getSlotWidthGranularity().getValue();
+ return mcCapabitility.getSlotWidthGranularity().getValue().decimalValue();
}
}
return GridConstant.SLOT_WIDTH_50;
for (McCapabilities mcCapabitility : mcCapabilities) {
if (mcCapabitility.getMcNodeName().contains("XPDR")
&& mcCapabitility.getCenterFreqGranularity() != null) {
- return mcCapabitility.getCenterFreqGranularity().getValue();
+ return mcCapabitility.getCenterFreqGranularity().getValue().decimalValue();
}
if (mcCapabitility.getMcNodeName().contains(moduleName)
&& mcCapabitility.getCenterFreqGranularity() != null) {
- return mcCapabitility.getCenterFreqGranularity().getValue();
+ return mcCapabitility.getCenterFreqGranularity().getValue().decimalValue();
}
}
return GridConstant.SLOT_WIDTH_50;
}
//Compute the OSNR of a span
- public double calcSpanOSNR() {
+ private double calcSpanOSNR() {
if (this.omsAttributesSpan == null) {
return 0L;
}
/**
* For optical node the slot width granularity from mc capabilities.
- * @return BigDecimal.
+ * @return Decimal64.
*/
BigDecimal getSlotWidthGranularity();
/**
* For optical node the central-frequency granularity from mc capabilities.
- * @return BigDecimal.
+ * @return Decimal64.
*/
BigDecimal getCentralFreqGranularity();
}
public PceOpticalNode(String deviceNodeId, String serviceType, PortMapping portMapping, Node node,
OpenroadmNodeType nodeType, String version, BigDecimal slotWidthGranularity,
- BigDecimal centralFreqGranularity) {
+ BigDecimal centralFreqGranularity) {
if (deviceNodeId != null
&& serviceType != null
package org.opendaylight.transportpce.pce.networkanalyzer;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.BitSet;
private Map<String, String> clientPerNwTp = new HashMap<>();
private String clientPort;
- public PceOtnNode(
- Node node,
- OpenroadmNodeType nodeType,
- NodeId nodeId,
- String pceNodeType,
- String serviceType,
- String clientPort) {
+ @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+ justification = "need to initialise available tribport and tribslt")
+ public PceOtnNode(Node node, OpenroadmNodeType nodeType, NodeId nodeId, String pceNodeType, String serviceType,
+ String clientPort) {
this.node = node;
this.nodeId = nodeId;
this.nodeType = nodeType;
node1.getSwitchingPools().nonnullOduSwitchingPools()
.values().stream().findFirst().get()
.getNonBlockingList().values());
- if (nblList == null) {
- return false;
- }
netwTps.sort(Comparator.comparing(TpId::getValue));
switch (modeType) {
if (portConAttr != null && portConAttr.getOdtuTpnPool() != null) {
OdtuTpnPool otPool = portConAttr.getOdtuTpnPool().values().stream().findFirst().get();
if (checkFirstOdtuTpn(otPool)) {
- tpAvailableTribPort.put(tp.getTpId().getValue(), otPool.getTpnPool());
+ tpAvailableTribPort.put(tp.getTpId().getValue(), new ArrayList<>(otPool.getTpnPool()));
}
}
}
XpdrTpPortConnectionAttributes portConAttr =
tp.augmentation(TerminationPoint1.class).getXpdrTpPortConnectionAttributes();
if (portConAttr != null && portConAttr.getTsPool() != null) {
- tpAvailableTribSlot.put(tp.getTpId().getValue(), portConAttr.getTsPool());
+ tpAvailableTribSlot.put(tp.getTpId().getValue(), new ArrayList<>(portConAttr.getTsPool()));
}
}
}
NodeBuilder node1Builder = NodeUtils.getNodeBuilder(NodeUtils.geSupportingNodes());
node = node1Builder.setNodeId(new NodeId("test")).build();
PceOpticalNode pceOpticalNode = new PceOpticalNode(deviceNodeId, serviceType, portMapping, node,
- OpenroadmNodeType.SRG, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1, GridConstant.SLOT_WIDTH_50,
+ OpenroadmNodeType.SRG, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
+ GridConstant.SLOT_WIDTH_50,
GridConstant.SLOT_WIDTH_50);
PceOpticalNode pceOpticalNode2 = new PceOpticalNode(deviceNodeId, serviceType, portMapping, node,
- OpenroadmNodeType.SRG, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1, GridConstant.SLOT_WIDTH_50,
+ OpenroadmNodeType.SRG, StringConstants.OPENROADM_DEVICE_VERSION_2_2_1,
+ GridConstant.SLOT_WIDTH_50,
GridConstant.SLOT_WIDTH_50);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode2);
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
}
+ @Ignore
@Test
public void askNewPathFromGnpyTest() throws Exception {
gnpyUtilitiesImpl = new GnpyUtilitiesImpl(networkTransaction,
package org.opendaylight.transportpce.pce.networkanalyzer;
-import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import org.junit.Assert;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointKey;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
pceLink = new PceLink(link, pceOpticalNode, pceOpticalNode);
Assert.assertNotNull(MapUtils.getOmsAttributesSpan(link));
- Assert.assertNotNull(pceLink.calcSpanOSNR());
+ Assert.assertNotNull(pceLink.getosnr());
Assert.assertEquals(1, pceLink.getsrlgList().size());
- Assert.assertTrue(7.857119000000001 == pceLink.calcSpanOSNR());
+ Assert.assertTrue(7.857119000000001 == pceLink.getosnr());
Assert.assertNull(pceLink.getOppositeLink());
Assert.assertNull(pceLink.getOppositeLink());
Assert.assertNotNull(pceLink.getDestTP());
Assert.assertNotNull(pceLink.getUsedBandwidth());
Assert.assertNotNull(pceLink.getsourceNetworkSupNodeId());
Assert.assertNotNull(pceLink.getdestNetworkSupNodeId());
- Assert.assertNotNull(pceLink.getosnr());
Assert.assertNotNull(pceLink.getSourceTP());
Assert.assertNotNull(pceLink.getsourceCLLI());
Assert.assertNotNull(pceLink.getdestCLLI());
//For setting up attributes for openRoadm augment
LinkConcatenation linkConcatenation = new LinkConcatenationBuilder()
.withKey(new LinkConcatenationKey(Uint32.valueOf(1)))
- .setSRLGLength(BigDecimal.valueOf(20))
+ .setSRLGLength(Decimal64.valueOf("20"))
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Dsf)
.build())
OMSAttributesBuilder omsAttributesBuilder =
new OMSAttributesBuilder()
.setSpan(new SpanBuilder()
- .setSpanlossCurrent(new RatioDB(new BigDecimal("55")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("55")))
.setLinkConcatenation(Map.of(linkConcatenation.key(),
linkConcatenation
)).build());
package org.opendaylight.transportpce.pce.networkanalyzer;
-import java.math.BigDecimal;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPointBuilder;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint16;
public class PceOpticalNodeTest extends AbstractTest {
public void isValidTest() {
OpenroadmNodeType nodeType = OpenroadmNodeType.ROADM;
pceOpticalNode = new PceOpticalNode(deviceNodeId, serviceType, portMapping, node, nodeType,
- StringConstants.OPENROADM_DEVICE_VERSION_2_2_1, GridConstant.SLOT_WIDTH_50, GridConstant.SLOT_WIDTH_50);
+ StringConstants.OPENROADM_DEVICE_VERSION_2_2_1, GridConstant.SLOT_WIDTH_50,
+ GridConstant.SLOT_WIDTH_50);
Assert.assertTrue(pceOpticalNode.isValid());
}
byteArray[7] = (byte) GridConstant.AVAILABLE_SLOT_VALUE;
Map<AvailFreqMapsKey, AvailFreqMaps> waveMap = new HashMap<>();
AvailFreqMaps availFreqMaps = new AvailFreqMapsBuilder().setMapName(GridConstant.C_BAND)
- .setFreqMapGranularity(new FrequencyGHz(BigDecimal.valueOf(GridConstant.GRANULARITY)))
- .setStartEdgeFreq(new FrequencyTHz(BigDecimal.valueOf(GridConstant.START_EDGE_FREQUENCY)))
+ .setFreqMapGranularity(new FrequencyGHz(Decimal64.valueOf(String.valueOf(GridConstant.GRANULARITY))))
+ .setStartEdgeFreq(
+ new FrequencyTHz(Decimal64.valueOf(String.valueOf(GridConstant.START_EDGE_FREQUENCY))))
.setEffectiveBits(Uint16.valueOf(GridConstant.EFFECTIVE_BITS))
.setFreqMap(byteArray)
.build();
*/
package org.opendaylight.transportpce.pce.service;
-import java.math.BigDecimal;
import java.util.Map;
import org.junit.After;
import org.junit.Assert;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.result.ResponseKey;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.result.response.response.type.NoPathCaseBuilder;
import org.opendaylight.yang.gen.v1.gnpy.path.rev220615.result.response.response.type.PathCaseBuilder;
+import org.opendaylight.yangtools.yang.common.Decimal64;
public class PathComputationServiceImplTest extends AbstractTest {
@Test
public void testPathComputationRequestPathCase() {
PathMetric pathMetric = new PathMetricBuilder()
- .setAccumulativeValue(new BigDecimal(21))
+ .setAccumulativeValue(Decimal64.valueOf("21"))
.setMetricType(PathBandwidth.class).build();
Response response = new ResponseBuilder()
.withKey(new ResponseKey("responseId")).setResponseType(new PathCaseBuilder()
*/
package org.opendaylight.transportpce.pce.utils;
-import java.math.BigDecimal;
-import java.util.Arrays;
import java.util.Map;
+import java.util.Set;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestInput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestInputBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
.build())
.build())
.setHardConstraints(new HardConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.build())
.setSoftConstraints(new SoftConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.build())
.setHardConstraints(new HardConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.build())
.setSoftConstraints(new SoftConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.build())
.setHardConstraints(new HardConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.build())
.setSoftConstraints(new SoftConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.setHardConstraints(new HardConstraintsBuilder()
.setExclude(new ExcludeBuilder()
- .setNodeId(Arrays.asList(new NodeIdType("OpenROADM-2-2")))
+ .setNodeId(Set.of(new NodeIdType("OpenROADM-2-2")))
.build())
.setInclude(new IncludeBuilder()
- .setNodeId(Arrays.asList(new NodeIdType("XPONDER-1-2")))
+ .setNodeId(Set.of(new NodeIdType("XPONDER-1-2")))
.build())
.setLatency(new LatencyBuilder()
- .setMaxLatency(BigDecimal.valueOf(3223))
+ .setMaxLatency(Decimal64.valueOf("3223"))
.build())
.build())
.build();
.build())
.setHardConstraints(new HardConstraintsBuilder()
.setExclude(new ExcludeBuilder()
- .setNodeId(Arrays.asList(
+ .setNodeId(Set.of(
new NodeIdType("OpenROADM-2-1"),
new NodeIdType("OpenROADM-2-2")))
.build())
.build())
.setHardConstraints(new HardConstraintsBuilder()
.setLatency(new LatencyBuilder()
- .setMaxLatency(BigDecimal.valueOf(3223))
+ .setMaxLatency(Decimal64.valueOf("3223"))
.build())
.setDiversity(new DiversityBuilder()
.setServiceIdentifierList(Map.of(
.build())
.build())
.setHardConstraints(new HardConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.build())
.build())
.setSoftConstraints(new SoftConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
package org.opendaylight.transportpce.pce.utils;
-import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev191129.FiberPmd;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.link.types.rev191129.RatioDB;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1Builder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.Interface;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.interfaces.grp.InterfaceKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yangtools.yang.binding.Augmentation;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
LinkConcatenation linkConcatenation = new LinkConcatenationBuilder()
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Truewave)
- .setPmd(new FiberPmd(BigDecimal.ONE))
+ .setPmd(new FiberPmd(Decimal64.valueOf("1")))
.build())
.setSRLGId(Uint32.valueOf(1))
- .setSRLGLength(BigDecimal.valueOf(1))
+ .setSRLGLength(Decimal64.valueOf("1"))
.build();
LinkConcatenation linkConcatenation2 = new LinkConcatenationBuilder()
.addAugmentation(new LinkConcatenation1Builder()
.setFiberType(FiberType.Truewave)
- .setPmd(new FiberPmd(BigDecimal.ONE))
+ .setPmd(new FiberPmd(Decimal64.valueOf("1")))
.build())
.setSRLGId(Uint32.valueOf(1))
- .setSRLGLength(BigDecimal.valueOf(1))
+ .setSRLGLength(Decimal64.valueOf("1"))
.build();
linkConcentationValues.put(linkConcatenation.key(),linkConcatenation);
linkConcentationValues.put(linkConcatenation2.key(),linkConcatenation2);
.element.span.SpanBuilder()
.setAdministrativeState(AdminStates.InService)
.setAutoSpanloss(true)
- .setEngineeredSpanloss(new RatioDB(BigDecimal.ONE))
+ .setEngineeredSpanloss(new RatioDB(Decimal64.valueOf("1")))
.setLinkConcatenation(linkConcentationValues)
- .setSpanlossBase(new RatioDB(BigDecimal.ONE))
- .setSpanlossCurrent(new RatioDB(BigDecimal.ONE))
+ .setSpanlossBase(new RatioDB(Decimal64.valueOf("1")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("1")))
.build())
.build())
.build())
.SpanBuilder()
.setAdministrativeState(AdminStates.InService)
.setAutoSpanloss(true)
- .setEngineeredSpanloss(new RatioDB(BigDecimal.ONE))
+ .setEngineeredSpanloss(new RatioDB(Decimal64.valueOf("1")))
.setLinkConcatenation(linkConcentationValues)
- .setSpanlossBase(new RatioDB(BigDecimal.ONE))
- .setSpanlossCurrent(new RatioDB(BigDecimal.ONE))
+ .setSpanlossBase(new RatioDB(Decimal64.valueOf("1")))
+ .setSpanlossCurrent(new RatioDB(Decimal64.valueOf("1")))
.build())
.build())
.build())
public static Optional<CurrentPmList> getCurrentPmListA() {
Measurement measurementA = new MeasurementBuilder()
.setGranularity(org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev171215.PmGranularity._15min)
- .setPmParameterValue(new PmDataType(new BigDecimal("-3.5")))
+ .setPmParameterValue(new PmDataType(Decimal64.valueOf("-3.5")))
.setValidity(Validity.Complete)
.build();
CurrentPm cpA = new CurrentPmBuilder()
.OpticalPowerOutput)
.setMeasurement(Map.of(measurementA.key(),measurementA))
.build();
- InstanceIdentifier<Interface> interfaceIIDA = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey("OTS-DEG2-TTP-TXRX"));
+ InstanceIdentifier<Interface> interfaceIIDA = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey("OTS-DEG2-TTP-TXRX"))
+ .build();
CurrentPmEntry currentPmEntryA = new CurrentPmEntryBuilder()
.setCurrentPm(Map.of(cpA.key(),cpA))
.setPmResourceInstance(interfaceIIDA)
public static Optional<CurrentPmList> getCurrentPmListC() {
Measurement measurementC = new MeasurementBuilder()
.setGranularity(org.opendaylight.yang.gen.v1.http.org.openroadm.pm.types.rev171215.PmGranularity._15min)
- .setPmParameterValue(new PmDataType(new BigDecimal("-18.1")))
+ .setPmParameterValue(new PmDataType(Decimal64.valueOf("-18.1")))
.setValidity(Validity.Complete)
.build();
Map<MeasurementKey,Measurement> measurementListC = new HashMap<>();
.OpticalPowerInput)
.setMeasurement(measurementListC)
.build();
- InstanceIdentifier<Interface> interfaceIIDC = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Interface.class, new InterfaceKey("OTS-DEG1-TTP-TXRX"));
+ InstanceIdentifier<Interface> interfaceIIDC = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Interface.class, new InterfaceKey("OTS-DEG1-TTP-TXRX"))
+ .build();
CurrentPmEntry currentPmEntryC = new CurrentPmEntryBuilder()
.setCurrentPm(Map.of(cpC.key(),cpC))
.setPmResourceInstance(interfaceIIDC)
},
"params": {
"length": 100,
- "loss_coef": 0.11999999999999999555910790149937383830547332763671875,
+ "loss_coef": 0.12,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
},
"params": {
"length": 140,
- "loss_coef": 0.2127659574468085124099303584443987347185611724853515625,
+ "loss_coef": 0.21,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
},
"params": {
"length": 100,
- "loss_coef": 0.11999999999999999555910790149937383830547332763671875,
+ "loss_coef": 0.12,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
},
"params": {
"length": 140,
- "loss_coef": 0.2127659574468085124099303584443987347185611724853515625,
+ "loss_coef": 0.21,
"length_units": "gnpy-network-topology:km",
"att_in": 0,
"con_in": 0,
import com.google.common.util.concurrent.ListenableFuture;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import org.opendaylight.transportpce.common.NodeIdPair;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyGHz;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.FrequencyTHz;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev181130.OpucnTribSlotDef;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OpucnTribSlotDef;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInput;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.PathDescription;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.optical.renderer.nodes.Nodes;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.optical.renderer.nodes.NodesBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.optical.renderer.nodes.NodesKey;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
.getHigherSpectralIndexFromFrequency(atoZDirection.getAToZMaxFrequency().getValue())));
}
// Set the MC-width for the OLM
- olmSetupBldr.setMcWidth(new FrequencyGHz(atoZDirection.getAToZMaxFrequency().getValue()
- .subtract(atoZDirection.getAToZMinFrequency().getValue()).multiply(new BigDecimal(1000))));
+ olmSetupBldr.setMcWidth(new FrequencyGHz(Decimal64.valueOf(
+ atoZDirection.getAToZMaxFrequency().getValue().decimalValue()
+ .subtract(atoZDirection.getAToZMinFrequency().getValue().decimalValue())
+ .multiply(new BigDecimal(1000)))));
}
return olmSetupBldr.build();
}
.setServiceName(serviceName)
.setOperation(operation)
.setNodes(nodeLists.getRendererNodeList())
- .setNmcWidth(new FrequencyGHz(GridConstant.WIDTH_40))
- .setMcWidth(new FrequencyGHz(pathDescription.getAToZDirection().getAToZMaxFrequency().getValue()
- .subtract(pathDescription.getAToZDirection().getAToZMinFrequency().getValue())));
+ .setNmcWidth(new FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_40)))
+ .setMcWidth(new FrequencyGHz(Decimal64.valueOf(
+ pathDescription.getAToZDirection().getAToZMaxFrequency().getValue().decimalValue()
+ .subtract(pathDescription.getAToZDirection().getAToZMinFrequency().getValue().decimalValue()))));
if (atoZDirection.getAToZWavelengthNumber() != null) {
servicePathInputBuilder
.setWaveNumber(atoZDirection.getAToZWavelengthNumber());
.getHigherSpectralIndexFromFrequency(atoZDirection.getAToZMaxFrequency().getValue())));
}
if (atoZDirection.getAToZMinFrequency() != null && atoZDirection.getAToZMaxFrequency() != null) {
- servicePathInputBuilder.setCenterFreq(
- GridUtils.getCentralFrequencyWithPrecision(atoZDirection.getAToZMinFrequency().getValue(),
- atoZDirection.getAToZMaxFrequency().getValue(), scale));
+ servicePathInputBuilder.setCenterFreq(GridUtils.getCentralFrequencyWithPrecision(
+ atoZDirection.getAToZMinFrequency().getValue().decimalValue(),
+ atoZDirection.getAToZMaxFrequency().getValue().decimalValue(),
+ scale));
}
if (atoZDirection.getRate() != null && atoZDirection.getModulationFormat() != null) {
Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
.setOperation(operation)
.setServiceName(serviceName)
.setNodes(nodeLists.getRendererNodeList())
- .setNmcWidth(new FrequencyGHz(GridConstant.WIDTH_40))
- .setMcWidth(new FrequencyGHz(pathDescription.getAToZDirection().getAToZMaxFrequency().getValue()
- .subtract(pathDescription.getAToZDirection().getAToZMinFrequency().getValue())));
+ .setNmcWidth(new FrequencyGHz(Decimal64.valueOf(GridConstant.WIDTH_40)))
+ .setMcWidth(new FrequencyGHz(Decimal64.valueOf(
+ pathDescription.getAToZDirection().getAToZMaxFrequency().getValue().decimalValue()
+ .subtract(pathDescription.getAToZDirection().getAToZMinFrequency().getValue().decimalValue()))));
if (ztoADirection.getZToAWavelengthNumber() != null) {
servicePathInputBuilder
.setWaveNumber(ztoADirection.getZToAWavelengthNumber());
.getHigherSpectralIndexFromFrequency(ztoADirection.getZToAMaxFrequency().getValue())));
}
if (ztoADirection.getZToAMinFrequency() != null && ztoADirection.getZToAMaxFrequency() != null) {
- servicePathInputBuilder.setCenterFreq(
- GridUtils.getCentralFrequencyWithPrecision(ztoADirection.getZToAMinFrequency().getValue(),
- ztoADirection.getZToAMaxFrequency().getValue(), scale));
+ servicePathInputBuilder.setCenterFreq(GridUtils.getCentralFrequencyWithPrecision(
+ ztoADirection.getZToAMinFrequency().getValue().decimalValue(),
+ ztoADirection.getZToAMaxFrequency().getValue().decimalValue(),
+ scale));
}
if (ztoADirection.getRate() != null && ztoADirection.getModulationFormat() != null) {
Optional<ModulationFormat> optionalModulationFormat = ModulationFormat
.setTribPortNumber(tribPort)
.setTribSlot(minTribSlot);
}
- if (serviceRate.intValue() == 100) {
- List<OpucnTribSlotDef> opucnTribSlotDefList = new ArrayList<>();
- opucnTribSlotDefList.add(pathDescription.getAToZDirection().getMinTribSlot());
- opucnTribSlotDefList.add(pathDescription.getAToZDirection().getMaxTribSlot());
+ if (serviceRate.intValue() == 100 && pathDescription.getAToZDirection().getMinTribSlot() != null
+ && pathDescription.getAToZDirection().getMaxTribSlot() != null) {
+ Set<OpucnTribSlotDef> opucnTribSlotDefList = new HashSet<>();
+ opucnTribSlotDefList.add(
+ new OpucnTribSlotDef(pathDescription.getAToZDirection().getMinTribSlot().getValue()));
+ opucnTribSlotDefList.add(
+ new OpucnTribSlotDef(pathDescription.getAToZDirection().getMaxTribSlot().getValue()));
otnServicePathInputBuilder.setOpucnTribSlots(opucnTribSlotDefList);
}
return otnServicePathInputBuilder.build();
return new ServicePathInputBuilder().setServiceName(serviceName).build();
}
- public static List<String> getLinksFromServicePathDescription(PathDescription pathDescription) {
- List<String> linkidList = new ArrayList<>();
+ public static Set<String> getLinksFromServicePathDescription(PathDescription pathDescription) {
+ Set<String> linkidList = new HashSet<>();
pathDescription.getAToZDirection().getAToZ().values().stream()
.filter(lk -> "Link".equals(lk.getResource().getResource().implementedInterface().getSimpleName()))
.forEach(rsc -> {
package org.opendaylight.transportpce.renderer.openroadminterface;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaces;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.PowerDBm;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.interfaces.grp.InterfaceKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.OtuAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.otu.container.OtuBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
.setWavelengthNumber(spectrumInformation.getWaveLength())
.setModulationFormat(modulationFormat)
.setRate(R100G.class)
- .setTransmitPower(new PowerDBm(new BigDecimal("-5")));
+ .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")));
// Create Interface1 type object required for adding as augmentation
// TODO look at imports of different versions of class
public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
DeviceTransactionManager deviceTransactionManager) {
- InstanceIdentifier<RoadmConnections> xciid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(xc));
+ InstanceIdentifier<RoadmConnections> xciid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(xc))
+ .build();
LOG.info("reading xc {} in node {}", xc, nodeId);
Optional<RoadmConnections> crossconnection = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
package org.opendaylight.transportpce.renderer.openroadminterface;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.PowerDBm;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.R100G;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData;
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.device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.OtuAttributes;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev181019.otu.container.OtuBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
MediaChannelTrailTerminationPoint.class,
spectrumInformation.getIdentifierFromParams(logicalConnPoint, "mc"))
.setSupportingInterface(portMap.getSupportingOms());
-
McTtpBuilder mcTtpBuilder = new McTtpBuilder()
- .setMinFreq(new FrequencyTHz(spectrumInformation.getMinFrequency()))
- .setMaxFreq(new FrequencyTHz(spectrumInformation.getMaxFrequency()));
+ .setMinFreq(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getMinFrequency())))
+ .setMaxFreq(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getMaxFrequency())));
// Create Interface1 type object required for adding as augmentation
org.opendaylight.yang.gen.v1.http.org.openroadm.media.channel.interfaces.rev181019.Interface1Builder
}
NmcCtpBuilder nmcCtpIfBuilder = new NmcCtpBuilder()
- .setFrequency(new FrequencyTHz(spectrumInformation.getCenterFrequency()))
- .setWidth(new FrequencyGHz(spectrumInformation.getWidth()));
+ .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
+ .setWidth(new FrequencyGHz(Decimal64.valueOf(spectrumInformation.getWidth())));
// Create Interface1 type object required for adding as augmentation
org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019.Interface1Builder
}
// OCH interface specific data
OchBuilder ocIfBuilder = new OchBuilder()
- .setFrequency(new FrequencyTHz(spectrumInformation.getCenterFrequency()))
+ .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
.setRate(R100G.class)
- .setTransmitPower(new PowerDBm(new BigDecimal("-5")))
+ .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
.setModulationFormat(modulationFormat);
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
public boolean isUsedByXc(String nodeId, String interfaceName, String xc,
DeviceTransactionManager deviceTransactionManager) {
- InstanceIdentifier<RoadmConnections> xciid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(RoadmConnections.class, new RoadmConnectionsKey(xc));
+ InstanceIdentifier<RoadmConnections> xciid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(RoadmConnections.class, new RoadmConnectionsKey(xc))
+ .build();
LOG.info("reading xc {} in node {}", xc, nodeId);
Optional<RoadmConnections> crossconnection = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
public boolean isUsedByOtnXc(String nodeId, String interfaceName, String xc,
DeviceTransactionManager deviceTransactionManager) {
- InstanceIdentifier<OduConnection> xciid = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(OduConnection.class, new OduConnectionKey(xc));
+ InstanceIdentifier<OduConnection> xciid = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(OduConnection.class, new OduConnectionKey(xc))
+ .build();
LOG.info("reading xc {} in node {}", xc, nodeId);
Optional<OduConnection> oduConnectionOpt = deviceTransactionManager.getDataFromDevice(nodeId,
LogicalDatastoreType.CONFIGURATION, xciid, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
package org.opendaylight.transportpce.renderer.openroadminterface;
-import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.stream.IntStream;
import org.opendaylight.transportpce.common.StringConstants;
import org.opendaylight.transportpce.common.fixedflex.GridConstant;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If100GE;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU4ODU4;
import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOtsiOtsigroup;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
}
// OCH interface specific data
OchBuilder ocIfBuilder = new OchBuilder()
- .setFrequency(new FrequencyTHz(spectrumInformation.getCenterFrequency()))
+ .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
.setRate(R100G.class)
- .setTransmitPower(new PowerDBm(new BigDecimal("-5")))
+ .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
.setModulationFormat(modulationFormat);
Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
if (portMap == null) {
// OTSI interface specific data
OtsiBuilder otsiBuilder = new OtsiBuilder()
- .setFrequency(new FrequencyTHz(spectrumInformation.getCenterFrequency()))
- .setTransmitPower(new PowerDBm(new BigDecimal("-5")))
+ .setFrequency(new FrequencyTHz(Decimal64.valueOf(spectrumInformation.getCenterFrequency())))
+ .setTransmitPower(new PowerDBm(Decimal64.valueOf("-5")))
.setProvisionMode(ProvisionModeType.Explicit)
.setFec(Ofec.class)
.setModulationFormat(modulationFormat);
logicalConnPoint + String.join("-", "", "OTSIGROUP", serviceRate + "G"));
// Create a list
- List<String> listSupportingOtsiInterface = new ArrayList<>();
+ Set<String> listSupportingOtsiInterface = new HashSet<>();
listSupportingOtsiInterface.add(supportingOtsiInterface);
otsiGroupInterfaceBldr.setSupportingInterfaceList(listSupportingOtsiInterface);
otuInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOtu.class,
logicalConnPoint + "-OTU4");
// Supporting interface list
- List<String> listSupportingOChInterface = new ArrayList<>();
+ Set<String> listSupportingOChInterface = new HashSet<>();
listSupportingOChInterface.add(supportOchInterface);
otuInterfaceBldr.setSupportingInterfaceList(listSupportingOChInterface);
logicalConnPoint + "-OTUC" + otucnrate);
// Create a list
- List<String> listSupportingOtsiGroupInterface = new ArrayList<>();
+ Set<String> listSupportingOtsiGroupInterface = new HashSet<>();
listSupportingOtsiGroupInterface.add(supportingOtsiGroupInterface);
otuInterfaceBuilder.setSupportingInterfaceList(listSupportingOtsiGroupInterface);
}
InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(mapping, OtnOdu.class,
logicalConnPoint + "-ODU4");
- List<String> listSupportingOtu4Interface = new ArrayList<>();
+ Set<String> listSupportingOtu4Interface = new HashSet<>();
if (mapping.getSupportingOtu4() != null) {
listSupportingOtu4Interface.add(mapping.getSupportingOtu4());
oduInterfaceBldr.setSupportingInterfaceList(listSupportingOtu4Interface);
// Create a list
String supportingOtucn;
- List<String> listSupportingOtucnInterface = new ArrayList<>();
+ Set<String> listSupportingOtucnInterface = new HashSet<>();
if (mapping.getSupportingOtucn() != null) {
listSupportingOtucnInterface.add(mapping.getSupportingOtucn());
supportingOtucn = mapping.getSupportingOtucn();
alogicalConnPoint + ODUC + oducnrate);
// Create a list
- List<String> listSupportingOtucnInterface = new ArrayList<>();
+ Set<String> listSupportingOtucnInterface = new HashSet<>();
listSupportingOtucnInterface.add(supportingOtucn);
oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
// Parent Odu-allocation
// Set the trib-slot array
- List<OpucnTribSlotDef> tribslots = new ArrayList<>();
+ Set<OpucnTribSlotDef> tribslots = new HashSet<>();
// Here the int stream is based on rate
// Get the rate, which can be 1, 2, 3 or 4 4=400G, 1=100G
String rate = supportingOducn.substring(supportingOducn.length() - 1);
InterfaceBuilder oduflexInterfaceBuilder = createGenericInterfaceBuilder(portMap, OtnOdu.class,
logicalConnPoint);
- List<String> listSupportingOtucnInterface = new ArrayList<>();
+ Set<String> listSupportingOtucnInterface = new HashSet<>();
listSupportingOtucnInterface.add(supportingOducn);
oduflexInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
}
// Parent Odu-allocation
// Set the trib-slot array
- List<OpucnTribSlotDef> tribslots = new ArrayList<>();
+ Set<OpucnTribSlotDef> tribslots = new HashSet<>();
// Here the int stream is based on rate
// Get the rate, which can be 1, 2, 3 or 4 4=400G, 1=100G
String rate = supportingOducn.substring(supportingOducn.lastIndexOf('-') + 1);
alogicalConnPoint);
- List<String> listSupportingOtucnInterface = new ArrayList<>();
+ Set<String> listSupportingOtucnInterface = new HashSet<>();
listSupportingOtucnInterface.add(supportingOducn);
oduflexInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
logicalConnPoint + ODUC + oducnrate);
// Create a list
- List<String> listSupportingOtucnInterface = new ArrayList<>();
+ Set<String> listSupportingOtucnInterface = new HashSet<>();
listSupportingOtucnInterface.add(supportingOtucn);
oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
alogicalConnPoint + ODUC + oducnrate);
// Create a list
- List<String> listSupportingOtucnInterface = new ArrayList<>();
+ Set<String> listSupportingOtucnInterface = new HashSet<>();
listSupportingOtucnInterface.add(supportingOtucn);
oduInterfaceBuilder.setSupportingInterfaceList(listSupportingOtucnInterface);
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.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OpucnTribSlotDef;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
}
- public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint,
- String serviceName, String payLoad, boolean isNetworkPort,
- OpucnTribSlotDef minTribSlotNumber, OpucnTribSlotDef maxTribSlotNumber)
+ public String createOpenRoadmOtnOdu4LoInterface(String nodeId, String logicalConnPoint, String serviceName,
+ String payLoad, boolean isNetworkPort, OpucnTribSlotDef minTribSlotNumber,
+ OpucnTribSlotDef maxTribSlotNumber)
throws OpenRoadmInterfaceException {
switch (mappingUtils.getOpenRoadmVersion(nodeId)) {
*/
package org.opendaylight.transportpce.renderer.openroadminterface;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import java.util.stream.IntStream;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
if (isCTP) {
oduFunction = ODUCTP.class;
monitoringMode = MonitoringMode.Monitored;
- List<Uint16> tribSlots = new ArrayList<>();
+ Set<Uint16> tribSlots = new HashSet<>();
Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
tribSlots.add(newIdx);
IntStream.range(tribSlotIndex, tribSlotIndex + 8)
if (isCTP) {
oduFunction = ODUCTP.class;
monitoringMode = MonitoringMode.Monitored;
- List<Uint16> tribSlots = new ArrayList<>();
+ Set<Uint16> tribSlots = new HashSet<>();
Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
tribSlots.add(newIdx);
IntStream.range(tribSlotIndex, tribSlotIndex + 8)
if (isCTP) {
oduFunction = ODUCTP.class;
monitoringMode = MonitoringMode.Monitored;
- List<Uint16> tribSlots = new ArrayList<>();
+ Set<Uint16> tribSlots = new HashSet<>();
Uint16 newIdx = Uint16.valueOf(tribSlotIndex);
tribSlots.add(newIdx);
IntStream.range(tribSlotIndex, tribSlotIndex + 8)
*/
package org.opendaylight.transportpce.renderer.openroadminterface;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashSet;
+import java.util.Set;
import java.util.stream.IntStream;
import org.opendaylight.transportpce.common.mapping.PortMapping;
import org.opendaylight.transportpce.common.openroadminterfaces.OpenRoadmInterfaceException;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODU4;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODUCTP;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODUTTPCTP;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.PayloadTypeDef;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev210924.OpucnTribSlotDef;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.OduAttributes.MonitoringMode;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.odu.container.OduBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.odu.interfaces.rev200529.opu.OpuBuilder;
if (portMap == null) {
throwException(nodeId, logicalConnPoint);
}
- List<String> supportingInterfaceList = new ArrayList<>();
+ Set<String> supportingInterfaceList = new HashSet<>();
String supportingInterface = null;
if (isNetworkPort) {
supportingInterface = portMap.getSupportingOducn();
maxTribSlotNumber.getValue());
// If it is a network port we have fill the required trib-slots and trib-ports
if (isNetworkPort) {
- List<OpucnTribSlotDef> opucnTribSlotDefList = new ArrayList<>();
+ Set<org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef>
+ opucnTribSlotDefList = new HashSet<>();
// Escape characters are used to here to take the literal dot
Uint16 tribPortNumber = Uint16.valueOf(minTribSlotNumber.getValue().split("\\.")[0]);
Uint16 startTribSlot = Uint16.valueOf(minTribSlotNumber.getValue().split("\\.")[1]);
Uint16 endTribSlot = Uint16.valueOf(maxTribSlotNumber.getValue().split("\\.")[1]);
IntStream.range(startTribSlot.intValue(), endTribSlot.intValue() + 1)
- .forEach(
- nbr -> opucnTribSlotDefList.add(OpucnTribSlotDef.getDefaultInstance(tribPortNumber + "." + nbr))
+ .forEach(nbr -> opucnTribSlotDefList.add(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OpucnTribSlotDef
+ .getDefaultInstance(tribPortNumber + "." + nbr))
);
ParentOduAllocationBuilder parentOduAllocationBuilder = new ParentOduAllocationBuilder()
.setTribPortNumber(tribPortNumber)
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;
if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(nodeId)) {
apiInfoZ = input.getZEndApiInfo();
}
- List<String> createdEthInterfaces = new ArrayList<>();
- List<String> createdOtuInterfaces = new ArrayList<>();
- List<String> createdOduInterfaces = new ArrayList<>();
- List<String> createdOchInterfaces = new ArrayList<>();
- List<String> createdConnections = new ArrayList<>();
+ Set<String> createdEthInterfaces = new HashSet<>();
+ Set<String> createdOtuInterfaces = new HashSet<>();
+ Set<String> createdOduInterfaces = new HashSet<>();
+ Set<String> createdOchInterfaces = new HashSet<>();
+ Set<String> createdConnections = new HashSet<>();
int crossConnectFlag = 0;
try {
// if the node is currently mounted then proceed
// Split the string based on # pass the last element as the supported Interface
// This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH
String[] listOfSuppOchInf = supportingOchInterface.split("#");
- createdOchInterfaces = Arrays.asList(listOfSuppOchInf);
+ createdOchInterfaces = Set.of(listOfSuppOchInf);
// Taking the last element
- supportingOchInterface = createdOchInterfaces.get(createdOchInterfaces.size() - 1);
+ supportingOchInterface = listOfSuppOchInf[createdOchInterfaces.size() - 1];
String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
nodeId, destTp, supportingOchInterface, apiInfoA, apiInfoZ);
createdOtuInterfaces.add(supportingOtuInterface);
} else {
// This is needed for 7.1 device models for 400GE, since we have ODUC4 and ODUflex
// are combined
- createdOduInterfaces = Arrays.asList(this.openRoadmInterfaceFactory
+ createdOduInterfaces = Set.of(this.openRoadmInterfaceFactory
.createOpenRoadmOdu4HOInterface(
nodeId, destTp, false, apiInfoA, apiInfoZ, PT_07).split("#"));
}
// Split the string based on # pass the last element as the supported Interface
// This is needed for 7.1 device models with B100G, we have OTSI, OTSI-group combined as OCH
String[] listOfSuppOchInf = supportingOchInterface.split("#");
- createdOchInterfaces = Arrays.asList(listOfSuppOchInf);
+ List<String> tmpCreatedOchInterfaces = Arrays.asList(listOfSuppOchInf);
+ createdOchInterfaces.addAll(tmpCreatedOchInterfaces);
// Taking the last element
- supportingOchInterface = createdOchInterfaces.get(createdOchInterfaces.size() - 1);
+ supportingOchInterface = tmpCreatedOchInterfaces.get(tmpCreatedOchInterfaces.size() - 1);
String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
nodeId, srcTp, supportingOchInterface, apiInfoA, apiInfoZ);
createdOtuInterfaces.add(supportingOtuInterface);
boolean success = true;
Map<FailedToRollbackKey,FailedToRollback> failedToRollbackList = new HashMap<>();
for (NodeInterface nodeInterfaces : input.nonnullNodeInterface().values()) {
- List<String> failedInterfaces = new ArrayList<>();
+ Set<String> failedInterfaces = new HashSet<>();
String nodeId = nodeInterfaces.getNodeId();
for (String connectionId : nodeInterfaces.getConnectionId()) {
List<String> listInter = this.crossConnect.deleteCrossConnect(nodeId, connectionId, false);
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 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.rev200327.OpucnTribSlotDef;
+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;
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
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");
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");
}
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 100:
LOG.info("Input service is 100G");
}
// implement cross connect
- List<String> createdConnections = new ArrayList<>();
+ Set<String> createdConnections = new HashSet<>();
if (createdOduInterfaces.size() == 2) {
- Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
+ 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(
+ .setOduInterfaceId(Set.of(
// though this is odu, actually it has ODUCn interfaces
openRoadmInterfaceFactory.createOpenRoadmOtnOducnInterface(node.getNodeId(),
node.getNetworkTp(), supportingOtuInterface, tgtNode.getNodeId(), tgtNode.getNetworkTp())))
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
String message,
PathDescription pathDescription,
Link notifLink,
- List<String> supportedLinks,
+ Set<String> supportedLinks,
String serviceType) {
send(
buildNotification(servicePathNotificationTypes, serviceName, rpcStatusEx, message,
String message,
PathDescription pathDescription,
Link notifLink,
- List<String> supportedLinks,
+ Set<String> supportedLinks,
String serviceType) {
RendererRpcResultSpBuilder builder =
new RendererRpcResultSpBuilder()
.build();
}
- private List<String> getSupportedLinks(List<String> allSupportLinks, String serviceType) {
+ private Set<String> getSupportedLinks(Set<String> allSupportLinks, String serviceType) {
//TODO a Map might be more indicated here
switch (serviceType) {
case StringConstants.SERVICE_TYPE_10GE:
case StringConstants.SERVICE_TYPE_1GE:
return allSupportLinks.stream()
- .filter(lk -> lk.startsWith(OtnLinkType.ODTU4.getName())).collect(Collectors.toList());
+ .filter(lk -> lk.startsWith(OtnLinkType.ODTU4.getName())).collect(Collectors.toSet());
case StringConstants.SERVICE_TYPE_100GE_M:
return allSupportLinks.stream()
- .filter(lk -> lk.startsWith(OtnLinkType.ODUC4.getName())).collect(Collectors.toList());
+ .filter(lk -> lk.startsWith(OtnLinkType.ODUC4.getName())).collect(Collectors.toSet());
case StringConstants.SERVICE_TYPE_ODU4:
case StringConstants.SERVICE_TYPE_100GE_S:
return allSupportLinks.stream()
- .filter(lk -> lk.startsWith(OtnLinkType.OTU4.getName())).collect(Collectors.toList());
+ .filter(lk -> lk.startsWith(OtnLinkType.OTU4.getName())).collect(Collectors.toSet());
case StringConstants.SERVICE_TYPE_ODUC4:
return allSupportLinks.stream()
- .filter(lk -> lk.startsWith(OtnLinkType.OTUC4.getName())).collect(Collectors.toList());
+ .filter(lk -> lk.startsWith(OtnLinkType.OTUC4.getName())).collect(Collectors.toSet());
default:
return null;
}
.buildFuture();
}
}
- return RpcResultBuilder.success(new ServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();
+ return RpcResultBuilder
+ .success(new ServicePathOutputBuilder().setResult("Invalid operation").build())
+ .buildFuture();
}
@Override
.deleteOtnServicePath(input, serviceType)).buildFuture();
}
}
- return RpcResultBuilder.success(new OtnServicePathOutputBuilder().setResult("Invalid operation")).buildFuture();
+ return RpcResultBuilder
+ .success(new OtnServicePathOutputBuilder().setResult("Invalid operation").build())
+ .buildFuture();
}
/**
*/
package org.opendaylight.transportpce.servicehandler;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
|| softConstraintsBuilder.getCustomerCode().isEmpty()) {
softConstraintsBuilder.setCustomerCode(hardConstraints.getCustomerCode());
} else {
- List<String> updatedCustomerCode = new ArrayList<>(softConstraintsBuilder.getCustomerCode());
+ Set<String> updatedCustomerCode = new HashSet<>(softConstraintsBuilder.getCustomerCode());
updatedCustomerCode.addAll(hardConstraints.getCustomerCode());
softConstraintsBuilder.setCustomerCode(updatedCustomerCode);
}
|| softConstraintsBuilder.getOperationalMode().isEmpty()) {
softConstraintsBuilder.setOperationalMode(hardConstraints.getOperationalMode());
} else {
- List<String> updatedOperationalMode = new ArrayList<>(softConstraintsBuilder.getOperationalMode());
+ Set<String> updatedOperationalMode = new HashSet<>(softConstraintsBuilder.getOperationalMode());
updatedOperationalMode.addAll(hardConstraints.getOperationalMode());
softConstraintsBuilder.setOperationalMode(updatedOperationalMode);
}
} else {
Set<String> fiberList = new HashSet<>(includeBldr.getFiberBundle());
fiberList.addAll(hard.getFiberBundle());
- includeBldr.setFiberBundle(new ArrayList<>(fiberList));
+ includeBldr.setFiberBundle(new HashSet<>(fiberList));
}
}
if (hard.getNodeId() != null && !hard.getNodeId().isEmpty()) {
} else {
Set<NodeIdType> nodeIdList = new HashSet<>(includeBldr.getNodeId());
nodeIdList.addAll(hard.getNodeId());
- includeBldr.setNodeId(new ArrayList<>(nodeIdList));
+ includeBldr.setNodeId(new HashSet<>(nodeIdList));
}
}
if (hard.getSite() != null && !hard.getSite().isEmpty()) {
} else {
Set<String> siteList = new HashSet<>(includeBldr.getSite());
siteList.addAll(hard.getSite());
- includeBldr.setSite(new ArrayList<>(siteList));
+ includeBldr.setSite(new HashSet<>(siteList));
}
}
if (hard.getSrlgId() != null && !hard.getSrlgId().isEmpty()) {
} else {
Set<Uint32> srlgList = new HashSet<>(includeBldr.getSrlgId());
srlgList.addAll(hard.getSrlgId());
- includeBldr.setSrlgId(new ArrayList<>(srlgList));
+ includeBldr.setSrlgId(new HashSet<>(srlgList));
}
}
if (hard.getSupportingServiceName() != null && !hard.getSupportingServiceName().isEmpty()) {
} else {
Set<String> serviceList = new HashSet<>(includeBldr.getSupportingServiceName());
serviceList.addAll(hard.getSupportingServiceName());
- includeBldr.setSupportingServiceName(new ArrayList<>(serviceList));
+ includeBldr.setSupportingServiceName(new HashSet<>(serviceList));
}
}
if (hard.getLinkIdentifier() != null && !hard.getLinkIdentifier().isEmpty()) {
} else {
Set<String> fiberList = new HashSet<>(excludeBldr.getFiberBundle());
fiberList.addAll(hard.getFiberBundle());
- excludeBldr.setFiberBundle(new ArrayList<>(fiberList));
+ excludeBldr.setFiberBundle(new HashSet<>(fiberList));
}
}
if (hard.getNodeId() != null && !hard.getNodeId().isEmpty()) {
} else {
Set<NodeIdType> nodeIdList = new HashSet<>(excludeBldr.getNodeId());
nodeIdList.addAll(hard.getNodeId());
- excludeBldr.setNodeId(new ArrayList<>(nodeIdList));
+ excludeBldr.setNodeId(new HashSet<>(nodeIdList));
}
}
if (hard.getSite() != null && !hard.getSite().isEmpty()) {
} else {
Set<String> siteList = new HashSet<>(excludeBldr.getSite());
siteList.addAll(hard.getSite());
- excludeBldr.setSite(new ArrayList<>(siteList));
+ excludeBldr.setSite(new HashSet<>(siteList));
}
}
if (hard.getSrlgId() != null && !hard.getSrlgId().isEmpty()) {
} else {
Set<Uint32> srlgList = new HashSet<>(excludeBldr.getSrlgId());
srlgList.addAll(hard.getSrlgId());
- excludeBldr.setSrlgId(new ArrayList<>(srlgList));
+ excludeBldr.setSrlgId(new HashSet<>(srlgList));
}
}
if (hard.getSupportingServiceName() != null && !hard.getSupportingServiceName().isEmpty()) {
} else {
Set<String> serviceList = new HashSet<>(excludeBldr.getSupportingServiceName());
serviceList.addAll(hard.getSupportingServiceName());
- excludeBldr.setSupportingServiceName(new ArrayList<>(serviceList));
+ excludeBldr.setSupportingServiceName(new HashSet<>(serviceList));
}
}
if (hard.getLinkIdentifier() != null && !hard.getLinkIdentifier().isEmpty()) {
package org.opendaylight.transportpce.servicehandler.listeners;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
private void updateOtnTopology(RendererRpcResultSp notification, boolean isDeletion) {
Link link = notification.getLink();
- List<String> supportedLinkIds = notification.getLinkId();
- if (link == null && supportedLinkIds == null) {
+ if (link == null && notification.getLinkId() == null) {
return;
}
-
+ List<String> supportedLinkIds = null;
+ if (notification.getLinkId() != null) {
+ supportedLinkIds = new ArrayList<>(notification.getLinkId());
+ }
String serviceType = notification.getServiceType();
switch (serviceType) {
case StringConstants.SERVICE_TYPE_OTU4:
import static org.opendaylight.transportpce.servicehandler.utils.ConstraintsUtils.buildHardConstraint;
import static org.opendaylight.transportpce.servicehandler.utils.ConstraintsUtils.buildSoftConstraint;
-import java.util.Arrays;
-import java.util.List;
+import java.util.Set;
import org.hamcrest.collection.IsMapContaining;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
initialHardConstraints, initialSoftConstraints);
assertNull("updated soft constraints should contain no customer code",
generatedSoftConstraints.getCustomerCode());
- List<String> softCustomerCode = Arrays.asList("soft-customer-code 3", "soft-customer-code 4");
+ Set<String> softCustomerCode = Set.of("soft-customer-code 3", "soft-customer-code 4");
initialSoftConstraints =
buildSoftConstraint(softCustomerCode, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
assertEquals(initialSoftConstraints.getCustomerCode(), generatedSoftConstraints.getCustomerCode());
// test addition of hard customer-code when no soft customer-code
- List<String> hardCustomerCode = Arrays.asList("hard-customer-code 1", "hard-customer-code 2");
+ Set<String> hardCustomerCode = Set.of("hard-customer-code 1", "hard-customer-code 2");
initialHardConstraints =
buildHardConstraint(hardCustomerCode, false, null, null, null, null, false, false, null, null);
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
initialHardConstraints, initialSoftConstraints);
assertNull("updated soft constraints should contain no diversity constraint",
generatedSoftConstraints.getDiversity());
- List<String> softDiversityServiceid = Arrays.asList("soft-service 3");
+ Set<String> softDiversityServiceid = Set.of("soft-service 3");
initialSoftConstraints =
buildSoftConstraint(null, false, softDiversityServiceid, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
assertEquals(initialSoftConstraints.getDiversity(), generatedSoftConstraints.getDiversity());
// test addition of hard diversity when no soft diversity
- List<String> hardDiversityServiceid = Arrays.asList("hard-service 1", "hard-service 2");
+ Set<String> hardDiversityServiceid = Set.of("hard-service 1", "hard-service 2");
initialHardConstraints =
buildHardConstraint(null, false, hardDiversityServiceid, null, null, null, false, false, null, null);
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
assertNull("generated soft constraints should be empty", genSoftConstraints.getCoRouting());
assertNull("generated soft constraints should be empty", genSoftConstraints.getLatency());
- List<String> hardCustomerCode = Arrays.asList("customer-code 1", "customer-code 2");
+ Set<String> hardCustomerCode = Set.of("customer-code 1", "customer-code 2");
initialHardConstraints =
buildHardConstraint(hardCustomerCode, false, null, "link1", "node", null, false, false, null, null);
genSoftConstraints = DowngradeConstraints.convertToSoftConstraints(initialHardConstraints);
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
-import java.util.Arrays;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
.setServiceAEnd(ServiceDataUtils.getServiceAEndBuildReconfigure().build())
.setServiceZEnd(ServiceDataUtils.getServiceZEndBuildReconfigure().build())
.setHardConstraints(new HardConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210
.build())
.build())
.setSoftConstraints(new SoftConstraintsBuilder()
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.setCoRouting(new CoRoutingBuilder()
.setServiceIdentifierList(Map.of(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210
*/
package org.opendaylight.transportpce.servicehandler.utils;
-import java.math.BigDecimal;
-import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.DiversityConstraints.DiversityType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.common.constraints.LinkIdentifier;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraintsBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.service.applicability.g.ServiceApplicabilityBuilder;
+import org.opendaylight.yangtools.yang.common.Decimal64;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
* @param coRoutingServiceId set co-routing constraints
* @return the hard-constraints
*/
- public static SoftConstraints buildSoftConstraint(List<String> customerCode, boolean operationalMode,
- List<String> diversityServiceList, String exclude, String include,
+ public static SoftConstraints buildSoftConstraint(Set<String> customerCode, boolean operationalMode,
+ Set<String> diversityServiceList, String exclude, String include,
Double maxLatency, boolean hopCount, boolean teMetric,
String maxDistance, String coRoutingServiceId) {
* @param coRoutingServiceId set co-routing constraints
* @return the hard-constraints
*/
- public static HardConstraints buildHardConstraint(List<String> customerCode, boolean operationalMode,
- List<String> diversityServiceList, String exclude, String include,
+ public static HardConstraints buildHardConstraint(Set<String> customerCode, boolean operationalMode,
+ Set<String> diversityServiceList, String exclude, String include,
Double maxLatency, boolean hopCount, boolean teMetric,
String maxDistance, String coRoutingServiceId) {
.setCustomerCode(customerCode)
.setOperationalMode(
operationalMode
- ? Arrays.asList("operational-mode 1", "operational-mode 2")
+ ? Set.of("operational-mode 1", "operational-mode 2")
: null)
.setDiversity(
serviceIdList.isEmpty()
.setLatency(
maxLatency == null
? null
- : new LatencyBuilder().setMaxLatency(new BigDecimal(maxLatency)).build())
+ : new LatencyBuilder().setMaxLatency(Decimal64.valueOf(String.valueOf(maxLatency))).build())
.setHopCount(
hopCount
? new HopCountBuilder()
.setDistance(
maxDistance == null
? null
- : new DistanceBuilder().setMaxDistance(new BigDecimal(maxDistance)).build())
+ : new DistanceBuilder().setMaxDistance(Decimal64.valueOf(String.valueOf(maxDistance))).build())
.setCoRouting(
coRoutingServiceId == null || !coRoutingMap.containsKey(coRoutingServiceId)
? null
excludeHashMap.put(
"node",
new ExcludeBuilder()
- .setNodeId(List.of(new NodeIdType("node-id-2")))
+ .setNodeId(Set.of(new NodeIdType("node-id-2")))
.build());
excludeHashMap.put(
"service",
new ExcludeBuilder()
- .setSupportingServiceName(List.of("supported-service-1", "supported-service-5"))
+ .setSupportingServiceName(Set.of("supported-service-1", "supported-service-5"))
.build());
excludeHashMap.put(
"fiber1",
new ExcludeBuilder()
- .setFiberBundle(List.of("fiber-1", "fiber-2"))
+ .setFiberBundle(Set.of("fiber-1", "fiber-2"))
.build());
excludeHashMap.put(
"fiber2",
new ExcludeBuilder()
- .setFiberBundle(List.of("fiber-2", "fiber-3"))
+ .setFiberBundle(Set.of("fiber-2", "fiber-3"))
.build());
LinkIdentifier linkId2 = new LinkIdentifierBuilder()
.setLinkId("link-id 2")
includeHashMap.put(
"node",
new IncludeBuilder()
- .setNodeId(List.of(new NodeIdType("node-id-1"), new NodeIdType("node-id-3")))
+ .setNodeId(Set.of(new NodeIdType("node-id-1"), new NodeIdType("node-id-3")))
.build());
includeHashMap.put(
"service",
new IncludeBuilder()
- .setSupportingServiceName(List.of("supported-service-1", "supported-service-5"))
+ .setSupportingServiceName(Set.of("supported-service-1", "supported-service-5"))
.build());
includeHashMap.put(
"fiber1",
new IncludeBuilder()
- .setFiberBundle(List.of("fiber-1", "fiber-2"))
+ .setFiberBundle(Set.of("fiber-1", "fiber-2"))
.build());
includeHashMap.put(
"fiber2",
new IncludeBuilder()
- .setFiberBundle(List.of("fiber-2", "fiber-3"))
+ .setFiberBundle(Set.of("fiber-2", "fiber-3"))
.build());
LinkIdentifier linkId2 = new LinkIdentifierBuilder()
.setLinkId("link-id 2")
*/
package org.opendaylight.transportpce.servicehandler.validation;
-import java.util.Arrays;
import java.util.Map;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Test;
import org.opendaylight.transportpce.common.OperationResult;
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service")
.build()))
.build())
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.build())
.setSoftConstraints(new SoftConstraintsBuilder()
.setCoRouting(new CoRoutingBuilder()
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service")
.build()))
.build())
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.build()).build();
OperationResult result =
ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service")
.build()))
.build())
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.build()).setHardConstraints(null).build();
OperationResult result =
ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
new ServiceIdentifierListBuilder().setServiceIdentifier("Some existing-service")
.build()))
.build())
- .setCustomerCode(Arrays.asList("Some customer-code"))
+ .setCustomerCode(Set.of("Some customer-code"))
.build()).build();
OperationResult result =
ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.NodesKey;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev170929.Direction;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OrgOpenroadmDeviceData;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.OrgOpenroadmDevice;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.org.openroadm.device.container.org.openroadm.device.Protocols;
import org.opendaylight.yang.gen.v1.http.org.openroadm.lldp.rev161014.Protocols1;
switch (nodeVersion) {
case 1:
// 1.2.1
- InstanceIdentifier<Protocols> protocols121IID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(Protocols.class);
+ InstanceIdentifier<Protocols> protocols121IID = InstanceIdentifier
+ .builderOfInherited(OrgOpenroadmDeviceData.class, OrgOpenroadmDevice.class)
+ .child(Protocols.class)
+ .build();
Optional<Protocols> protocol121Object = this.deviceTransactionManager.getDataFromDevice(
nodeId.getValue(), LogicalDatastoreType.OPERATIONAL, protocols121IID, Timeouts.DEVICE_READ_TIMEOUT,
Timeouts.DEVICE_READ_TIMEOUT_UNIT);
case 2:
// 2.2.1
InstanceIdentifier<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
- .container.org.openroadm.device.Protocols> protocols221IID =
- InstanceIdentifier.create(org.opendaylight.yang.gen.v1.http
- .org.openroadm.device.rev181019.org.openroadm.device.container.OrgOpenroadmDevice.class)
- .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019
- .org.openroadm.device.container.org.openroadm.device.Protocols.class);
+ .container.org.openroadm.device.Protocols> protocols221IID = InstanceIdentifier
+ .builderOfInherited(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.OrgOpenroadmDeviceData.class,
+ org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device.container
+ .OrgOpenroadmDevice.class)
+ .child(org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
+ .container.org.openroadm.device.Protocols.class)
+ .build();
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev181019.org.openroadm.device
.container.org.openroadm.device.Protocols> protocol221Object = this.deviceTransactionManager
.getDataFromDevice(nodeId.getValue(), LogicalDatastoreType.OPERATIONAL, protocols221IID,
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA,
this.tapiLink.getAdminState(nodeId.getValue(), destNodeId.getValue(), srcTpTx, destTpTx),
this.tapiLink.getOperState(nodeId.getValue(), destNodeId.getValue(), srcTpTx, destTpTx),
- List.of(LayerProtocolName.PHOTONICMEDIA), List.of(LayerProtocolName.PHOTONICMEDIA.getName()), tapiTopoUuid);
+ Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), tapiTopoUuid);
LOG.info("Tapi R2R Link OMS link created = {}", omsLink);
return omsLink;
}
Stream<CpToDegree> cpToDegStream = cpToDeg.stream().filter(cp -> cp.getInterfaceName() != null)
.filter(cp -> cp.getInterfaceName().equals(interfaceName));
if (cpToDegStream != null) {
- @SuppressWarnings("unchecked") Optional<CpToDegree> firstCpToDegree = cpToDegStream.findFirst();
+ Optional<CpToDegree> firstCpToDegree = cpToDegStream.findFirst();
if (firstCpToDegree.isEmpty() || (firstCpToDegree == null)) {
LOG.debug("Not found so returning nothing");
return null;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl;
import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl;
-import org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl;
import org.opendaylight.transportpce.tapi.utils.TapiContext;
import org.opendaylight.transportpce.tapi.validation.CreateConnectivityServiceValidation;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.get.connection.end.point.details.output.ConnectionEndPointBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.get.connectivity.service.list.output.Service;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.get.connectivity.service.list.output.ServiceKey;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
private final ConnectivityUtils connectivityUtils;
private TapiPceListenerImpl pceListenerImpl;
private TapiRendererListenerImpl rendererListenerImpl;
- private TapiServiceHandlerListenerImpl serviceHandlerListenerImpl;
public TapiConnectivityImpl(OrgOpenroadmServiceService serviceHandler, TapiContext tapiContext,
ConnectivityUtils connectivityUtils, TapiPceListenerImpl pceListenerImpl,
- TapiRendererListenerImpl rendererListenerImpl,
- TapiServiceHandlerListenerImpl serviceHandlerListenerImpl) {
+ TapiRendererListenerImpl rendererListenerImpl) {
LOG.info("inside TapiImpl constructor");
this.serviceHandler = serviceHandler;
this.tapiContext = tapiContext;
this.connectivityUtils = connectivityUtils;
this.pceListenerImpl = pceListenerImpl;
this.rendererListenerImpl = rendererListenerImpl;
- this.serviceHandlerListenerImpl = serviceHandlerListenerImpl;
}
@Override
Map<ServiceInterfacePointKey, ServiceInterfacePoint> sipMap = this.tapiContext.getTapiContext()
.getServiceInterfacePoint();
if (sipMap == null) {
- return RpcResultBuilder.<CreateConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "SIP list is empty").buildFuture();
+ return RpcResultBuilder.<CreateConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "SIP list is empty")
+ .buildFuture();
}
if (sipMap.containsKey(new ServiceInterfacePointKey(input.getEndPoint().values().stream().findFirst().get()
.getServiceInterfacePoint().getServiceInterfacePointUuid()))
// TODO: differentiate between OTN service and GbE service in TAPI
ServiceCreateInput sci = this.connectivityUtils.createORServiceInput(input, serviceUuid);
if (sci == null) {
- return RpcResultBuilder.<CreateConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "Couldnt map Service create input").buildFuture();
+ return RpcResultBuilder.<CreateConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Couldnt map Service create input")
+ .buildFuture();
}
LOG.info("Service Create input = {}", sci);
output = this.serviceHandler.serviceCreate(sci);
if (!output.isDone()) {
- return RpcResultBuilder.<CreateConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "Service create RPC failed").buildFuture();
+ return RpcResultBuilder.<CreateConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Service create RPC failed")
+ .buildFuture();
}
} else {
LOG.error("Unknown UUID");
- return RpcResultBuilder.<CreateConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "SIPs do not exist in tapi context").buildFuture();
+ return RpcResultBuilder.<CreateConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "SIPs do not exist in tapi context")
+ .buildFuture();
}
}
try {
if (output == null) {
- return RpcResultBuilder.<CreateConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to create service").buildFuture();
+ return RpcResultBuilder.<CreateConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Failed to create service")
+ .buildFuture();
}
LOG.info("Service create request was successful");
if (output.get().getResult().getConfigurationResponseCommon().getResponseCode()
.equals(ResponseCodes.RESPONSE_FAILED)) {
- return RpcResultBuilder.<CreateConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to create service").buildFuture();
+ return RpcResultBuilder.<CreateConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Failed to create service")
+ .buildFuture();
}
LOG.info("Output of service request = {}", output.get().getResult());
} catch (InterruptedException | ExecutionException e) {
ConnectivityService service = this.tapiContext.getConnectivityService(serviceUuid);
if (service == null) {
LOG.error("Service {} doesnt exist in tapi context", input.getServiceIdOrName());
- return RpcResultBuilder.<GetConnectivityServiceDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "Service doesnt exist in datastore").buildFuture();
+ return RpcResultBuilder.<GetConnectivityServiceDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Service doesnt exist in datastore")
+ .buildFuture();
}
return RpcResultBuilder.success(new GetConnectivityServiceDetailsOutputBuilder().setService(
new org.opendaylight.yang.gen.v1.urn
Connection connection = this.tapiContext.getConnection(connectionUuid);
if (connection == null) {
LOG.error("Connection {} doesnt exist in tapi context", input.getConnectionIdOrName());
- return RpcResultBuilder.<GetConnectionDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "Connection doesnt exist in datastore").buildFuture();
+ return RpcResultBuilder.<GetConnectionDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Connection doesnt exist in datastore")
+ .buildFuture();
}
return RpcResultBuilder.success(new GetConnectionDetailsOutputBuilder().setConnection(
new ConnectionBuilder(connection).build()).build()).buildFuture();
LOG.error("Failed to delete service.", e);
}
}
- return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to delete Service").buildFuture();
+ return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Failed to delete Service")
+ .buildFuture();
}
@Override
Map<ConnectivityServiceKey, ConnectivityService> connMap = this.tapiContext.getConnectivityServices();
if (connMap == null) {
LOG.error("No services in tapi context");
- return RpcResultBuilder.<GetConnectivityServiceListOutput>failed().withError(RpcError.ErrorType.RPC,
- "No services exist in datastore").buildFuture();
+ return RpcResultBuilder.<GetConnectivityServiceListOutput>failed()
+ .withError(ErrorType.RPC, "No services exist in datastore")
+ .buildFuture();
}
Map<ServiceKey, Service> serviceMap = new HashMap<>();
ConnectionEndPoint cep = this.tapiContext.getTapiCEP(topoUuid, nodeUuid, nepUuid, cepUuid);
if (cep == null) {
LOG.error("Cep doesnt exist in tapi context");
- return RpcResultBuilder.<GetConnectionEndPointDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "No cep with given Uuid exists in datastore").buildFuture();
+ return RpcResultBuilder.<GetConnectionEndPointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "No cep with given Uuid exists in datastore")
+ .buildFuture();
}
return RpcResultBuilder.success(new GetConnectionEndPointDetailsOutputBuilder().setConnectionEndPoint(
new ConnectionEndPointBuilder(cep).build()).build()).buildFuture();
tapiInitialORMapping.performServInitialMapping();
TapiConnectivityImpl tapi = new TapiConnectivityImpl(this.serviceHandler, tapiContext, connectivityUtils,
- pceListenerImpl, rendererListenerImpl, serviceHandlerListenerImpl);
+ pceListenerImpl, rendererListenerImpl);
TapiTopologyImpl topo = new TapiTopologyImpl(this.dataBroker, tapiContext, topologyUtils, tapiLink);
rpcRegistration = rpcProviderService.registerRpcImplementation(TapiConnectivityService.class, tapi);
rpcProviderService.registerRpcImplementation(TapiTopologyService.class, topo);
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
String.join("+", this.ietfNodeId, TapiStringConstants.DSR)).build();
Name nameNodeType = new NameBuilder().setValueName("Node Type")
.setValue(this.ietfNodeType.getName()).build();
- List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU);
+ Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node dsrNode = createTapiNode(Map.of(nameDsrNode.key(), nameDsrNode, nameNodeType.key(), nameNodeType),
dsrLayerProtocols);
this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI), nodeUuid);
Name nameOtsiNode = new NameBuilder().setValueName("otsi node name").setValue(
String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)).build();
- List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+ Set<LayerProtocolName> otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node otsiNode = createTapiNode(Map.of(nameOtsiNode.key(), nameOtsiNode, nameNodeType.key(), nameNodeType),
otsiLayerProtocols);
link.getDestination().getDestNode().getValue().split("-")[1]),
link.getDestination().getDestTp().getValue(), TapiStringConstants.OMS_RDM_RDM_LINK,
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA,
- TapiStringConstants.PHTNC_MEDIA, adminState, operState, List.of(LayerProtocolName.PHOTONICMEDIA),
- List.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid);
+ TapiStringConstants.PHTNC_MEDIA, adminState, operState, Set.of(LayerProtocolName.PHOTONICMEDIA),
+ Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid);
linksToNotConvert.add(link
.augmentation(Link1.class)
.getOppositeLink().getValue());
Name nameNodeType = new NameBuilder().setValueName("Node Type")
.setValue(this.ietfNodeType.getName()).build();
// Protocol Layer
- List<LayerProtocolName> layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+ Set<LayerProtocolName> layerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
// Build tapi node
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node roadmNode = createRoadmTapiNode(nodeUuid,
TpId tpid2 = new TpId(tp.augmentation(
org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class)
.getAssociatedConnectionMapPort());
- List<TpId> tpList = new ArrayList<>();
+ Set<TpId> tpList = new HashSet<>();
tpList.add(tpid1);
tpList.add(tpid2);
NonBlockingList nbl = new NonBlockingListBuilder()
}
private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
+ createTapiNode(Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
Uuid nodeUuid = null;
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
}
private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
- createRoadmTapiNode(Uuid nodeUuid, Map<NameKey, Name> nameMap, List<LayerProtocolName> layerProtocols,
+ createRoadmTapiNode(Uuid nodeUuid, Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> oneplist) {
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.build();
RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
.setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
.setUuid(new Uuid(
.build();
RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
.setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
.setUuid(new Uuid(UUID.nameUUIDFromBytes(("dsr node rule group " + count)
.getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
TapiStringConstants.MC, tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName1.key(), nepName1))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
.toString()))
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName2.key(), nepName2))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL)
.setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
.build();
}
- private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(TerminationPoint tp,
+ private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(TerminationPoint tp,
LayerProtocolName lpn) {
Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
- List<SupportedInterfaceCapability> sicList;
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1 tp1 =
tp.augmentation(org.opendaylight.yang.gen.v1.http
.org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class);
if (tp1 == null) {
- return new ArrayList<>(sclpqSet);
+ return new HashSet<>(sclpqSet);
}
if (tp1.getTpSupportedInterfaces() == null) {
LOG.warn("Tp supported interface doesnt exist on TP {}", tp.getTpId().getValue());
- return new ArrayList<>(sclpqSet);
+ return new HashSet<>(sclpqSet);
}
- sicList = new ArrayList<>(tp1.getTpSupportedInterfaces().getSupportedInterfaceCapability().values());
+ Collection<SupportedInterfaceCapability> sicList = tp1.getTpSupportedInterfaces()
+ .getSupportedInterfaceCapability().values();
for (SupportedInterfaceCapability sic : sicList) {
switch (lpn.getName()) {
case "DSR":
break;
}
}
- return new ArrayList<>(sclpqSet);
+ return sclpqSet;
}
private void createTapiTransitionalLinks() {
Link transiLink = tapiLink.createTapiLink(this.ietfNodeId, tp.getTpId().getValue(), this.ietfNodeId,
tp.getTpId().getValue(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR,
TapiStringConstants.OTSI, TapiStringConstants.I_ODU, TapiStringConstants.I_OTSI,
- "inService", "inService", Arrays.asList(LayerProtocolName.ODU,
- LayerProtocolName.PHOTONICMEDIA),
- Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
+ "inService", "inService", Set.of(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA),
+ Set.of(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
this.tapiTopoUuid);
this.tapiLinks.put(transiLink.key(), transiLink);
}
Link tapLink = this.tapiLink.createTapiLink(sourceNode, sourceTp, destNode, destTp,
TapiStringConstants.OMS_XPDR_RDM_LINK, sourceNodeQual, destNodeQual,
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA, adminState,
- operState, List.of(LayerProtocolName.PHOTONICMEDIA),
- List.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid);
+ operState, Set.of(LayerProtocolName.PHOTONICMEDIA),
+ Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), this.tapiTopoUuid);
linksToNotConvert.add(link.augmentation(Link1.class).getOppositeLink().getValue());
this.tapiLinks.put(tapLink.key(), tapLink);
}
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
.setValue(String.join("+", this.ietfNodeId, TapiStringConstants.DSR)).build();
Name nameNodeType = new NameBuilder().setValueName("Node Type")
.setValue(this.ietfNodeType.getName()).build();
- List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU);
+ Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr, nameNodeType.key(), nameNodeType),
dsrLayerProtocols);
this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI), nodeUuid);
Name nameOtsi = new NameBuilder().setValueName("otsi node name")
.setValue(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)).build();
- List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+ Set<LayerProtocolName> otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology
.Node otsiNode = createTapiNode(Map.of(nameOtsi.key(), nameOtsi, nameNodeType.key(), nameNodeType),
otsiLayerProtocols);
Link tapLink = this.tapiLink.createTapiLink(otnlink.getSource().getSourceNode().getValue(),
otnlink.getSource().getSourceTp().getValue(), otnlink.getDestination().getDestNode().getValue(),
otnlink.getDestination().getDestTp().getValue(), TapiStringConstants.OTN_XPDR_XPDR_LINK, nodesQual,
- nodesQual, tpsQual, tpsQual, adminState, operState, List.of(layerProtocolName),
- List.of(layerProtocolName.getName()), this.tapiTopoUuid);
+ nodesQual, tpsQual, tpsQual, adminState, operState, Set.of(layerProtocolName),
+ Set.of(layerProtocolName.getName()), this.tapiTopoUuid);
linksToNotConvert.add(oppositeLinkId);
tapiLinks.put(tapLink.key(), tapLink);
}
.build();
Name nameNodeType = new NameBuilder().setValueName("Node Type")
.setValue(OpenroadmNodeType.ROADM.getName()).build();
- List<LayerProtocolName> nodeLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+ Set<LayerProtocolName> nodeLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
= pruneTapiPhotonicNodes();
TpId tpid2 = new TpId(tp.augmentation(
org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class)
.getAssociatedConnectionMapPort());
- List<TpId> tpList = new ArrayList<>();
+ Set<TpId> tpList = new HashSet<>();
tpList.add(tpid1);
tpList.add(tpid2);
NonBlockingList nbl = new NonBlockingListBuilder()
prunedTapiPhotonicNodes = new ArrayList<>();
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node> tapiPhotonicNodes
= this.tapiNodes.values().stream()
- .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().get(0)))
+ .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().stream().findFirst().get()))
.collect(Collectors.toList());
for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node
: tapiPhotonicNodes) {
}
private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node
- createTapiNode(Map<NameKey, Name> nodeNames, List<LayerProtocolName> layerProtocols) {
+ createTapiNode(Map<NameKey, Name> nodeNames, Set<LayerProtocolName> layerProtocols) {
Uuid nodeUuid = null;
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
Map<NodeRuleGroupKey, NodeRuleGroup> nodeRuleGroupList = new HashMap<>();
.setUuid(nepUuid)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
return msipl;
}
- private List<Class<? extends LAYERPROTOCOLQUALIFIER>>
+ private Set<Class<? extends LAYERPROTOCOLQUALIFIER>>
createSupportedCepLayerProtocolQualifier(TerminationPoint tp, LayerProtocolName lpn) {
Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqSet = new HashSet<>();
- List<SupportedInterfaceCapability> sicList = new ArrayList<>(
- tp.augmentation(org.opendaylight.yang.gen.v1.http
- .org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class).getTpSupportedInterfaces()
- .getSupportedInterfaceCapability().values());
+ Collection<SupportedInterfaceCapability> sicList = tp.augmentation(
+ org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class)
+ .getTpSupportedInterfaces()
+ .getSupportedInterfaceCapability().values();
for (SupportedInterfaceCapability sic : sicList) {
switch (lpn.getName()) {
case "DSR":
break;
}
}
- return new ArrayList<>(sclpqSet);
+ return sclpqSet;
}
private void createTapiTransitionalLinks() {
Link transiLink = tapiLink.createTapiLink(this.ietfNodeId, tp.getTpId().getValue(), this.ietfNodeId,
tp.getTpId().getValue(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR,
TapiStringConstants.OTSI, TapiStringConstants.I_ODU, TapiStringConstants.I_OTSI,
- "inService", "inService", Arrays.asList(LayerProtocolName.ODU,
- LayerProtocolName.PHOTONICMEDIA),
- Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
+ "inService", "inService", Set.of(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA),
+ Set.of(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
this.tapiTopoUuid);
this.tapiLinks.put(transiLink.key(), transiLink);
}
.getBytes(Charset.forName("UTF-8")))
.toString()))
.setName(Map.of(linkName.key(), linkName))
- .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA))
+ .setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA))
.setNodeEdgePoint(nepMap)
.setDirection(ForwardingDirection.BIDIRECTIONAL)
.build();
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
String.join("+", nodeId, TapiStringConstants.DSR)).build();
Name nameNodeType = new NameBuilder().setValueName("Node Type")
.setValue(getNodeType(xponderType)).build();
- List<LayerProtocolName> dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR,
- LayerProtocolName.ODU);
+ Set<LayerProtocolName> dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU);
Node dsrNode = createTapiXpdrNode(Map.of(nameDsr.key(), nameDsr, nameNodeType.key(), nameNodeType),
dsrLayerProtocols, nodeId, nodeUuidDsr, xpdrClMaps, xpdrNetMaps, xponderType, oorOduSwitchingPool);
.getBytes(Charset.forName("UTF-8"))).toString());
Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue(
String.join("+", nodeId, TapiStringConstants.OTSI)).build();
- List<LayerProtocolName> otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+ Set<LayerProtocolName> otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
Node otsiNode = createTapiXpdrNode(Map.of(nameOtsi.key(), nameOtsi, nameNodeType.key(), nameNodeType),
otsiLayerProtocols, nodeId, nodeUuidOtsi, xpdrClMaps, xpdrNetMaps, xponderType, null);
}
}
- private Node createTapiXpdrNode(Map<NameKey, Name> nameMap, List<LayerProtocolName> layerProtocols,
+ private Node createTapiXpdrNode(Map<NameKey, Name> nameMap, Set<LayerProtocolName> layerProtocols,
String nodeId, Uuid nodeUuid, List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
XpdrNodeTypes xponderType, OduSwitchingPools oorOduSwitchingPool) {
Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepl = new HashMap<>();
.build();
List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- xpdrNetMaps.get(i).getSupportedInterfaceCapability();
+ new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid1, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
.build();
List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- xpdrNetMaps.get(i).getSupportedInterfaceCapability();
+ new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid2, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
.build();
List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- xpdrNetMaps.get(i).getSupportedInterfaceCapability();
+ new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid3, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA,
}
List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- xpdrClMaps.get(i).getSupportedInterfaceCapability();
+ new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
Map.of(name.key(), name), LayerProtocolName.DSR, LayerProtocolName.DSR, true,
.build();
List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- xpdrNetMaps.get(i).getSupportedInterfaceCapability();
+ new ArrayList<>(xpdrNetMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrNetMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName),
.build();
List<Class<? extends SupportedIfCapability>> newSupIfCapList =
- xpdrClMaps.get(i).getSupportedInterfaceCapability();
+ new ArrayList<>(xpdrClMaps.get(i).getSupportedInterfaceCapability());
OwnedNodeEdgePoint onep = createNep(nepUuid, xpdrClMaps.get(i).getLogicalConnectionPoint(),
Map.of(onedName.key(), onedName),
.setUuid(nepUuid)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName.key(), nepName))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setUuid(nepUuid1)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName1.key(), nepName1))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
.setUuid(nepUuid2)
.setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
.setName(Map.of(nepName2.key(), nepName2))
- .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class))
+ .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class))
.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC)
.setAdministrativeState(adminState).setOperationalState(operState)
.setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL)
Name nameNodeType = new NameBuilder().setValueName("Node Type")
.setValue(OpenroadmNodeType.ROADM.getName()).build();
// Protocol Layer
- List<LayerProtocolName> layerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA);
+ Set<LayerProtocolName> layerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA);
// Empty random creation of mandatory fields for avoiding errors....
CostCharacteristic costCharacteristic = new CostCharacteristicBuilder()
.setCostAlgorithm("Restricted Shortest Path - RSP")
Link transiLink = tapiLink.createTapiLink(nodeId, mapping.getLogicalConnectionPoint(), nodeId,
mapping.getLogicalConnectionPoint(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR,
TapiStringConstants.OTSI, TapiStringConstants.I_ODU, TapiStringConstants.I_OTSI,
- "inService", "inService", Arrays.asList(LayerProtocolName.ODU,
- LayerProtocolName.PHOTONICMEDIA),
- Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
+ "inService", "inService", Set.of(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA),
+ Set.of(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()),
this.tapiTopoUuid);
linkMap.put(transiLink.key(), transiLink);
}
LOG.info("XPDr net associated LCP = {}", xpdrNetMaps.get(i - 1).getConnectionMapLcp());
TpId tpid1 = new TpId(xpdrNetMaps.get(i - 1).getLogicalConnectionPoint());
TpId tpid2 = new TpId(xpdrNetMaps.get(i - 1).getConnectionMapLcp());
- List<TpId> tpList = new ArrayList<>();
+ Set<TpId> tpList = new HashSet<>();
tpList.add(tpid1);
tpList.add(tpid2);
NonBlockingList nbl = new NonBlockingListBuilder()
private OduSwitchingPools createSwtchSwitchPool(List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps,
Integer xpdrNb) {
- List<TpId> tpl = new ArrayList<>();
+ Set<TpId> tpl = new HashSet<>();
TpId tpId = null;
for (int i = 1; i <= xpdrClMaps.size(); i++) {
tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i);
private OduSwitchingPools createMuxSwitchPool(List<Mapping> xpdrClMaps, List<Mapping> xpdrNetMaps, Integer xpdrNb) {
Map<NonBlockingListKey, NonBlockingList> nbMap = new HashMap<>();
for (int i = 1; i <= xpdrClMaps.size(); i++) {
- List<TpId> tpList = new ArrayList<>();
+ Set<TpId> tpList = new HashSet<>();
TpId tpId = new TpId("XPDR" + xpdrNb + TapiStringConstants.CLIENT + i);
tpList.add(tpId);
tpId = new TpId("XPDR" + xpdrNb + "-NETWORK1");
.build();
RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
.setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
.setUuid(new Uuid(
.build();
RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
.setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder()
.setUuid(new Uuid(
return nodeRuleGroupMap;
}
- private List<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(
+ private Set<Class<? extends LAYERPROTOCOLQUALIFIER>> createSupportedLayerProtocolQualifier(
List<Class<? extends SupportedIfCapability>> sicList, LayerProtocolName lpn) {
if (sicList == null) {
- return List.of(PHOTONICLAYERQUALIFIEROMS.class);
+ return Set.of(PHOTONICLAYERQUALIFIEROMS.class);
}
Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
LOG.info("SIC list = {}", sicList);
.build();
supIfMap.put(supIfCapa.key(), supIfCapa);
}
- List<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new ArrayList<>();
+ Set<Class<? extends LAYERPROTOCOLQUALIFIER>> sclpqList = new HashSet<>();
for (SupportedInterfaceCapability sic : supIfMap.values()) {
switch (lpn.getName()) {
case "DSR":
import com.google.common.util.concurrent.ListenableFuture;
import java.nio.charset.Charset;
-import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.TopologyBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.TopologyKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA,
this.tapiLink.getAdminState(sourceNode, sourceTp, destNode, destTp),
this.tapiLink.getOperState(sourceNode, sourceTp, destNode, destTp),
- List.of(LayerProtocolName.PHOTONICMEDIA), List.of(LayerProtocolName.PHOTONICMEDIA.getName()), tapiTopoUuid);
+ Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), tapiTopoUuid);
InitRoadmRoadmTapiLinkOutputBuilder output = new InitRoadmRoadmTapiLinkOutputBuilder();
if (link == null) {
LOG.error("Error creating link object");
- return RpcResultBuilder.<InitRoadmRoadmTapiLinkOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to create link in topology").buildFuture();
+ return RpcResultBuilder.<InitRoadmRoadmTapiLinkOutput>failed()
+ .withError(ErrorType.RPC, "Failed to create link in topology")
+ .buildFuture();
}
if (putLinkInTopology(link)) {
output = new InitRoadmRoadmTapiLinkOutputBuilder()
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA,
this.tapiLink.getAdminState(sourceNode, sourceTp, destNode, destTp),
this.tapiLink.getOperState(sourceNode, sourceTp, destNode, destTp),
- List.of(LayerProtocolName.PHOTONICMEDIA), List.of(LayerProtocolName.PHOTONICMEDIA.getName()), tapiTopoUuid);
+ Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()), tapiTopoUuid);
InitXpdrRdmTapiLinkOutputBuilder output = new InitXpdrRdmTapiLinkOutputBuilder();
if (link == null) {
LOG.error("Error creating link object");
- return RpcResultBuilder.<InitXpdrRdmTapiLinkOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to create link in topology").buildFuture();
+ return RpcResultBuilder.<InitXpdrRdmTapiLinkOutput>failed()
+ .withError(ErrorType.RPC, "Failed to create link in topology")
+ .buildFuture();
}
if (putLinkInTopology(link)) {
output = new InitXpdrRdmTapiLinkOutputBuilder()
.setResult("Link successfully deleted from tapi topology").build()).buildFuture();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to delete TAPI link", e);
- return RpcResultBuilder.<DeleteTapiLinkOutput>failed().withError(RpcError.ErrorType.RPC,
- "Failed to delete link from topology").buildFuture();
+ return RpcResultBuilder.<DeleteTapiLinkOutput>failed()
+ .withError(ErrorType.RPC, "Failed to delete link from topology")
+ .buildFuture();
}
}
import java.nio.charset.Charset;
import java.util.Collection;
-import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.eclipse.jdt.annotation.NonNull;
TapiStringConstants.OMS_XPDR_RDM_LINK, getQual(srcNode), getQual(destNode),
TapiStringConstants.PHTNC_MEDIA, TapiStringConstants.PHTNC_MEDIA,
link1.getAdministrativeState().getName(), link1.getOperationalState().getName(),
- List.of(LayerProtocolName.PHOTONICMEDIA), List.of(LayerProtocolName.PHOTONICMEDIA.getName()),
+ Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()),
tapiTopoUuid));
}
}
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.TopologyKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
.getTapiNode(topoUuid, nodeUuid);
if (node == null) {
LOG.error("Invalid TAPI node name");
- return RpcResultBuilder.<GetNodeDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "Invalid Tapi Node name").buildFuture();
+ return RpcResultBuilder.<GetNodeDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Invalid Tapi Node name")
+ .buildFuture();
}
return RpcResultBuilder.success(new GetNodeDetailsOutputBuilder()
.setNode(new org.opendaylight.yang.gen.v1.urn
if (!(topologyMap != null && topologyMap.containsKey(new TopologyKey(topoUuid)))) {
LOG.error("Topology {} not found in datastore", input.getTopologyIdOrName());
return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
- .withError(RpcError.ErrorType.RPC, "Invalid Topology name").buildFuture();
+ .withError(ErrorType.RPC, "Invalid Topology name")
+ .buildFuture();
}
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.Topology
topology = topologyMap.get(new TopologyKey(topoUuid));
}
LOG.error("Invalid TAPI topology name");
return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
- .withError(RpcError.ErrorType.RPC, "Invalid Topology name").buildFuture();
+ .withError(ErrorType.RPC, "Invalid Topology name")
+ .buildFuture();
}
try {
LOG.info("Building TAPI Topology abstraction for {}", input.getTopologyIdOrName());
} catch (TapiTopologyException e) {
LOG.error("error building TAPI topology");
return RpcResultBuilder.<GetTopologyDetailsOutput>failed()
- .withError(RpcError.ErrorType.RPC, "Error building topology").buildFuture();
+ .withError(ErrorType.RPC, "Error building topology")
+ .buildFuture();
}
}
OwnedNodeEdgePoint nep = this.tapiContext.getTapiNEP(topoUuid, nodeUuid, nepUuid);
if (nep == null) {
LOG.error("Invalid TAPI nep name");
- return RpcResultBuilder.<GetNodeEdgePointDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "Invalid NEP name").buildFuture();
+ return RpcResultBuilder.<GetNodeEdgePointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Invalid NEP name")
+ .buildFuture();
}
return RpcResultBuilder.success(new GetNodeEdgePointDetailsOutputBuilder()
.setNodeEdgePoint(new NodeEdgePointBuilder(nep).build()).build()).buildFuture();
.getTapiLink(topoUuid, linkUuid);
if (link == null) {
LOG.error("Invalid TAPI link name");
- return RpcResultBuilder.<GetLinkDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "Invalid Link name").buildFuture();
+ return RpcResultBuilder.<GetLinkDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Invalid Link name")
+ .buildFuture();
}
return RpcResultBuilder.success(new GetLinkDetailsOutputBuilder().setLink(new LinkBuilder(link).build())
.build()).buildFuture();
topologyMap = this.tapiContext.getTopologyContext();
if (topologyMap.isEmpty()) {
LOG.error("No topologies exist in tapi context");
- return RpcResultBuilder.<GetTopologyListOutput>failed().withError(RpcError.ErrorType.APPLICATION,
- "No topologies exist in tapi context").buildFuture();
+ return RpcResultBuilder.<GetTopologyListOutput>failed()
+ .withError(ErrorType.APPLICATION, "No topologies exist in tapi context")
+ .buildFuture();
}
Map<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.get.topology.list.output.TopologyKey,
org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.get.topology.list.output.Topology>
return new NodeBuilder()
.setUuid(nodeUuid)
.setName(Map.of(name.key(), name))
- .setLayerProtocolName(List.of(LayerProtocolName.ETH))
+ .setLayerProtocolName(Set.of(LayerProtocolName.ETH))
.setAdministrativeState(AdministrativeState.UNLOCKED)
.setOperationalState(OperationalState.ENABLED)
.setLifecycleState(LifecycleState.INSTALLED)
Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips =
this.tapiContext.getTapiContext().getServiceInterfacePoint();
if (sips == null || sips.isEmpty()) {
- return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "No sips in datastore").buildFuture();
+ return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "No sips in datastore")
+ .buildFuture();
}
if (!sips.containsKey(new ServiceInterfacePointKey(sipUuid))) {
- return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed().withError(RpcError.ErrorType.RPC,
- "Sip doesnt exist in datastore").buildFuture();
+ return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Sip doesnt exist in datastore")
+ .buildFuture();
}
org.opendaylight.yang.gen.v1.urn
.onf.otcc.yang.tapi.common.rev181210.get.service._interface.point.details.output.Sip outSip =
Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips =
this.tapiContext.getTapiContext().getServiceInterfacePoint();
if (sips == null || sips.isEmpty()) {
- return RpcResultBuilder.<GetServiceInterfacePointListOutput>failed().withError(RpcError.ErrorType.RPC,
- "No sips in datastore").buildFuture();
+ return RpcResultBuilder.<GetServiceInterfacePointListOutput>failed()
+ .withError(ErrorType.RPC, "No sips in datastore")
+ .buildFuture();
}
Map<SipKey, Sip> outSipMap = new HashMap<>();
for (ServiceInterfacePoint sip : sips.values()) {
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
.setName(Map.of(name.key(), name))
.setUuid(topoUuid)
.setNode(tapiNodeList)
- .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
+ .setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
LayerProtocolName.DSR))
.setLink(tapiLinkList).build();
}
return new TopologyBuilder()
.setName(Map.of(name.key(), name))
.setUuid(topoUuid)
- .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
+ .setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU,
LayerProtocolName.DSR))
.build();
}
import java.nio.charset.Charset;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
public Link createTapiLink(String srcNodeid, String srcTpId, String dstNodeId, String dstTpId, String linkType,
String srcNodeQual, String dstNodeQual, String srcTpQual, String dstTpQual,
- String adminState, String operState, List<LayerProtocolName> layerProtoNameList,
- List<String> transLayerNameList, Uuid tapiTopoUuid) {
+ String adminState, String operState, Set<LayerProtocolName> layerProtoNameList,
+ Set<String> transLayerNameList, Uuid tapiTopoUuid) {
Map<NodeEdgePointKey, NodeEdgePoint> nepList = new HashMap<>();
String sourceNodeKey = String.join("+", srcNodeid, srcNodeQual);
String sourceNepKey = String.join("+", srcNodeid, srcTpQual, srcTpId);
.build();
RiskCharacteristic riskCharacteristic = new RiskCharacteristicBuilder()
.setRiskCharacteristicName("risk characteristic")
- .setRiskIdentifierList(List.of("risk identifier1", "risk identifier2"))
+ .setRiskIdentifierList(Set.of("risk identifier1", "risk identifier2"))
.build();
ValidationMechanism validationMechanism = new ValidationMechanismBuilder()
.setValidationMechanism("validation mechanism")
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInput;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceInputBuilder;
import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.DeleteConnectivityServiceOutput;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(new CreateConnectivityServiceInputBuilder().build());
endSignal.await();
RpcResult<CreateConnectivityServiceOutput> rpcResult = result.get();
- Assert.assertEquals(
- RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
}
@Test
Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<CreateConnectivityServiceOutput>> result =
tapiConnectivity.createConnectivityService(input);
result.addListener(new Runnable() {
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(new DeleteConnectivityServiceInputBuilder().build());
endSignal.await();
RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
- Assert.assertEquals(
- RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
}
@Test
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ListenableFuture<RpcResult<DeleteConnectivityServiceOutput>> result =
tapiConnectivity.deleteConnectivityService(input);
result.addListener(new Runnable() {
endSignal.await();
RpcResult<DeleteConnectivityServiceOutput> rpcResult = result.get();
- Assert.assertEquals(
- RpcError.ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
+ Assert.assertEquals(ErrorType.RPC, rpcResult.getErrors().get(0).getErrorType());
}
@Test
networkModelListenerImpl, serviceDataStoreOperations);
TapiConnectivityImpl tapiConnectivity = new TapiConnectivityImpl(serviceHandler, tapiContext, connectivityUtils,
- tapipceListenerImpl, tapirendererListenerImpl, tapiserviceHandlerListenerImpl);
+ tapipceListenerImpl, tapirendererListenerImpl);
ServiceCreateInput createInput = TapiConnectivityDataUtils.buildServiceCreateInput();
serviceDataStoreOperations.createService(createInput);
assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
1, node.getLayerProtocolName().size());
assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
+ LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().stream().findFirst().get());
switch (otsiNodeType) {
case "switch":
new NameKey("OMS link name")).getValue());
assertEquals("bad uuid for link", linkUuid, link.getUuid());
assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.PHOTONICMEDIA.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
assertEquals("otn tapi link should be BIDIRECTIONAL",
ForwardingDirection.BIDIRECTIONAL, link.getDirection());
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
new NameKey("XPDR-RDM link name")).getValue());
assertEquals("bad uuid for link", linkUuid, link.getUuid());
assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.PHOTONICMEDIA.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
assertEquals("otn tapi link should be BIDIRECTIONAL",
ForwardingDirection.BIDIRECTIONAL, link.getDirection());
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
1, node.getLayerProtocolName().size());
assertEquals("otsi node should manage a single protocol layer : PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA, node.getLayerProtocolName().get(0));
+ LayerProtocolName.PHOTONICMEDIA,
+ node.getLayerProtocolName().stream().findFirst().get());
List<OwnedNodeEdgePoint> nepsI = node.nonnullOwnedNodeEdgePoint().values().stream()
.filter(n -> n.getName().containsKey(new NameKey("iNodeEdgePoint")))
.sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
if ("OTU4".equals(prefix)) {
assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.PHOTONICMEDIA.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
} else if ("ODTU4".equals(prefix)) {
assertEquals("otn link should be between 2 nodes of protocol layers ODU",
- LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.ODU.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
}
assertEquals("otn tapi link should be BIDIRECTIONAL",
ForwardingDirection.BIDIRECTIONAL, link.getDirection());
assertEquals("bad name for the link", linkName, link.getName().get(new NameKey("OMS link name")).getValue());
assertEquals("bad uuid for link", linkUuid, link.getUuid());
assertEquals("oms link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.PHOTONICMEDIA.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
assertEquals("otn tapi link should be BIDIRECTIONAL",
ForwardingDirection.BIDIRECTIONAL, link.getDirection());
List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210
Uint64.valueOf(100), link.getTotalPotentialCapacity().getTotalSize().getValue());
if ("OTU4".equals(prefix)) {
assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA",
- LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.PHOTONICMEDIA.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
} else if ("ODTU4".equals(prefix)) {
assertEquals("otn link should be between 2 nodes of protocol layers ODU",
- LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName());
+ LayerProtocolName.ODU.getName(),
+ link.getLayerProtocolName().stream().findFirst().get().getName());
}
assertEquals("transitional link should be BIDIRECTIONAL",
ForwardingDirection.BIDIRECTIONAL, link.getDirection());
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.MoreExecutors;
-import java.util.LinkedList;
-import java.util.List;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+import java.util.HashSet;
import java.util.Map;
import java.util.ServiceLoader;
+import java.util.Set;
import java.util.concurrent.Executors;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
private BindingDOMCodecServices bindingDOMCodecServices;
private BindingAdapterFactory adapterFactory ;
-
+ @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR")
public DataStoreContextImpl() {
- List<YangModuleInfo> moduleInfos = new LinkedList<>();
+ Set<YangModuleInfo> moduleInfos = new HashSet<>();
ServiceLoader<YangModelBindingProvider> yangProviderLoader = ServiceLoader.load(YangModelBindingProvider.class);
for (YangModelBindingProvider yangModelBindingProvider : yangProviderLoader) {
moduleInfos.add(yangModelBindingProvider.getModuleInfo());
}
@Override
- public NotificationService createNotificationService() {
+ public final NotificationService createNotificationService() {
return adapterFactory.createNotificationService(domNotificationRouter);
}
@Override
- public NotificationPublishService createNotificationPublishService() {
+ public final NotificationPublishService createNotificationPublishService() {
return adapterFactory.createNotificationPublishService(domNotificationRouter);
}
@Override
public <T extends DataObject> Optional<NormalizedNode> toNormalizedNodes(@Nonnull T object,
- Class<T> dataObjectClass) {
+ Class dataObjectClass) {
Entry<YangInstanceIdentifier, NormalizedNode> normalizedNode =
codecRegistry.toNormalizedNode(InstanceIdentifier.create(dataObjectClass), object);
return Optional.ofNullable(normalizedNode.getValue());
@Override
public <T extends DataObject> ConvertType<T> dataContainer() {
- return (object, objectClass) -> {
- NormalizedNode value =
- getCodecRegistry().toNormalizedNode(InstanceIdentifier.create(objectClass), object).getValue();
- return Optional.ofNullable(value);
- };
+// return (object, objectClass) -> {
+// NormalizedNode value =
+// getCodecRegistry().toNormalizedNode(InstanceIdentifier.create(objectClass), object).getValue();
+// return Optional.ofNullable(value);
+// };
+ return null;
}
@Override
ConvertType<T> convertType, QName rpcOutputQName, String rpcName);
<T extends DataObject> Optional<NormalizedNode> toNormalizedNodes(@Nonnull T object,
- Class<T> dataObjectClass);
+ Class dataObjectClass);
- public interface ConvertType<T> {
+ interface ConvertType<T> {
Optional<NormalizedNode> toNormalizedNodes(T object, Class<T> clazz);
}
}
description
- "YANG model for providing path-description through data container for testing purpose";
+ "YANG model for providing path-description through data container
+ for testing purpose";
revision 2020-12-11 {
description
- "first version";
+ "first version";
reference
- "YANG model for providing path-description through data container for testing purpose";
+ "YANG model for providing path-description through data container
+ for testing purpose";
}
container path-description {
uses transportpce-pathDescription:path-description;
}
-}
+}
\ No newline at end of file
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn({
'pmparameter-name': 'OpticalPowerOutput',
- 'pmparameter-value': '2.5'
+ 'pmparameter-value': '2.50'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalReturnLoss',
- 'pmparameter-value': '49.9'
+ 'pmparameter-value': '49.90'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalPowerInput',
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn({
'pmparameter-name': 'OpticalPowerOutput',
- 'pmparameter-value': '18.1'
+ 'pmparameter-value': '18.10'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalReturnLoss',
- 'pmparameter-value': '48.8'
+ 'pmparameter-value': '48.80'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalPowerInput',
- 'pmparameter-value': '-3.2'
+ 'pmparameter-value': '-3.20'
}, response['output']['measurements'])
def test_13_calculate_span_loss_base_ROADMA_ROADMC(self):
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn({
'pmparameter-name': 'OpticalPowerOutput',
- 'pmparameter-value': '2.5'
+ 'pmparameter-value': '2.50'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalReturnLoss',
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalPowerInput',
- 'pmparameter-value': '-21.1'
+ 'pmparameter-value': '-21.10'
}, response['output']['measurements'])
def test_12_get_PM_ROADMC(self):
self.assertEqual(response['status_code'], requests.codes.ok)
self.assertIn({
'pmparameter-name': 'OpticalPowerOutput',
- 'pmparameter-value': '4.6'
+ 'pmparameter-value': '4.60'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalReturnLoss',
- 'pmparameter-value': '49.1'
+ 'pmparameter-value': '49.10'
}, response['output']['measurements'])
self.assertIn({
'pmparameter-name': 'OpticalPowerInput',
- 'pmparameter-value': '-15.1'
+ 'pmparameter-value': '-15.10'
}, response['output']['measurements'])
def test_13_calculate_span_loss_base_ROADMA_ROADMC(self):
# pylint: disable=no-member
# pylint: disable=too-many-public-methods
-import unittest
-import time
-import requests
# pylint: disable=wrong-import-order
import sys
+import time
+import unittest
+
+import requests
+
sys.path.append("transportpce_tests/common")
# pylint: disable=wrong-import-position
# pylint: disable=import-error
"xponder-type": "tpdr",
"port-admin-state": "InService",
"port-oper-state": "InService"}
- CLIENT_CAPABILITIES = ["org-openroadm-port-types:if-OCH-OTU4-ODU4",
- "org-openroadm-port-types:if-100GE"]
+ CLIENT_CAPABILITIES = ["org-openroadm-port-types:if-100GE",
+ "org-openroadm-port-types:if-OCH-OTU4-ODU4"]
NODE_VERSION = "7.1"
@classmethod
self.assertEqual(response["status_code"], requests.codes.ok)
self.assertEqual(
self.CLIENT_CAPABILITIES,
- response["mapping"][0]["supported-interface-capability"])
+ sorted(response["mapping"][0]["supported-interface-capability"]))
def test_03_check_client_capabilities(self):
response = test_utils_rfc8040.portmapping_request("XPDR-C2", "XPDR3-CLIENT1")
self.assertEqual(response["status_code"], requests.codes.ok)
self.assertEqual(
self.CLIENT_CAPABILITIES,
- response["mapping"][0]["supported-interface-capability"])
+ sorted(response["mapping"][0]["supported-interface-capability"]))
def test_04_100g_ofec_service_path_create(self):
response = test_utils_rfc8040.transportpce_api_rpc_request(
"XPDR3-NETWORK1-OTUC1"
],
"odu-interface-id": [
- "XPDR3-NETWORK1-ODUC1",
- "XPDR3-NETWORK1-ODU4"
+ "XPDR3-NETWORK1-ODU4",
+ "XPDR3-NETWORK1-ODUC1"
],
"och-interface-id": [
"XPDR3-NETWORK1-265:272",
"eth-interface-id": [
"XPDR3-CLIENT1-ETHERNET"
]},
- response["output"]["node-interface"][0])
+ {x: (sorted(response["output"]["node-interface"][0][x])
+ if isinstance(response["output"]["node-interface"][0][x], list)
+ else response["output"]["node-interface"][0][x])
+ for x in response["output"]["node-interface"][0].keys()})
self.assertEqual(
{"node-id": z_side,
"otu-interface-id": [
"XPDR3-NETWORK1-OTUC1"
],
"odu-interface-id": [
- "XPDR3-NETWORK1-ODUC1",
- "XPDR3-NETWORK1-ODU4"
+ "XPDR3-NETWORK1-ODU4",
+ "XPDR3-NETWORK1-ODUC1"
],
"och-interface-id": [
"XPDR3-NETWORK1-265:272",
"eth-interface-id": [
"XPDR3-CLIENT1-ETHERNET"
]},
- response["output"]["node-interface"][1])
+ {x: (sorted(response["output"]["node-interface"][1][x])
+ if isinstance(response["output"]["node-interface"][1][x], list)
+ else response["output"]["node-interface"][1][x])
+ for x in response["output"]["node-interface"][1].keys()})
def test_05_get_portmapping_network1(self):
response = test_utils_rfc8040.portmapping_request("XPDR-A2", "XPDR3-NETWORK1")
"node-id": "XPDRA01",
"service-format": "Ethernet",
"clli": "SNJSCAMCJP8",
- "tx-direction": [{
- "port": {
- "port-type": "fixed",
- "port-rack": "000000.00",
- "port-shelf": "Chassis#1"
- },
- "lgx": {
- "lgx-device-name": "Some lgx-device-name",
- "lgx-port-name": "Some lgx-port-name",
- "lgx-port-rack": "000000.00",
- "lgx-port-shelf": "00"
- },
- "index": 0
- }],
- "rx-direction": [{
- "port": {
- "port-type": "fixed",
- "port-rack": "000000.00",
- "port-shelf": "Chassis#1"
- },
- "lgx": {
- "lgx-device-name": "Some lgx-device-name",
- "lgx-port-name": "Some lgx-port-name",
- "lgx-port-rack": "000000.00",
- "lgx-port-shelf": "00"
- },
- "index": 0
- }],
+ "tx-direction": [{"index": 0}],
+ "rx-direction": [{"index": 0}],
"optic-type": "gray"
},
"service-z-end": {
"node-id": "XPDR-C1",
"service-format": "Ethernet",
"clli": "SNJSCAMCJT4",
- "tx-direction": [{
- "port": {
- "port-type": "fixed",
- "port-rack": "000000.00",
- "port-shelf": "Chassis#1"
- },
- "lgx": {
- "lgx-device-name": "Some lgx-device-name",
- "lgx-port-name": "Some lgx-port-name",
- "lgx-port-rack": "000000.00",
- "lgx-port-shelf": "00"
- },
- "index": 0
- }],
- "rx-direction": [{
- "port": {
- "port-type": "fixed",
- "port-rack": "000000.00",
- "port-shelf": "Chassis#1"
- },
- "lgx": {
- "lgx-device-name": "Some lgx-device-name",
- "lgx-port-name": "Some lgx-port-name",
- "lgx-port-rack": "000000.00",
- "lgx-port-shelf": "00"
- },
- "index": 0
- }],
+ "tx-direction": [{"index": 0}],
+ "rx-direction": [{"index": 0}],
"optic-type": "gray"
},
"due-date": "2016-11-28T00:00:01Z",
[testenv]
passenv = USE_LIGHTY http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OLM_TIMER1 OLM_TIMER2
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
OLM_TIMER1=3000
OLM_TIMER2=2000
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_ALT_KARAF_ENV=./karaf121.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
commands =
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_RESTCONF_VERSION=draft-bierman02
USE_ODL_ALT_KARAF_ENV=./karaf121.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf121
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_ALT_KARAF_ENV=./karaf221.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
commands =
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_RESTCONF_VERSION=draft-bierman02
USE_ODL_ALT_KARAF_ENV=./karaf221.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_ALT_KARAF_ENV=./karaf71.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
commands =
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_RESTCONF_VERSION=draft-bierman02
USE_ODL_ALT_KARAF_ENV=./karaf71.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf71
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_ALT_KARAF_ENV=./karaf121.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
commands =
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_ALT_KARAF_ENV=./karaf121.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf_hybrid
commands =
whitelist_externals = launch_tests.sh
passenv = LAUNCHER USE_LIGHTY OLM_TIMER1 OLM_TIMER2 USE_ODL_RESTCONF_VERSION
setenv =
- USE_LIGHTY=True
+# USE_LIGHTY=True
USE_ODL_RESTCONF_VERSION=draft-bierman02
USE_ODL_ALT_KARAF_ENV=./karaf221.env
USE_ODL_ALT_KARAF_INSTALL_DIR=karaf221