BgpRouter code enhancements 31/86031/4
authorLoshmitha <loshmitha@ericsson.com>
Wed, 27 Nov 2019 12:18:42 +0000 (17:48 +0530)
committerAbhinav Gupta <abhinav.gupta@ericsson.com>
Thu, 28 Nov 2019 06:35:22 +0000 (06:35 +0000)
Router code enhancements have been added

JIRA: NETVIRT-1645

Change-Id: Ie9a6348e7549c0f774272024bcfc1863b2abbc63
Signed-off-by: Loshmitha <loshmitha@ericsson.com>
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/ConfigureBgpCli.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/DisplayBgpConfigCli.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Cache.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Connect.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Misc.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Multipath.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Router.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/thrift/client/BgpRouter.java

index 81028d850450e539edd2363bc631cc16da202dd5..20c435c0ffefe7d90efc25f8b407ec1af3940bd3 100644 (file)
@@ -105,14 +105,16 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
         emergencies, alerts, critical, errors, warnings, notifications, informational, debugging
     }
 
+    private final BgpManager bgpManager;
     private final BgpConfigurationManager bgpConfigurationManager;
 
-    public ConfigureBgpCli(BgpConfigurationManager bgpConfigurationManager) {
+    public ConfigureBgpCli(BgpManager bgpManager, BgpConfigurationManager bgpConfigurationManager) {
+        this.bgpManager = bgpManager;
         this.bgpConfigurationManager = bgpConfigurationManager;
     }
 
     @Override
-    protected Object doExecute() {
+    protected Object doExecute() throws Exception {
         if (op == null) {
             session.getConsole().println("Please provide valid operation");
             usage();
@@ -160,12 +162,12 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
         try {
             int time = Integer.parseInt(stalePathTime);
             if (time < 30 || time > 3600) {
-                session.getConsole().println("invalid stale path time valid range [30-3600]");
+                session.getConsole().println("invalid stale path time valid range [30-3600]" + stalePathTime);
                 printGracefulRestartHelp();
                 return false;
             }
         } catch (NumberFormatException e) {
-            session.getConsole().println("invalid stale path time");
+            session.getConsole().println("invalid stale path time" + stalePathTime);
             printGracefulRestartHelp();
             return false;
         }
@@ -177,7 +179,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
         if (!validStalepathTime) {
             return;
         }
-        bgpConfigurationManager.addGracefulRestart(Integer.parseInt(stalePathTime));
+        bgpManager.configureGR(Integer.parseInt(stalePathTime));
     }
 
     private void deleteNeighbor() {
@@ -192,11 +194,11 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
             printDeleteNeighborHelp();
             return;
         }
-        bgpConfigurationManager.delNeighbor(ip);
+        bgpManager.deleteNeighbor(ip);
     }
 
     public long getAsNumber(String nbrIp) {
-        Bgp conf = bgpConfigurationManager.getConfig();
+        Bgp conf = bgpManager.getConfig();
         if (conf == null) {
             return -1;
         }
@@ -213,7 +215,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
     }
 
     private void stopBgp() {
-        Bgp conf = bgpConfigurationManager.getConfig();
+        Bgp conf = bgpManager.getConfig();
         if (conf == null) {
             return;
         }
@@ -223,7 +225,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
                     "error: all BGP congiguration must be deleted before stopping the router instance");
             return;
         }
-        bgpConfigurationManager.stopBgp();
+        bgpManager.stopBgp();
     }
 
     private void usage() {
@@ -265,7 +267,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
     private void startBgp() {
         boolean validRouterId = false;
 
-        if (bgpConfigurationManager.getConfig() != null && bgpConfigurationManager.getConfig().getAsId() != null) {
+        if (bgpManager.getConfig() != null && bgpManager.getConfig().getAsId() != null) {
             session.getConsole().println("bgp is already started please use stop-bgp-server and start again");
             return;
         }
@@ -286,7 +288,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
                 return;
             }
         }
-        bgpConfigurationManager.startBgp(Long.parseLong(asNumber), routerId,
+        bgpManager.startBgp(Long.parseLong(asNumber), routerId,
                 stalePathTime == null ? 0 : Integer.parseInt(stalePathTime), false);
     }
 
@@ -328,12 +330,14 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
             try {
                 long val = Long.parseLong(ebgpMultihops);
                 if (val < 1 || val > 255) {
-                    session.getConsole().println("invalid ebgpMultihops number , valid range [1,255] ");
+                    session.getConsole().println("invalid ebgpMultihops number , valid range [1,255] "
+                            + ebgpMultihops);
                     printAddNeighborHelp();
                     return;
                 }
             } catch (NumberFormatException e) {
-                session.getConsole().println("invalid ebgpMultihops number, valid range [1-255]");
+                session.getConsole().println("invalid ebgpMultihops number, valid range [1-255]"
+                        + ebgpMultihops);
                 printAddNeighborHelp();
                 return;
             }
@@ -362,12 +366,10 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
                 safi = 5;
             } else {
                 session.getConsole().println(
-                        "invalid addressFamily valid values SAFI_IPV4_LABELED_UNICAST | SAFI_MPLS_VPN");
+                        "invalid addressFamily valid values lu/evpn/vpnv4/vpnv6");
                 printAddNeighborHelp();
