BGP fib cache and alarm task fixes
[netvirt.git] / bgpmanager / impl / src / main / java / org / opendaylight / netvirt / bgpmanager / BgpConfigurationManager.java
index 32bfdd2fc1fc699e367dac71e688290e1bac26ff..926fe55528b3a26e56885cebdb19246c5d049a0d 100755 (executable)
@@ -496,6 +496,8 @@ public class BgpConfigurationManager implements EbgpService {
                     //disconnect the CONFIG SERVER port (which was )opened during I was Owner
                     bgpRouter.disconnect();
                 }
+                stopBgpCountersTask();
+                stopBgpAlarmsTask();
             }
         });
     }
@@ -3064,6 +3066,7 @@ public class BgpConfigurationManager implements EbgpService {
         totalStaledCount = 0;
         try {
             staledFibEntriesMap.clear();
+            fibDSWriter.clearFibMap();
             InstanceIdentifier<FibEntries> id = InstanceIdentifier.create(FibEntries.class);
 
             Optional<FibEntries> fibEntries = SingleTransactionDataBroker.syncReadOptional(dataBroker,
@@ -3084,9 +3087,15 @@ public class BgpConfigurationManager implements EbgpService {
                         //Create MAP from staleVrfTables.
                         vrfEntry.getRoutePaths()
                                 .forEach(
-                                    routePath -> staleFibEntMap.put(
-                                            appendNextHopToPrefix(vrfEntry.getDestPrefix(),
-                                                    routePath.getNexthopAddress()), routePath.getLabel()));
+                                    routePath -> {
+                                        staleFibEntMap.put(
+                                                appendNextHopToPrefix(vrfEntry.getDestPrefix(),
+                                                        routePath.getNexthopAddress()), routePath.getLabel());
+                                        fibDSWriter.addEntryToFibMap(
+                                                vrfTable.getRouteDistinguisher(),  vrfEntry.getDestPrefix(),
+                                                routePath.getNexthopAddress());
+
+                                    });
                     }
                     staledFibEntriesMap.put(vrfTable.getRouteDistinguisher(), staleFibEntMap);
                 }