Bug 7384: CSIT Exception: NPE in deleteVpnInterface 22/51022/3
authorAbhinav Gupta <abhinav.gupta@ericsson.com>
Wed, 25 Jan 2017 18:49:30 +0000 (00:19 +0530)
committerSam Hague <shague@redhat.com>
Wed, 25 Jan 2017 22:45:16 +0000 (22:45 +0000)
getNeutronPort is returning null, causing port.getUUid() to result
in an NPE.
Further analysis necessary as to how it happened in the first place
since port delete event for the port in concern hasn't come.
The introduced check should ensure avoiding this NPE for now.

Change-Id: Ia4298d3b9f2b57b1a94805bca3ae34dffa2df4fe
Signed-off-by: Abhinav Gupta <abhinav.gupta@ericsson.com>
vpnservice/neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronvpnManager.java

index 71b7dbfc51e8f0a871a432341b7e18044c20c64e..ef954938bb6e1d42eb7829da3cb4a22726d9377c 100644 (file)
@@ -1459,8 +1459,13 @@ public class NeutronvpnManager implements NeutronvpnService, AutoCloseable, Even
                     portDataStoreCoordinator.enqueueJob("PORT-" + portId.getValue(), () -> {
                         WriteTransaction wrtConfigTxn = dataBroker.newWriteOnlyTransaction();
                         List<ListenableFuture<Void>> futures = new ArrayList<>();
-                        deleteVpnInterface(vpnId, routerId, NeutronvpnUtils.getNeutronPort(dataBroker, portId),
-                                wrtConfigTxn);
+                        Port port = NeutronvpnUtils.getNeutronPort(dataBroker, portId);
+                        if (port != null) {
+                            deleteVpnInterface(vpnId, routerId, port, wrtConfigTxn);
+                        } else {
+                            LOG.error("Cannot proceed with deleteVpnInterface for port {} in subnet {} since port is " +
+                                    "absent in Neutron config DS", portId.getValue(), subnet.getValue());
+                        }
                         futures.add(wrtConfigTxn.submit());
                         return futures;
                     });