-                return;
+                return ;
             }
-            bgpConfigurationManager.addAddressFamily(ip, afi, safi);
-
         }
         if (getAsNumber(ip) != -1) {
             session.getConsole().println("neighbor with ip " + ip + " already exists");
@@ -387,12 +389,12 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
     }
 
     protected void addRoute() {
-        bgpConfigurationManager.onUpdatePushRoute(protocol_type.PROTOCOL_EVPN, rd, prefix,
+        bgpConfigurationManager.onUpdatePushRoute(protocol_type.PROTOCOL_L3VPN, rd, prefix,
                 0, nexthop, mac, l3vni, l2vni, null, null);
     }
 
     protected void deleteRoute() {
-        bgpConfigurationManager.onUpdateWithdrawRoute(protocol_type.PROTOCOL_EVPN, rd, prefix,
+        bgpConfigurationManager.onUpdateWithdrawRoute(protocol_type.PROTOCOL_L3VPN, rd, prefix,
                 0, nexthop, mac);
     }
 
@@ -450,7 +452,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
                     "exec configure-bgp -op enable-log --log-file-path <logfile> --log-level <level>");
             return;
         }
-        bgpConfigurationManager.addLogging(logFile, logLevel);
+        bgpManager.setQbgpLog(logFile, logLevel);
     }
 
     private boolean validateAsNumber(String strAsnum) {
@@ -466,7 +468,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
                 return false;
             }
         } catch (NumberFormatException e) {
-            session.getConsole().println("invalid AS Number ");
+            session.getConsole().println("invalid AS Number " + asNumber);
             return false;
         }
         return true;
