NETVIRT-1282 updating default BGP config server port 7644
[netvirt.git] / bgpmanager / impl / src / main / java / org / opendaylight / netvirt / bgpmanager / BgpConfigurationManager.java
index b03a46b4bd9fe0f8954b80548af1a6dd16216320..4ccdca2cdf9ae5b247eeefa2fdffd165fb37c558 100755 (executable)
@@ -8,12 +8,14 @@
 package org.opendaylight.netvirt.bgpmanager;
 
 import com.google.common.base.Optional;
+import com.google.common.net.InetAddresses;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.NetworkInterface;
 import java.net.SocketException;
 import java.util.ArrayList;
@@ -140,14 +142,12 @@ public class BgpConfigurationManager {
     // to have stale FIB map (RD, Prefix)
     //  number of seconds wait for route sync-up between ODL and BGP
     private static final int BGP_RESTART_ROUTE_SYNC_SEC = 600;
-    private static final String DEF_LOGFILE = "/var/log/bgp_debug.log";
-    private static final String DEF_LOGLEVEL = "errors";
     private static final String UPDATE_PORT = "bgp.thrift.service.port";
     private static final String CONFIG_HOST = "vpnservice.bgpspeaker.host.name";
     private static final String CONFIG_PORT = "vpnservice.bgpspeaker.thrift.port";
     private static final String DEF_UPORT = "6644";
     private static final String DEF_CHOST = "255.255.255.255"; // Invalid Host IP
-    private static final String DEF_CPORT = "0";               // Invalid Port
+    private static final String DEF_CPORT = "7644";
     private static final String DEF_BGP_SDNC_MIP = "127.0.0.1";
     private static final String BGP_SDNC_MIP = "vpnservice.bgp.thrift.sdnc.mip";
     private static final int RESTART_DEFAULT_GR = 90;
@@ -178,7 +178,7 @@ public class BgpConfigurationManager {
     private volatile Bgp config;
     private final BgpRouter bgpRouter;
     private final BgpSyncHandle bgpSyncHandle = new BgpSyncHandle();
-    private BgpThriftService updateServer;
+    private volatile BgpThriftService bgpThriftService = null;
 
     private final CountDownLatch initer = new CountDownLatch(1);
 
@@ -243,8 +243,7 @@ public class BgpConfigurationManager {
         String updatePort = getProperty(UPDATE_PORT, DEF_UPORT);
         hostStartup = getProperty(CONFIG_HOST, DEF_CHOST);
         portStartup = getProperty(CONFIG_PORT, DEF_CPORT);
-        LOG.info("UpdateServer at localhost:" + updatePort + " ConfigServer at "
-                + hostStartup + ":" + portStartup);
+        LOG.info("ConfigServer at {}:{}", hostStartup, portStartup);
         VtyshCli.setHostAddr(hostStartup);
         ClearBgpCli.setHostAddr(hostStartup);
         bgpRouter = BgpRouter.newInstance(this::getConfig, this::isBGPEntityOwner);
@@ -262,8 +261,19 @@ public class BgpConfigurationManager {
             final WaitingServiceTracker<IBgpManager> tracker = WaitingServiceTracker.create(
                     IBgpManager.class, bundleContext);
             bgpManager = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
-            updateServer = new BgpThriftService(Integer.parseInt(updatePort), bgpManager, this);
-            updateServer.start();
+            if (InetAddresses.isInetAddress(getBgpSdncMipIp())) {
+                InetSocketAddress bgpThriftServerSocketAddr = new InetSocketAddress(getBgpSdncMipIp(),
+                        Integer.parseInt(updatePort));
+                bgpThriftService = new BgpThriftService(bgpThriftServerSocketAddr, bgpManager, this);
+                if (isBGPEntityOwner()) {
+                    //I am EoS owner of BGP, opening bgp thrift UPDATE-SERVER port.
+                    LOG.info("BGP Configuration manager initialized: UPDATE-SERVER started");
+                    bgpThriftService.start();
+                }
+                LOG.info("UPDATE server started :ip:port={}:{}", getBgpSdncMipIp(), updatePort);
+            } else {
+                LOG.error("Failed to init UPDATE server invalid ip:port={}:{}", getBgpSdncMipIp(), updatePort);
+            }
             LOG.info("BgpConfigurationManager initialized. IBgpManager={}", bgpManager);
         });
     }
@@ -339,8 +349,14 @@ public class BgpConfigurationManager {
     public void close() {
         executor.shutdown();
 
-        if (updateServer != null) {
-            updateServer.stop();
+        if (bgpThriftService != null) {
+            bgpThriftService.stop();
+            bgpThriftService = null;
+        }
+
+        if (isBgpConnected()) {
+            //disconnect the CONFIG SERVER port (which was )opened during I was Owner
+            bgpRouter.disconnect();
         }
 
         if (candidateRegistration != null) {
@@ -383,11 +399,25 @@ public class BgpConfigurationManager {
 
             if (ownershipChange.getState() == EntityOwnershipChangeState.LOCAL_OWNERSHIP_GRANTED) {
                 LOG.trace("This PL is the Owner");
-                activateMIP();
+                if (bgpThriftService != null) {
+                    //opening UPDATE-SERVER port.
+                    bgpThriftService.start();
+                } else {
+                    LOG.error("I am the owner of BGP entity, but bgpThriftService is not initialized yet");
+                }
                 bgpRestarted();
             } else {
                 LOG.debug("Not owner: hasOwner: {}, isOwner: {}", ownershipChange.getState().hasOwner(),
                         ownershipChange.getState().isOwner());
+                if ((bgpThriftService != null) && (bgpThriftService.isBgpThriftServiceStarted())) {
+                    //close the bgp Thrift Update-SERVER port opened on non-Entity Owner
+                    bgpThriftService.stop();
+                    bgpThriftService = null;
+                }
+                if (isBgpConnected()) {
+                    //disconnect the CONFIG SERVER port (which was )opened during I was Owner
+                    bgpRouter.disconnect();
+                }
             }
         });
     }
@@ -498,7 +528,7 @@ public class BgpConfigurationManager {
             synchronized (BgpConfigurationManager.this) {
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for asNum {}; {}", YANG_OBJ, val.getLocalAs(),
+                    LOG.debug("{} Unable to process add for asNum {}; {} {}", YANG_OBJ, val.getLocalAs(),
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -529,7 +559,7 @@ public class BgpConfigurationManager {
                 long asNum = val.getLocalAs();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for asNum {}; {}", YANG_OBJ, asNum,
+                    LOG.debug("{} Unable to process remove for asNum {}; {} {}", YANG_OBJ, asNum,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -589,7 +619,7 @@ public class BgpConfigurationManager {
                 int stalePathTime = val.getStalepathTime().intValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.error("{} Unable to add stale-path time {}; {}", YANG_OBJ, stalePathTime,
+                    LOG.error("{} Unable to add stale-path time {}; {} {}", YANG_OBJ, stalePathTime,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -620,7 +650,7 @@ public class BgpConfigurationManager {
             synchronized (BgpConfigurationManager.this) {
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.error("{} Unable to delete stale-path time; {}", YANG_OBJ,
+                    LOG.error("{} Unable to delete stale-path time; {} {}", YANG_OBJ,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -643,7 +673,7 @@ public class BgpConfigurationManager {
                 int stalePathTime = newval.getStalepathTime().intValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.error("{} Unable to update stale-path time to {}; {}", YANG_OBJ, stalePathTime,
+                    LOG.error("{} Unable to update stale-path time to {}; {} {}", YANG_OBJ, stalePathTime,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -674,7 +704,7 @@ public class BgpConfigurationManager {
             synchronized (BgpConfigurationManager.this) {
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.error("{} Unable to add logging for qbgp; {}", YANG_OBJ,
+                    LOG.error("{} Unable to add logging for qbgp; {} {}", YANG_OBJ,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -705,12 +735,12 @@ public class BgpConfigurationManager {
             synchronized (BgpConfigurationManager.this) {
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.error("{} Unable to remove logging for qbgp; {}", YANG_OBJ,
+                    LOG.error("{} Unable to remove logging for qbgp; {} {}", YANG_OBJ,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
                 try {
-                    br.setLogging(DEF_LOGFILE, DEF_LOGLEVEL);
+                    br.setLogging(BgpConstants.BGP_DEF_LOG_FILE, BgpConstants.BGP_DEF_LOG_LEVEL);
                 } catch (TException | BgpRouterException e) {
                     LOG.error("{} Delete received exception; {}", YANG_OBJ, DEL_WARN, e);
                 }
@@ -726,7 +756,7 @@ public class BgpConfigurationManager {
             synchronized (BgpConfigurationManager.this) {
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.error("{} Unable to update logging for qbgp; {}", YANG_OBJ,
+                    LOG.error("{} Unable to update logging for qbgp; {} {}", YANG_OBJ,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -761,7 +791,7 @@ public class BgpConfigurationManager {
                 final String md5Secret = extractMd5Secret(val);
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for peer {} as {}; {}", YANG_OBJ, peerIp, as,
+                    LOG.debug("{} Unable to process add for peer {} as {}; {} {}", YANG_OBJ, peerIp, as,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -795,7 +825,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getAddress().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process remove for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -843,7 +873,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getPeerIp().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process add for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -875,7 +905,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getPeerIp().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process remove for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -917,7 +947,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getPeerIp().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process add for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -949,7 +979,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getPeerIp().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process remove for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -991,7 +1021,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getPeerIp().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process add for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -1025,7 +1055,7 @@ public class BgpConfigurationManager {
                 String peerIp = val.getPeerIp().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for peer {}; {}", YANG_OBJ, peerIp,
+                    LOG.debug("{} Unable to process remove for peer {}; {} {}", YANG_OBJ, peerIp,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -1076,8 +1106,8 @@ public class BgpConfigurationManager {
                 String nh = val.getNexthop().getValue();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for rd {} prefix {} nexthop {}; {}", YANG_OBJ, rd, pfxlen, nh,
-                            BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
+                    LOG.debug("{} Unable to process add for rd {} prefix {} nexthop {}; {} {}", YANG_OBJ, rd, pfxlen,
+                            nh, BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
                 Long label = val.getLabel();
@@ -1120,7 +1150,7 @@ public class BgpConfigurationManager {
                 String pfxlen = val.getPrefixLen();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for rd {} prefix {}; {}", YANG_OBJ, rd, pfxlen,
+                    LOG.debug("{} Unable to process remove for rd {} prefix {}; {} {}", YANG_OBJ, rd, pfxlen,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -1199,7 +1229,7 @@ public class BgpConfigurationManager {
                 String rd = vrfs.getRd();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for rd {}; {}", YANG_OBJ, rd,
+                    LOG.debug("{} Unable to process add for rd {}; {} {}", YANG_OBJ, rd,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -1207,8 +1237,8 @@ public class BgpConfigurationManager {
                     List<AddressFamiliesVrf> vrfAddrFamilyList = vrfs.getAddressFamiliesVrf();
                     for (AddressFamiliesVrf vrfAddrFamily : vrfAddrFamilyList) {
                         /*add to br the new vrfs arguments*/
-                        br.addVrf(BgpUtil.getLayerType(vrfAddrFamily), rd, vrfs.getImportRts(), vrfs.getExportRts(),
-                                vrfAddrFamily.getAfi(), vrfAddrFamily.getSafi());
+                        br.addVrf(BgpUtil.getLayerType(vrfAddrFamily), rd, vrfs.getImportRts(), vrfs.getExportRts()
+                        );
                     }
                     /*add to br the vrfs contained in mapNewAdFamily*/
                     List<AddressFamiliesVrf> vrfAddrFamilyListFromMap = mapNewAdFamily.get(rd);
@@ -1221,8 +1251,8 @@ public class BgpConfigurationManager {
                             mapNewAdFamily.remove(rd);
                         } else  if (adf != null) {
 
-                            br.addVrf(BgpUtil.getLayerType(adf), rd, vrfs.getImportRts(), vrfs.getExportRts(),
-                                    adf.getAfi(), adf.getSafi());
+                            br.addVrf(BgpUtil.getLayerType(adf), rd, vrfs.getImportRts(), vrfs.getExportRts()
+                            );
                             // remove AddressFamiliesVrf which was already added to BGP
                             vrfAddrFamilyListFromMap.remove(adf);
                             if (vrfAddrFamilyListFromMap.isEmpty()) {
@@ -1233,7 +1263,7 @@ public class BgpConfigurationManager {
                         }
                     }
                 } catch (TException | BgpRouterException e) {
-                    LOG.error("{} get {}, Add received exception; {}", YANG_OBJ, ADD_WARN, e);
+                    LOG.error("{} get {}, Add received exception", YANG_OBJ, ADD_WARN, e);
                 }
             }
         }
@@ -1258,7 +1288,7 @@ public class BgpConfigurationManager {
                 String rd = val.getRd();
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process remove for rd {}; {}", YANG_OBJ, rd,
+                    LOG.debug("{} Unable to process remove for rd {}; {} {}", YANG_OBJ, rd,
                             BgpRouterException.BGP_ERR_NOT_INITED, DEL_WARN);
                     return;
                 }
@@ -1320,7 +1350,7 @@ public class BgpConfigurationManager {
             if (rd != null) {
                 BgpRouter br = getClient(YANG_OBJ);
                 if (br == null) {
-                    LOG.debug("{} Unable to process add for rd {}; {}", YANG_OBJ, rd,
+                    LOG.debug("{} Unable to process add for rd {}; {} {}", YANG_OBJ, rd,
                             BgpRouterException.BGP_ERR_NOT_INITED, ADD_WARN);
                     return;
                 }
@@ -1329,7 +1359,7 @@ public class BgpConfigurationManager {
                     try {
                         LOG.debug("call addVRf rd {} afi {} safi {}", rd, adfvrf.getAfi(), adfvrf.getSafi());
                         br.addVrf(BgpUtil.getLayerType(adfvrf), rd, newval.getImportRts(),
-                                newval.getExportRts(), adfvrf.getAfi(), adfvrf.getSafi());
+                                newval.getExportRts());
                     } catch (TException | BgpRouterException e) {
                         LOG.error("{} Add received exception; {}", YANG_OBJ, ADD_WARN, e);
                     }
@@ -1482,7 +1512,7 @@ public class BgpConfigurationManager {
                                     br.disableMultipath(afi, safi);
                                 }
                             } catch (TException | BgpRouterException e) {
-                                LOG.error(YANG_OBJ + " received exception: \"" + e + "\"");
+                                LOG.error("{} received exception", YANG_OBJ, e);
                             }
                         }
                     }
@@ -1535,11 +1565,10 @@ public class BgpConfigurationManager {
                         if (br != null) {
                             try {
                                 br.multipaths(vrfMaxpathVal.getRd(), vrfMaxpathVal.getMaxpaths());
-                                LOG.debug("Maxpath for vrf: " + vrfMaxpathVal.getRd() + " : is "
-                                        vrfMaxpathVal.getMaxpaths());
+                                LOG.debug("Maxpath for vrf {} is {}", vrfMaxpathVal.getRd(),
+                                        vrfMaxpathVal.getMaxpaths());
                             } catch (TException | BgpRouterException e) {
-                                LOG.error(YANG_OBJ
-                                        + " received exception: \"" + e + "\"");
+                                LOG.error("{} received exception", YANG_OBJ, e);
                             }
                         }
                     }
@@ -1731,8 +1760,6 @@ public class BgpConfigurationManager {
                            prefix,
                            plen,
                            nexthop,
-                           update.getEthtag(),
-                           update.getEsi(),
                            update.getMacaddress(),
                            label,
                            l2label,
@@ -1780,7 +1807,7 @@ public class BgpConfigurationManager {
      */
 
     public void onUpdatePushRoute(protocol_type protocolType, String rd, String prefix, int plen, String nextHop,
-            int ethtag, String esi, String macaddress, int label, int l2label, String routermac, af_afi afi) {
+                                  String macaddress, int label, int l2label, String routermac, af_afi afi) {
         boolean addroute = false;
         boolean macupdate = false;
         long l3vni = 0L;
@@ -1838,7 +1865,7 @@ public class BgpConfigurationManager {
                     rd, prefix, nextHop, label, afi);
             // TODO: modify addFibEntryToDS signature
             List<String> nextHopList = Collections.singletonList(nextHop);
-            fibDSWriter.addFibEntryToDS(rd, macaddress, prefix + "/" + plen, nextHopList, encapType, label, l3vni,
+            fibDSWriter.addFibEntryToDS(rd, prefix + "/" + plen, nextHopList, encapType, label, l3vni,
                                         routermac, RouteOrigin.BGP);
             LOG.info("ADD: Added Fib entry rd {} prefix {} nexthop {} label {}", rd, prefix, nextHop, label);
             String vpnName = bgpUtil.getVpnNameFromRd(rd);
@@ -1858,10 +1885,10 @@ public class BgpConfigurationManager {
             if (vpnInstanceOpDataEntry != null) {
                 vni = vpnInstanceOpDataEntry.getL3vni();
                 if (vpnInstanceOpDataEntry.getType() == VpnInstanceOpDataEntry.Type.L2) {
-                    LOG.debug("Got RT2 withdraw for RD %s from tep %s with mac %s remote RD %s",
+                    LOG.debug("Got RT2 withdraw for RD {} {} from tep {} with mac {} remote RD {}",
                             vpnInstanceOpDataEntry.getVpnInstanceName(), vni, nextHop, macaddress, rd);
                     deleteTepfromElanDS(rd, nextHop, macaddress);
-                    LOG.debug("For rd %s. skipping fib update", rd);
+                    LOG.debug("For rd {}. skipping fib update", rd);
                     macupdate = true;
                 }
             } else {
@@ -2066,11 +2093,8 @@ public class BgpConfigurationManager {
         LOG.error("connecting  to bgp host {} ", host);
         boolean res = bgpRouter.connect(host, port);
         if (!res) {
-            String msg = "Cannot connect to BGP config server at " + host + ":" + port;
-            if (config != null) {
-                msg += "; Configuration Replay aborted";
-            }
-            LOG.error(msg);
+            LOG.error("Cannot connect to BGP config server at {}:{}{}", host, port,
+                    config != null ? "; Configuration Replay aborted" : "");
             return replaySucceded;
         }
         config = getConfig();
@@ -2191,7 +2215,7 @@ public class BgpConfigurationManager {
             for (AddressFamiliesVrf adf : vrf.getAddressFamiliesVrf()) {
                 try {
                     br.addVrf(BgpUtil.getLayerType(adf), vrf.getRd(), vrf.getImportRts(),
-                            vrf.getExportRts(), adf.getAfi(), adf.getSafi());
+                            vrf.getExportRts());
                 } catch (TException | BgpRouterException e) {
                     LOG.error("Replay:addVrf() received exception", e);
                 }
@@ -2246,7 +2270,7 @@ public class BgpConfigurationManager {
                             br.disableMultipath(afi, safi);
                         }
                     } catch (TException | BgpRouterException e) {
-                        LOG.info("Replay:multipaths() received exception: \"" + e + "\"");
+                        LOG.info("Replay:multipaths() received exception", e);
                     }
                 }
             }
@@ -2257,7 +2281,7 @@ public class BgpConfigurationManager {
                 try {
                     br.multipaths(vrfMaxpath.getRd(), vrfMaxpath.getMaxpaths());
                 } catch (TException | BgpRouterException e) {
-                    LOG.info("Replay:vrfMaxPath() received exception: \"" + e + "\"");
+                    LOG.info("Replay:vrfMaxPath() received exception", e);
                 }
             }
         }
@@ -2282,11 +2306,11 @@ public class BgpConfigurationManager {
     }
 
     private <T extends DataObject> void update(InstanceIdentifier<T> iid, T dto) {
-        bgpUtil.update(LogicalDatastoreType.CONFIGURATION, iid, dto);
+        bgpUtil.update(iid, dto);
     }
 
     private <T extends DataObject> void delete(InstanceIdentifier<T> iid) {
-        bgpUtil.delete(LogicalDatastoreType.CONFIGURATION, iid);
+        bgpUtil.delete(iid);
     }
 
     public void startConfig(String bgpHost, int thriftPort) {
@@ -2753,7 +2777,7 @@ public class BgpConfigurationManager {
                 rt2TepMap.get(rd).get(tepIp).put(mac, l2vni);
             } else {
                 LOG.debug("RT2 with mac {} l2vni {} from existing rd {} and new tep-ip {}",
-                        mac, rd, tepIp);
+                        mac, l2vni, rd, tepIp);
                 isFirstMacUpdateFromTep = true;
                 Map<String, Long> macList = new HashMap<>();
                 macList.put(mac, l2vni);