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);
}