index 1c9aa0c6dc7c97e5d15b238c070e39f0369e042f..089e7b2519d832728a14bea93da0a3e10a99d6ce 100644 (file)
@@ -30,21 +30,19 @@ public class DisplayBgpConfigCli extends OsgiCommandSupport {
     Boolean showHistory = false;
 
     private final BgpManager bgpManager;
-    private final BgpConfigurationManager bgpConfigurationManager;
 
-    public DisplayBgpConfigCli(BgpManager bgpManager, BgpConfigurationManager bgpConfigurationManager) {
+    public DisplayBgpConfigCli(BgpManager bgpManager) {
         this.bgpManager = bgpManager;
-        this.bgpConfigurationManager = bgpConfigurationManager;
     }
 
     @SuppressWarnings("checkstyle:RegexpSinglelineJava")
     @Override
-    protected Object doExecute() {
+    protected Object doExecute() throws Exception {
         PrintStream ps = System.out;
 
         if (debug) {
-            ps.printf("%nis ODL Connected to Q-BGP: %s%n", bgpConfigurationManager.isBgpConnected() ? "TRUE" : "FALSE");
-            final TTransport transport = bgpConfigurationManager.getTransport();
+            ps.printf("%nis ODL Connected to Q-BGP: %s%n", bgpManager.isBgpConnected() ? "TRUE" : "FALSE");
+            final TTransport transport = bgpManager.getBgpConfigurationManager().getTransport();
             if (transport != null) {
                 ps.printf("%nODL BGP Router transport is open: %s%n",
                         transport.isOpen() ? "TRUE" : "FALSE");
@@ -52,28 +50,34 @@ public class DisplayBgpConfigCli extends OsgiCommandSupport {
                 ps.printf("%nODL BGP Router transport is NULL%n");
             }
             //last ODL connection attempted TS
-            ps.printf("Last ODL connection attempt TS: %s%n", new Date(bgpConfigurationManager.getConnectTS()));
+            ps.printf("Last ODL connection attempt TS: %s%n", new Date(bgpManager.getConnectTS()));
             //last successful connected TS
-            ps.printf("Last Successful connection TS: %s%n", new Date(bgpConfigurationManager.getLastConnectedTS()));
+            ps.printf("Last Successful connection TS: %s%n", new Date(bgpManager.getLastConnectedTS()));
             //last ODL started BGP due to configuration trigger TS
-            ps.printf("Last ODL started BGP at: %s%n", new Date(bgpConfigurationManager.getStartTS()));
+            ps.printf("Last ODL started BGP at: %s%n", new Date(bgpManager.getStartTS()));
             //last Quagga attempted to RESTART the connection
             ps.printf("Last Quagga BGP, sent reSync at: %s%n", new Date(bgpManager.getQbgprestartTS()));
 
             //stale cleanup start - end TS
             ps.printf("Time taken to create stale fib : %s ms%n",
-                    bgpConfigurationManager.getStaleEndTime() - bgpConfigurationManager.getStaleStartTime());
+                    bgpManager.getStaleEndTime() - bgpManager.getStaleStartTime());
 
             //Config replay start - end TS
             ps.printf("Time taken to create replay configuration : %s ms%n",
-                    bgpConfigurationManager.getCfgReplayEndTime() - bgpConfigurationManager.getCfgReplayStartTime());
+                    bgpManager.getCfgReplayEndTime() - bgpManager.getCfgReplayStartTime());
 
             //Stale cleanup time
-            ps.printf("Time taken for Stale FIB cleanup : %s ms%n", bgpConfigurationManager.getStaleCleanupTime());
+            ps.printf("Time taken for Stale FIB cleanup : %s ms%n", bgpManager.getStaleCleanupTime());
 
-            ps.printf("Total stale entries created %d %n", bgpConfigurationManager.getTotalStaledCount());
-            ps.printf("Total stale entries cleared %d %n", bgpConfigurationManager.getTotalCleared());
+            ps.printf("Total stale entries created %d %n",
+                            bgpManager.getBgpConfigurationManager().getTotalStaledCount());
+            ps.printf("Total stale entries cleared %d %n",
+                            bgpManager.getBgpConfigurationManager().getTotalCleared());
+
+            ps.printf("Am I Owner %s %n",
+                      bgpManager.getBgpConfigurationManager().isBGPEntityOwner() ? "True" : "False");
         }
+
         if (showHistory) {
             TransactionHistory bgpUpdatesHistory = bgpManager.getBgpConfigurationManager().getBgpUpdatesHistory();
             bgpUpdatesHistory.getElements().forEach(update -> {
@@ -83,7 +87,7 @@ public class DisplayBgpConfigCli extends OsgiCommandSupport {
                 ps.println();
             });
         }
-        Cache cache = new Cache(bgpConfigurationManager);
+        Cache cache = new Cache(bgpManager);
         return cache.show(session);
     }
 }
index ad6141b01f149d678812d29b03ddcbebd7c8769d..0f839dea6feb6f6395eaf55a876290e88e3c6ab8 100644 (file)
@@ -17,7 +17,7 @@ import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.netvirt.bgpmanager.BgpConfigurationManager;
+import org.opendaylight.netvirt.bgpmanager.BgpManager;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.AsId;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.GracefulRestart;
@@ -72,10 +72,10 @@ public class Cache extends OsgiCommandSupport {
     private static final String RDSTR = "RD";
     private static final String MPSTR = "Maxpath";
 
-    private final BgpConfigurationManager bgpConfigurationManager;
+    private final BgpManager bgpManager;
 
-    public Cache(BgpConfigurationManager bgpConfigurationManager) {
-        this.bgpConfigurationManager = bgpConfigurationManager;
+    public Cache(BgpManager bgpManager) {
+        this.bgpManager = bgpManager;
     }
 
     private Object usage() {
@@ -98,6 +98,7 @@ public class Cache extends OsgiCommandSupport {
         boolean listVrfs = false;
         boolean listNets = false;
         PrintStream ps = System.out;
+
         if (action != null) {
             return usage();
         }
@@ -135,11 +136,11 @@ public class Cache extends OsgiCommandSupport {
             // legacy behaviour forces to check for a connection
             // that's initiated by default at startup without
             // writing to config.
-            String configHost = bgpConfigurationManager.getConfigHost();
-            int configPort = bgpConfigurationManager.getConfigPort();
+            String configHost = bgpManager.getConfigHost();
+            int configPort = bgpManager.getConfigPort();
             ps.printf("%nConfiguration Server%n\t%s  %s%n\t%s  %d%n",
                     HTSTR, configHost, PTSTR, configPort);
-            Bgp config = bgpConfigurationManager.getConfig();
+            Bgp config = bgpManager.getConfig();
             if (config == null) {
                 if (fileStream != null) {
                     fileStream.close();
index 18c148303095906a3867ce1d58e93887ba341b17..00e69431f8259a8768afe114eda29fc332360020 100644 (file)
@@ -12,7 +12,7 @@ import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.netvirt.bgpmanager.BgpConfigurationManager;
+import org.opendaylight.netvirt.bgpmanager.BgpManager;
 
 @Command(scope = "odl", name = "bgp-connect",
         description = "Add or delete client connection to BGP Config Server")
@@ -34,10 +34,10 @@ public class Connect extends OsgiCommandSupport {
             multiValued = false)
     String port = null;
 
-    private final BgpConfigurationManager bgpConfigurationManager;
+    private final BgpManager bgpManager;
 
-    public Connect(BgpConfigurationManager bgpConfigurationManager) {
-        this.bgpConfigurationManager = bgpConfigurationManager;
+    public Connect(BgpManager bgpManager) {
+        this.bgpManager = bgpManager;
     }
 
     private Object usage() {
@@ -59,14 +59,14 @@ public class Connect extends OsgiCommandSupport {
                     return null;
                 }
                 // check: already connected?
-                bgpConfigurationManager.startConfig(host, Integer.parseInt(port));
+                bgpManager.startConfig(host, Integer.parseInt(port));
                 break;
             case "del":
                 if (host != null || port != null) {
                     session.getConsole().println("note: option(s) not needed; ignored");
                 }
                 // check: nothing to stop?
-                bgpConfigurationManager.stopConfig();
+                bgpManager.stopConfig();
                 break;
             default:
                 return usage();
index 2382f46a1c447396051050b683281c21b1c15bd7..0e1a31463099dcbeaccb2cc018e8f68afc86ef0e 100644 (file)
@@ -12,7 +12,7 @@ import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.netvirt.bgpmanager.BgpConfigurationManager;
+import org.opendaylight.netvirt.bgpmanager.BgpManager;
 
 @Command(scope = "odl", name = "bgp-misc",
         description = "Add or delete miscellaneous BGP config options")
@@ -40,10 +40,10 @@ public class Misc extends OsgiCommandSupport {
             multiValued = false)
     private final String spt = null;
 
-    private final BgpConfigurationManager bgpConfigurationManager;
+    private final BgpManager bgpManager;
 
-    public Misc(BgpConfigurationManager bgpConfigurationManager) {
-        this.bgpConfigurationManager = bgpConfigurationManager;
+    public Misc(BgpManager bgpManager) {
+        this.bgpManager = bgpManager;
     }
 
     private Object usage() {
@@ -85,18 +85,18 @@ public class Misc extends OsgiCommandSupport {
         switch (action) {
             case "add":
                 if (spt != null && Commands.isValid(session.getConsole(), spt, Commands.Validators.INT, SP)) {
-                    bgpConfigurationManager.addGracefulRestart(Integer.parseInt(spt));
+                    bgpManager.configureGR(Integer.parseInt(spt));
                 }
                 if (file != null && level != null) {
-                    bgpConfigurationManager.addLogging(file, level);
+                    bgpManager.setQbgpLog(file, level);
                 }
                 break;
             case "del":
                 if (spt != null) {
-                    bgpConfigurationManager.delGracefulRestart();
+                    bgpManager.delGracefulRestart();
                 }
                 if (file != null && level != null) {
-                    bgpConfigurationManager.delLogging();
+                    bgpManager.delLogging();
                 }
                 break;
             default:
index 0bd7b68fb4bf49780dea00d05e7d42ca8e178a34..a29559532a2367c7d71a7e9e0772d6f3fd7e3809 100644 (file)
@@ -12,7 +12,7 @@ import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.netvirt.bgpmanager.BgpConfigurationManager;
+import org.opendaylight.netvirt.bgpmanager.BgpManager;
 import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_afi;
 import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_safi;
 
@@ -50,10 +50,10 @@ public class Multipath extends OsgiCommandSupport {
 
     String multipathEnable;
 
-    private final BgpConfigurationManager bgpConfigurationManager;
+    private final BgpManager bgpManager;
 
-    public Multipath(BgpConfigurationManager bgpConfigurationManager) {
-        this.bgpConfigurationManager = bgpConfigurationManager;
+    public Multipath(BgpManager bgpManager) {
+        this.bgpManager = bgpManager;
     }
 
     @Override
@@ -101,20 +101,18 @@ public class Multipath extends OsgiCommandSupport {
         }
 
         if (multipathEnable != null) {
-
             switch (multipathEnable) {
                 case "enable":
-                    bgpConfigurationManager.setMultipathStatus(afi, safi, true);
+                    bgpManager.enableMultipath(afi, safi);
                     break;
                 case "disable":
-                    bgpConfigurationManager.setMultipathStatus(afi, safi, false);
+                    bgpManager.disableMultipath(afi, safi);
                     break;
                 case "setmaxpath":
                     if (rd != null && maxpath != null) {
-                        bgpConfigurationManager.setMultipaths(rd, Integer.parseInt(maxpath));
+                        bgpManager.setMultipaths(rd, Integer.parseInt(maxpath));
                     }
                     break;
-
                 default:
                     return usage();
             }
index a281d49c47548022af2c40306f6dd1878ef98269..1dffc37ec2bba19a5f333187fe5a3d5b93706686 100644 (file)
@@ -13,7 +13,7 @@ import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.netvirt.bgpmanager.BgpConfigurationManager;
+import org.opendaylight.netvirt.bgpmanager.BgpManager;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.Bgp;
 import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.Neighbors;
 
@@ -49,10 +49,10 @@ public class Router extends OsgiCommandSupport {
             required = false, multiValued = false)
     private final String fbit = null;
 
-    private final BgpConfigurationManager bgpConfigurationManager;
+    private final BgpManager bgpManager;
 
-    public Router(BgpConfigurationManager bgpConfigurationManager) {
-        this.bgpConfigurationManager = bgpConfigurationManager;
+    public Router(BgpManager bgpManager) {
+        this.bgpManager = bgpManager;
     }
 
     private Object usage() {
@@ -101,14 +101,14 @@ public class Router extends OsgiCommandSupport {
                             return null;
                     }
                 }
-                bgpConfigurationManager.startBgp(asn, rid, stalePath, fb);
+                bgpManager.startBgp(asn, rid, stalePath, fb);
                 break;
             case "del":
                 // check: nothing to stop?
                 if (asNum != null || rid != null || spt != null || fbit != null) {
                     session.getConsole().println("note: option(s) not needed; ignored");
                 }
-                Bgp conf = bgpConfigurationManager.getConfig();
+                Bgp conf = bgpManager.getConfig();
                 if (conf == null) {
                     session.getConsole().println("error : no BGP configs present");
                     break;
@@ -119,7 +119,7 @@ public class Router extends OsgiCommandSupport {
                             + "before stopping the router instance");
                     break;
                 }
-                bgpConfigurationManager.stopBgp();
+                bgpManager.stopBgp();
                 break;
             default:
                 return usage();
index 32a280047c472fff4925a1677c1a0926343ea2eb..321086a8c35be4ad41860bcc7f932ca187dc0e91 100644 (file)
@@ -40,6 +40,7 @@ import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev1509
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 public final class BgpRouter {
     private static final Logger LOG = LoggerFactory.getLogger(BgpRouter.class);
 
@@ -47,6 +48,9 @@ public final class BgpRouter {
     private static final int GET_RTS_INIT = 0;
     private static final int GET_RTS_NEXT = 1;
     private static final int CONNECTION_TIMEOUT = 60000;
+    private static String configServerIP = "127.0.0.1";
+    private static int configServerPort = 7644;
+
 
     private enum Optype {
         START, STOP, NBR, VRF, PFX, SRC, MHOP, LOG, AF, GR, MP, VRFMP, EOR, DELAY_EOR, BFD, PEER_STATUS
@@ -63,6 +67,8 @@ public final class BgpRouter {
         List<String> irts;
         List<String> erts;
         long asNumber;
+        int holdTime;
+        int kaTime;
         layer_type thriftLayerType;
         protocol_type thriftProtocolType;
         int ethernetTag;
@@ -70,8 +76,6 @@ public final class BgpRouter {
         String macAddress;
         int l2label;
         int l3label;
-        int holdTime;
-        int kaTime;
         encap_type thriftEncapType;
         String routermac;
         public af_afi afi;
@@ -137,22 +141,22 @@ public final class BgpRouter {
                     + ", safi=" + safi
                     + '}' + '\n';
         }
-    }
-
 
+    }
 
     private final BgpOp bop = new BgpOp();
     private final Supplier<Bgp> bgpConfigSupplier;
     private final BooleanSupplier isBGPEntityOwner;
 
+
     private volatile TTransport transport;
     private volatile BgpConfigurator.Client bgpClient;
     private volatile boolean isConnected = false;
     private volatile long startTS;
     private volatile long connectTS;
     private volatile long lastConnectedTS;
-    private final TransactionHistory transactionHistory;
     private volatile boolean configServerUpdated = false;
+    private final TransactionHistory transactionHistory;
 
     private BgpRouter(Supplier<Bgp> bgpConfigSupplier, BooleanSupplier isBGPEntityOwner,
                       TransactionHistory transactionHistory) {
@@ -218,6 +222,7 @@ public final class BgpRouter {
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public synchronized boolean connect(String bgpHost, int bgpPort) {
         String msgPiece = "BGP config server at " + bgpHost + ":" + bgpPort;
 
@@ -261,9 +266,14 @@ public final class BgpRouter {
                             + "msg: {}; Exception :", bgpHost, bgpPort, msgPiece, tte);
                     connectRetry.errorOccured();
                 } else {
-                    //In Case of other exceptions we try only 3 times
-                    connectRetry.errorOccured(60);
+                    LOG.error("Failed connecting to BGP config server at {} : {}. msg: {}; Exception :",
+                            bgpHost, bgpPort, msgPiece, tte);
+                    //In Case of other exceptions we try only 18 times
+                    connectRetry.errorOccured(10);
                 }
+            } catch (Exception e) {
+                LOG.error("Failed connecting to BGP config server at {} : {}. msg: {}; Exception :",
+                        bgpHost, bgpPort, msgPiece, e);
             }
         } while (connectRetry.shouldRetry());
 
@@ -281,8 +291,12 @@ public final class BgpRouter {
         return isConnected;
     }
 
-    private TransactionType getTransactionType(BgpOp op) {
-        return op.add ? TransactionType.ADD : TransactionType.DELETE;
+    public static void setConfigServerIP(String configServerIP) {
+        BgpRouter.configServerIP = configServerIP;
+    }
+
+    public static void setConfigServerPort(int configServerPort) {
+        BgpRouter.configServerPort = configServerPort;
     }
 
     private void dispatch(BgpOp op) throws TException, BgpRouterException {
@@ -297,6 +311,10 @@ public final class BgpRouter {
         }
     }
 
+    private TransactionType getTransactionType(BgpOp op) {
+        return op.add ? TransactionType.ADD : TransactionType.DELETE;
+    }
+
     private void reConnect(TTransportException tte) {
         Bgp bgpConfig = bgpConfigSupplier.get();
         if (bgpConfig != null) {