remove redundant parent data with last child
[groupbasedpolicy.git] / groupbasedpolicy / src / main / java / org / opendaylight / groupbasedpolicy / location / resolver / LocationResolver.java
index 9e30d7d2e2c3eb29be96ff42b677829856e83d13..02f5419e5f6d208145ad8c37836fe89569f9b5bb 100644 (file)
@@ -128,6 +128,10 @@ public class LocationResolver implements ClusteredDataTreeChangeListener<Locatio
                     wtx.delete(LogicalDatastoreType.OPERATIONAL, iid);
                 }
             }
+            if (newAbsoluteLocation == null && addressEndpointLocation.getRelativeLocations() == null) {
+                InstanceIdentifier<AddressEndpointLocation> iid = IidFactory.addressEndpointLocationIid(epKey);
+                wtx.delete(LogicalDatastoreType.OPERATIONAL, iid);
+            }
         }
         for (ProviderContainmentEndpointLocation containmentEndpoint : nullToEmpty(
                 provider.getProviderContainmentEndpointLocation())) {