Adapt TransportPCE code to Sulfur
[transportpce.git] / networkmodel / src / main / java / org / opendaylight / transportpce / networkmodel / listeners / DeviceListener121.java
index 543dba266ca6509e417229de6135700022352f27..21e081c565d369603530623bf2a5879d25e01f7a 100644 (file)
@@ -40,7 +40,6 @@ public class DeviceListener121 implements OrgOpenroadmDeviceListener {
      * @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);
@@ -55,12 +54,10 @@ public class DeviceListener121 implements OrgOpenroadmDeviceListener {
                 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);