package org.opendaylight.transportpce.networkmodel.listeners;
-import java.util.Collection;
import java.util.LinkedList;
import org.opendaylight.transportpce.common.mapping.PortMapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210315.mapping.Mapping;
+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.OrgOpenroadmDeviceListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.OtdrScanResult;
private final PortMapping portMapping;
public DeviceListener121(String nodeId, PortMapping portMapping) {
+ super();
this.nodeId = nodeId;
this.portMapping = portMapping;
}
* @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);
return;
}
for (Edit edit : notification.getEdit()) {
+ if (edit.getTarget() == null) {
+ continue;
+ }
// 1. Detect the org-openroadm-device object modified
switch (edit.getTarget().getTargetType().getSimpleName()) {
case "Ports":
LinkedList<PathArgument> path = new LinkedList<>();
- path.addAll((Collection<? extends PathArgument>) edit.getTarget().getPathArguments());
+ edit.getTarget().getPathArguments().forEach(p -> path.add(p));
InstanceIdentifier<Ports> portIID = (InstanceIdentifier<Ports>) InstanceIdentifier
.create(path);
String portName = InstanceIdentifier.keyOf(portIID).getPortName();