import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareDashString;
import static org.opendaylight.transportpce.inventory.utils.StringUtils.prepareEmptyString;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(
+@SuppressFBWarnings(
value = "SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING",
justification = "TODO review the SQL statement generation process")
public class INode121 {
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);
LOG.warn("Could not get device info from DataBroker");
return false;
}
- deviceInfo = infoOpt.get();
+ deviceInfo = infoOpt.orElseThrow();
boolean sqlResult = false;
String query = Queries.getQuery().deviceInfoInsert().get();
LOG.info("Running {} query ", query);
}
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);
if (!deviceObject.isPresent()) {
return;
}
- Map<ShelvesKey, Shelves> shelvesMap = deviceObject.get().nonnullShelves();
+ Map<ShelvesKey, Shelves> shelvesMap = deviceObject.orElseThrow().nonnullShelves();
LOG.info("Shelves size {}", shelvesMap.size());
try (Connection connection = requireNonNull(dataSource.getConnection())) {
for (Map.Entry<ShelvesKey, Shelves> shelveEntry : shelvesMap.entrySet()) {
}
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);
LOG.warn("Device object {} was not found", nodeId);
return;
}
- Map<CircuitPacksKey, CircuitPacks> circuitPacksMap = deviceObject.get().nonnullCircuitPacks();
+ Map<CircuitPacksKey, CircuitPacks> circuitPacksMap = deviceObject.orElseThrow().nonnullCircuitPacks();
LOG.info("Circuit pack size {}", circuitPacksMap.size());
try (Connection connection = requireNonNull(dataSource.getConnection())) {
String name = deviceInterface.getName();
String description = deviceInterface.getDescription();
- String type = deviceInterface.getType().getTypeName();
+ String type = deviceInterface.getType().toString();
String administrativeStateEnu = deviceInterface.getAdministrativeState().getName();
int operationalState = deviceInterface.getOperationalState().getIntValue();
String circuitId = deviceInterface.getCircuitId();
org.opendaylight.yang.gen.v1
.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class)
.getOch());
- ochRate = ochIfBuilder.getRate().getName();
+ ochRate = ochIfBuilder.getRate().toString();
ochWavelengthNumber = ochIfBuilder.getWavelengthNumber().toString();
ochModulationFormat = ochIfBuilder.getModulationFormat().getName();
ochTransmitPower = ochIfBuilder.getTransmitPower().toString();
new OtuBuilder(deviceInterface.augmentation(
org.opendaylight.yang.gen.v1.http.org.openroadm.otn.otu.interfaces.rev161014.Interface1.class)
.getOtu());
- otuRate = otuIfBuilder.getRate().getName();
+ otuRate = otuIfBuilder.getRate().toString();
otuFecEnu = otuIfBuilder.getFec().getName();
otuMaintLoopbackEnabled = otuIfBuilder.getMaintLoopback().getEnabled().toString();
otuMaintTypeEnu = otuIfBuilder.getMaintLoopback().getType().getName();
private static Object[] prepareDevInterfaceOtnOduTxMsiParameters(String nodeId, String interfaceName, TxMsi txMsi) {
String tribSlot = txMsi.getTribSlot().toString();
- String odtuType = txMsi.getOdtuType().getTypeName();
+ String odtuType = txMsi.getOdtuType().toString();
String tribPort = txMsi.getTribPort().toString();
String tribPortPayload = txMsi.getTribPortPayload();
private static Object[] prepareDevInterfaceOtnOduRxMsiParameters(String nodeId, String interfaceName, RxMsi rxMsi) {
String tribSlot = rxMsi.getTribSlot().toString();
- String odtuType = rxMsi.getOdtuType().getTypeName();
+ String odtuType = rxMsi.getOdtuType().toString();
String tribPort = rxMsi.getTribPort().toString();
String tribPortPayload = rxMsi.getTribPortPayload();
ExpMsi expMsi) {
String tribSlot = expMsi.getTribSlot().toString();
- String odtuType = expMsi.getOdtuType().getTypeName();
+ String odtuType = expMsi.getOdtuType().toString();
String tribPort = expMsi.getTribPort().toString();
String tribPortPayload = expMsi.getTribPortPayload();
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);
if (!deviceObject.isPresent()) {
return;
}
- Map<InterfaceKey, Interface> interfaceMap = deviceObject.get().nonnullInterface();
+ Map<InterfaceKey, Interface> interfaceMap = deviceObject.orElseThrow().nonnullInterface();
for (Map.Entry<InterfaceKey, Interface> interfaceEntrySet : interfaceMap.entrySet()) {
Interface deviceInterface = interfaceEntrySet.getValue();
Object[] parameters = prepareDevInterfaceParameters(nodeId, deviceInterface, connection);
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);
- if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
+ if (!protocolObject.isPresent() || protocolObject.orElseThrow().augmentation(Protocols1.class) == null) {
LOG.error("LLDP subtree is missing");
return;
}
- String adminstatusEnu = protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig()
+ String adminstatusEnu = protocolObject.orElseThrow().augmentation(Protocols1.class).getLldp().getGlobalConfig()
.getAdminStatus().getName();
- String msgTxtInterval = protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig()
+ String msgTxtInterval = protocolObject.orElseThrow().augmentation(Protocols1.class).getLldp().getGlobalConfig()
.getMsgTxInterval().toString();
- String mxgTxHoldMultiplier = protocolObject.get().augmentation(Protocols1.class).getLldp().getGlobalConfig()
- .getMsgTxHoldMultiplier().toString();
+ String mxgTxHoldMultiplier = protocolObject.orElseThrow().augmentation(Protocols1.class).getLldp()
+ .getGlobalConfig().getMsgTxHoldMultiplier().toString();
String startTimestamp = getCurrentTimestamp();
persistDevProtocolLldpPortConfig(nodeId, connection);
persistDevProtocolLldpNbrList(nodeId, connection);
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);
- if (!protocolObject.isPresent() || protocolObject.get().augmentation(Protocols1.class) == null) {
+ if (!protocolObject.isPresent() || protocolObject.orElseThrow().augmentation(Protocols1.class) == null) {
LOG.error("LLDP subtree is missing");
return;
}
String startTimestamp = getCurrentTimestamp();
@NonNull
- Map<PortConfigKey, PortConfig> portConfigMap = protocolObject.get()
+ Map<PortConfigKey, PortConfig> portConfigMap = protocolObject.orElseThrow()
.augmentation(Protocols1.class).getLldp().nonnullPortConfig();
for (Map.Entry<PortConfigKey, PortConfig> entry : portConfigMap.entrySet()) {
PortConfig portConfig = entry.getValue();
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);
LOG.error("Protocols is missing");
return;
}
- if (protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList() == null) {
+ if (protocolObject.orElseThrow().augmentation(Protocols1.class).getLldp().getNbrList() == null) {
protocolObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.OPERATIONAL, protocolsIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList() == null) {
+ if (protocolObject.orElseThrow().augmentation(Protocols1.class).getLldp().getNbrList() == null) {
LOG.error("LLDP nbrlist subtree is missing for {}", nodeId);
return;
}
}
String startTimestamp = getCurrentTimestamp();
Map<IfNameKey, IfName> ifNameMap =
- protocolObject.get().augmentation(Protocols1.class).getLldp().getNbrList().nonnullIfName();
+ protocolObject.orElseThrow().augmentation(Protocols1.class).getLldp().getNbrList().nonnullIfName();
for (Map.Entry<IfNameKey, IfName> ifNameEntry : ifNameMap.entrySet()) {
IfName ifNameObj = ifNameEntry.getValue();
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);
if (!deviceObject.isPresent()) {
return;
}
- if (deviceObject.get().getInternalLink() == null) {
+ if (deviceObject.orElseThrow().getInternalLink() == null) {
deviceObject = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
deviceIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (deviceObject.get().getInternalLink() == null) {
+ if (deviceObject.orElseThrow().getInternalLink() == null) {
LOG.info("External links not found for {}", nodeId);
return;
}
}
@NonNull
- Map<InternalLinkKey, InternalLink> internalLinkMap = deviceObject.get().nonnullInternalLink();
+ Map<InternalLinkKey, InternalLink> internalLinkMap = deviceObject.orElseThrow().nonnullInternalLink();
String startTimestamp = getCurrentTimestamp();
for (Map.Entry<InternalLinkKey, InternalLink> internalLinkEntry: internalLinkMap.entrySet()) {
InternalLink internalLink = internalLinkEntry.getValue();
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);
if (!deviceObject.isPresent()) {
return;
}
- if (deviceObject.get().getExternalLink() == null) {
+ if (deviceObject.orElseThrow().getExternalLink() == null) {
deviceObject = deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION,
deviceIID, Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
- if (deviceObject.get().getExternalLink() == null) {
+ if (deviceObject.orElseThrow().getExternalLink() == null) {
LOG.info("External links not found for {}", nodeId);
return;
}
}
String startTimestamp = getCurrentTimestamp();
@NonNull
- Map<ExternalLinkKey, ExternalLink> externalLinkMap = deviceObject.get().nonnullExternalLink();
+ Map<ExternalLinkKey, ExternalLink> externalLinkMap = deviceObject.orElseThrow().nonnullExternalLink();
for (Map.Entry<ExternalLinkKey, ExternalLink> externalLinkEntry: externalLinkMap.entrySet()) {
ExternalLink externalLink = externalLinkEntry.getValue();
String externalLinkName = externalLink.getExternalLinkName();
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);
LOG.error("No device with node Id {}", nodeId);
return;
}
- if (deviceObject.get().getPhysicalLink() == null) {
+ if (deviceObject.orElseThrow().getPhysicalLink() == null) {
deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
LOG.error("No device with node Id {}", nodeId);
return;
}
- if (deviceObject.get().getPhysicalLink() == null) {
+ if (deviceObject.orElseThrow().getPhysicalLink() == null) {
LOG.info("Physical links not found for {}", nodeId);
return;
}
String startTimestamp = getCurrentTimestamp();
@NonNull
- Map<PhysicalLinkKey, PhysicalLink> physicalLinkMap = deviceObject.get().nonnullPhysicalLink();
+ Map<PhysicalLinkKey, PhysicalLink> physicalLinkMap = deviceObject.orElseThrow().nonnullPhysicalLink();
for (Map.Entry<PhysicalLinkKey, PhysicalLink> physicalLinkEntry : physicalLinkMap.entrySet()) {
PhysicalLink physicalLink = physicalLinkEntry.getValue();
String physicalLinkName = physicalLink.getPhysicalLinkName();
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);
}
String startTimestamp = getCurrentTimestamp();
@NonNull
- Map<DegreeKey, Degree> degreeMap = deviceObject.get().nonnullDegree();
+ Map<DegreeKey, Degree> degreeMap = deviceObject.orElseThrow().nonnullDegree();
for (Map.Entry<DegreeKey, Degree> degreeEntry : degreeMap.entrySet()) {
Degree degree = degreeEntry.getValue();
String degreeNumber = degree.getDegreeNumber().toString();
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);
return;
}
- if (deviceObject.get().getSharedRiskGroup() == null) {
+ if (deviceObject.orElseThrow().getSharedRiskGroup() == null) {
deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
@NonNull
- Map<SharedRiskGroupKey, SharedRiskGroup> sharedRiskGroupMap = deviceObject.get().nonnullSharedRiskGroup();
+ Map<SharedRiskGroupKey, SharedRiskGroup> sharedRiskGroupMap = deviceObject.orElseThrow()
+ .nonnullSharedRiskGroup();
if (sharedRiskGroupMap.isEmpty()) {
LOG.info("no srg found for node {} ", nodeId);
return;
//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);
LOG.error("No device found in operational datastore for node {}", nodeId);
return;
}
- if (deviceObject.get().getRoadmConnections() == null) {
+ if (deviceObject.orElseThrow().getRoadmConnections() == null) {
deviceObject =
deviceTransactionManager.getDataFromDevice(nodeId, LogicalDatastoreType.CONFIGURATION, deviceIID,
Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
}
@NonNull
- Map<RoadmConnectionsKey, RoadmConnections> connectionsMap = deviceObject.get().nonnullRoadmConnections();
+ Map<RoadmConnectionsKey, RoadmConnections> connectionsMap = deviceObject.orElseThrow()
+ .nonnullRoadmConnections();
if (connectionsMap.isEmpty()) {
LOG.info("ROADM Dev Connections not found!! for {}", nodeId);
return;
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);
}
String startTimestamp = getCurrentTimestamp();
@NonNull
- Map<ConnectionMapKey, ConnectionMap> connectionsMap = deviceObject.get().nonnullConnectionMap();
+ Map<ConnectionMapKey, ConnectionMap> connectionsMap = deviceObject.orElseThrow().nonnullConnectionMap();
for (Map.Entry<ConnectionMapKey, ConnectionMap> entry : connectionsMap.entrySet()) {
ConnectionMap connectionMap = entry.getValue();
String connectionMapNumber = connectionMap.getConnectionMapNumber().toString();
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);
String startTimestamp = getCurrentTimestamp();
@NonNull
- Map<WavelengthsKey, Wavelengths> wavelengthsMap = deviceObject.get().getWavelengthMap().nonnullWavelengths();
+ Map<WavelengthsKey, Wavelengths> wavelengthsMap = deviceObject.orElseThrow().getWavelengthMap()
+ .nonnullWavelengths();
for (Map.Entry<WavelengthsKey, Wavelengths> entry : wavelengthsMap.entrySet()) {
Wavelengths wavelengths = entry.getValue();
String wavelengthNumber = wavelengths.getWavelengthNumber().toString();