Bug 4836 - tunnel's paths are not removed from ODL after tunnel status "Down" is... 26/32826/2
authorMilos Fabian <milfabia@cisco.com>
Mon, 11 Jan 2016 14:07:21 +0000 (15:07 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 15 Jan 2016 15:18:06 +0000 (15:18 +0000)
In a case when PCC reports tunnel has been shutdowned, but not removed
(LSP-ID=0, remove=false), ODL PCE should remove all previously reported
paths related to the tunnel as there are no paths signaled anymore.
Also, in this case PCC will not send report/s with explicit removal
of those paths.

Change-Id: I7b2c34431b094b27ac1fc55c2a75312e00868532
Signed-off-by: Milos Fabian <milfabia@cisco.com>
(cherry picked from commit 4381024781b5ecda601eee2217c8c10e4d61a6c8)

pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/AbstractTopologySessionListener.java

index 797ca49c2459511c4e4aa4a316a2fd7a3d5130db..1a4850d1fe99adbb7a3f33b9471b3788811e9f51 100644 (file)
@@ -394,16 +394,24 @@ public abstract class AbstractTopologySessionListener<S, L> implements PCEPSessi
         // just one path should be reported
         Preconditions.checkState(rlb.getPath().size() == 1);
         final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId reportedLspId = rlb.getPath().get(0).getLspId();
-        // check previous report for existing paths
-        final List<Path> updatedPaths = new ArrayList<>(previous.getPath());
-        LOG.debug("Found previous paths {} to this lsp name {}", updatedPaths, name);
-        for (final Path path : previous.getPath()) {
-            //we found reported path in previous reports
-            if (path.getLspId().getValue() == 0 || path.getLspId().equals(reportedLspId)) {
-                LOG.debug("Match on lsp-id {}", path.getLspId().getValue() );
-                // path that was reported previously and does have the same lsp-id, path will be updated
-                final boolean r = updatedPaths.remove(path);
-                LOG.trace("Request removed? {}", r);
+        final List<Path> updatedPaths;
+        //lspId = 0 and remove = false -> tunnel is down, still exists but no path is signaled
+        //remove existing tunnel's paths now, as explicit path remove will not come
+        if (!remove && reportedLspId.getValue() == 0) {
+            updatedPaths = new ArrayList<>();
+            LOG.debug("Remove previous paths {} to this lsp name {}", previous.getPath(), name);
+        } else {
+            // check previous report for existing paths
+            updatedPaths = new ArrayList<>(previous.getPath());
+            LOG.debug("Found previous paths {} to this lsp name {}", updatedPaths, name);
+            for (final Path path : previous.getPath()) {
+                //we found reported path in previous reports
+                if (path.getLspId().getValue() == 0 || path.getLspId().equals(reportedLspId)) {
+                    LOG.debug("Match on lsp-id {}", path.getLspId().getValue() );
+                    // path that was reported previously and does have the same lsp-id, path will be updated
+                    final boolean r = updatedPaths.remove(path);
+                    LOG.trace("Request removed? {}", r);
+                }
             }
         }
         // if the path does not exist in previous report, add it to path list, it's a new ERO