Optimizing BGP routesync operation 71/86971/3
authormanjunath.hethur <manjunath.hethur@gmail.com>
Thu, 16 Jan 2020 11:26:08 +0000 (16:56 +0530)
committerChetan Arakere Gowdru <chetan.arakere@altencalsoftlabs.com>
Thu, 27 Feb 2020 11:17:26 +0000 (11:17 +0000)
JIRA: NETVIRT-1661

Signed-off-by: manjunath.hethur <manjunath.hethur@gmail.com>
Change-Id: Ia02ed0209366fad368431e7bdaf3bd9a52fd5852
Signed-off-by: manjunath.hethur <manjunath.hethur@gmail.com>
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpConfigurationManager.java

index 78c2642f023f3296df27551514422cd7a9632c06..7564687230083c233ecfa4897826465aedd4b4ca 100755 (executable)
@@ -1914,16 +1914,17 @@ public class BgpConfigurationManager implements EbgpService {
     }
 
     private void doRouteSync() {
-        LOG.error("Starting BGP route sync");
-        try {
-            bgpRouter.initRibSync(bgpSyncHandle);
-        } catch (BgpRouterException e) {
-            LOG.error("Route sync aborted, exception when initializing", e);
-            return;
-        }
-        while (bgpSyncHandle.getState() != BgpSyncHandle.DONE) {
-            for (af_afi afi : af_afi.values()) {
+        for (af_afi afi : af_afi.values()) {
+            try {
+                bgpRouter.initRibSync(bgpSyncHandle);
+            } catch (BgpRouterException e) {
+                LOG.error("Route sync aborted, exception when initializing", e);
+                return;
+            }
+            LOG.error("Starting BGP route sync for afi {}", afi.getValue());
+            while (bgpSyncHandle.getState() != BgpSyncHandle.DONE) {
                 Routes routes = null;
+                int noUpdates = 0;
                 try {
                     routes = bgpRouter.doRibSync(bgpSyncHandle, afi);
                 } catch (TException | BgpRouterException e) {
@@ -1932,6 +1933,7 @@ public class BgpConfigurationManager implements EbgpService {
                 }
                 Iterator<Update> updates = routes.getUpdatesIterator();
                 while (updates.hasNext()) {
+                    noUpdates++;
                     Update update = updates.next();
                     String rd = update.getRd();
                     String nexthop = update.getNexthop();
@@ -1959,13 +1961,14 @@ public class BgpConfigurationManager implements EbgpService {
                            update.getRoutermac(),
                            afi);
                 }
+                LOG.error("No of updates for afi {} is {}", afi.getValue(), noUpdates);
             }
         }
         try {
             LOG.error("Ending BGP route-sync");
             bgpRouter.endRibSync(bgpSyncHandle);
         } catch (BgpRouterException e) {
-            // Ignored?
+            LOG.error("Route sync aborted, exception when ending", e);
         }
     }