Drop unused exceptions in bgpmanager 07/68507/4
authorStephen Kitt <skitt@redhat.com>
Thu, 22 Feb 2018 18:58:05 +0000 (19:58 +0100)
committerSam Hague <shague@redhat.com>
Fri, 23 Feb 2018 15:19:01 +0000 (15:19 +0000)
Change-Id: I7edc49d7c3b7cf80660414b915ad9b948c2b51b5
Signed-off-by: Stephen Kitt <skitt@redhat.com>
17 files changed:
bgpmanager/api/src/main/java/org/opendaylight/netvirt/bgpmanager/api/IBgpManager.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpConfigurationManager.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/BgpManager.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/ConfigureBgpCli.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/VtyshCli.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/Neighbor.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Network.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Router.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/commands/Vrf.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/oam/BgpAlarms.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/oam/BgpCounters.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/thrift/client/BgpRouter.java
bgpmanager/impl/src/main/java/org/opendaylight/netvirt/bgpmanager/thrift/server/BgpThriftService.java

index c6a26fb8332093863d42556decadffe4899f6777..41b3374309c2a6cc426e47c3732148593fa654c1 100644 (file)
@@ -24,10 +24,8 @@ public interface IBgpManager {
      * @param importRts the import rd(s) for this vrf
      * @param exportRts the export rd(s) for this vrf
      * @param addressFamily  is used to pass the nature of the VPN context : IPv4, IPv6, or EVPN.
-     * @throws Exception an exception could be raise (see the implementation method).
      */
-    void addVrf(String rd, Collection<String> importRts, Collection<String> exportRts, AddressFamily addressFamily)
-            throws Exception;
+    void addVrf(String rd, Collection<String> importRts, Collection<String> exportRts, AddressFamily addressFamily);
 
     /** Delete onv VPN table.
      * VPN contexts apply to MPLS or VXLAN overlays.
@@ -46,14 +44,14 @@ public interface IBgpManager {
      */
     void addPrefix(String rd, String macAddress, String prefix, List<String> nextHopList,
                           VrfEntry.EncapType encapType, int vpnLabel, long l3vni, String gatewayMac,
-                          RouteOrigin origin) throws Exception;
+                          RouteOrigin origin);
 
     /**
      * Adds a route in a BGP neighbour. It persists the VrfEntry in Datastore and sends the BGP message.
      */
     void addPrefix(String rd, String macAddress, String prefix, String nextHop,
                           VrfEntry.EncapType encapType, int vpnLabel, long l3vni, String gatewayMac,
-                          RouteOrigin origin) throws Exception;
+                          RouteOrigin origin);
 
     void deletePrefix(String rd, String prefix);
 
index 9801f767f3edba7e2320478ef4a9cec509ac7f0e..b03a46b4bd9fe0f8954b80548af1a6dd16216320 100755 (executable)
@@ -233,8 +233,7 @@ public class BgpConfigurationManager {
             final IVpnLinkService vpnLinkSrvce,
             final BundleContext bundleContext,
             final BgpUtil bgpUtil,
-            final MetricProvider metricProvider)
-            throws InterruptedException, ExecutionException, TimeoutException {
+            final MetricProvider metricProvider) {
         this.dataBroker = dataBroker;
         this.fibDSWriter = fibDSWriter;
         this.vpnLinkService = vpnLinkSrvce;
@@ -1692,11 +1691,11 @@ public class BgpConfigurationManager {
         }
     }
 
-    private void doRouteSync() throws InterruptedException, TimeoutException, ExecutionException {
+    private void doRouteSync() {
         LOG.error("Starting BGP route sync");
         try {
             bgpRouter.initRibSync(bgpSyncHandle);
-        } catch (TException | BgpRouterException e) {
+        } catch (BgpRouterException e) {
             LOG.error("Route sync aborted, exception when initializing", e);
             return;
         }
@@ -1745,7 +1744,7 @@ public class BgpConfigurationManager {
         try {
             LOG.error("Ending BGP route-sync");
             bgpRouter.endRibSync(bgpSyncHandle);
-        } catch (TException | BgpRouterException e) {
+        } catch (BgpRouterException e) {
             // Ignored?
         }
     }
@@ -1781,8 +1780,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)
-            throws InterruptedException, ExecutionException, TimeoutException {
+            int ethtag, String esi, String macaddress, int label, int l2label, String routermac, af_afi afi) {
         boolean addroute = false;
         boolean macupdate = false;
         long l3vni = 0L;
@@ -1852,7 +1850,7 @@ public class BgpConfigurationManager {
     }
 
     public void onUpdateWithdrawRoute(protocol_type protocolType, String rd, String prefix, int plen, String nextHop,
-            String macaddress) throws InterruptedException, ExecutionException, TimeoutException {
+            String macaddress) {
         long vni = 0L;
         boolean macupdate = false;
         if (protocolType.equals(protocol_type.PROTOCOL_EVPN)) {
index 86782ed0fb4e21b738193b508d71be4acbdad782..36f3031f4aa5a7acdf8ed98befe2388f697de5e1 100644 (file)
@@ -17,7 +17,6 @@ import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import org.apache.thrift.TException;
 import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.bgpmanager.oam.BgpAlarmErrorCodes;
 import org.opendaylight.netvirt.bgpmanager.oam.BgpConstants;
@@ -53,7 +52,7 @@ public class BgpManager implements AutoCloseable, IBgpManager {
 
     @Override
     @PreDestroy
-    public void close() throws Exception {
+    public void close() {
         LOG.info("{} close", getClass().getSimpleName());
     }
 
@@ -61,38 +60,38 @@ public class BgpManager implements AutoCloseable, IBgpManager {
         return bcm;
     }
 
-    public void configureGR(int stalepathTime) throws TException {
+    public void configureGR(int stalepathTime) {
         bcm.addGracefulRestart(stalepathTime);
     }
 
-    public void delGracefulRestart() throws Exception {
+    public void delGracefulRestart() {
         bcm.delGracefulRestart();
     }
 
     public void addNeighbor(String ipAddress, long asNum,
-            @Nullable final TcpMd5SignaturePasswordType md5Password) throws TException {
+            @Nullable final TcpMd5SignaturePasswordType md5Password) {
         bcm.addNeighbor(ipAddress, asNum, md5Password);
     }
 
-    public void addEbgpMultihop(String ipAddress, int nhops) throws TException {
+    public void addEbgpMultihop(String ipAddress, int nhops) {
         bcm.addEbgpMultihop(ipAddress, nhops);
     }
 
-    public void addUpdateSource(String ipAddress, String srcIp) throws TException {
+    public void addUpdateSource(String ipAddress, String srcIp) {
         bcm.addUpdateSource(ipAddress, srcIp);
     }
 
-    public void addAddressFamily(String ipAddress, af_afi afi, af_safi safi) throws TException {
+    public void addAddressFamily(String ipAddress, af_afi afi, af_safi safi) {
         bcm.addAddressFamily(ipAddress, afi.getValue(), safi.getValue());
     }
 
-    public void deleteNeighbor(String ipAddress) throws TException {
+    public void deleteNeighbor(String ipAddress) {
         bcm.delNeighbor(ipAddress);
     }
 
     @Override
     public void addVrf(String rd, Collection<String> importRts, Collection<String> exportRts,
-            AddressFamily addressFamily) throws Exception {
+            AddressFamily addressFamily) {
         bcm.addVrf(rd, new ArrayList<>(importRts), new ArrayList<>(exportRts),  addressFamily);
     }
 
@@ -112,8 +111,7 @@ public class BgpManager implements AutoCloseable, IBgpManager {
     @Override
     public void addPrefix(String rd, String macAddress, String prefix, List<String> nextHopList,
                           VrfEntry.EncapType encapType, int vpnLabel, long l3vni,
-                          String gatewayMac, RouteOrigin origin)
-            throws Exception {
+                          String gatewayMac, RouteOrigin origin) {
         fibDSWriter.addFibEntryToDS(rd, macAddress, prefix, nextHopList,
                 encapType, vpnLabel, l3vni, gatewayMac, origin);
         bcm.addPrefix(rd, macAddress, prefix, nextHopList,
@@ -122,7 +120,7 @@ public class BgpManager implements AutoCloseable, IBgpManager {
 
     @Override
     public void addPrefix(String rd, String macAddress, String prefix, String nextHop, VrfEntry.EncapType encapType,
-                          int vpnLabel, long l3vni, String gatewayMac, RouteOrigin origin) throws Exception {
+                          int vpnLabel, long l3vni, String gatewayMac, RouteOrigin origin) {
         addPrefix(rd, macAddress, prefix, Collections.singletonList(nextHop), encapType, vpnLabel, l3vni,
                 gatewayMac, origin);
     }
@@ -136,7 +134,7 @@ public class BgpManager implements AutoCloseable, IBgpManager {
     @Override
     public void advertisePrefix(String rd, String macAddress, String prefix, List<String> nextHopList,
                                 VrfEntry.EncapType encapType, long vpnLabel, long l3vni, long l2vni,
-                                String gatewayMac) throws Exception {
+                                String gatewayMac) {
         LOG.info("Advertise Prefix: Adding Prefix rd {} prefix {} label {} l3vni {} l2vni {}",
                 rd, prefix, vpnLabel, l3vni, l2vni);
         bcm.addPrefix(rd, macAddress, prefix, nextHopList,
@@ -148,7 +146,7 @@ public class BgpManager implements AutoCloseable, IBgpManager {
     @Override
     public void advertisePrefix(String rd, String macAddress, String prefix, String nextHop,
                                 VrfEntry.EncapType encapType, long vpnLabel, long l3vni, long l2vni,
-                                String gatewayMac) throws Exception {
+                                String gatewayMac) {
         LOG.info("ADVERTISE: Adding Prefix rd {} prefix {} nexthop {} label {} l3vni {} l2vni {}",
                 rd, prefix, nextHop, vpnLabel, l3vni, l2vni);
         bcm.addPrefix(rd, macAddress, prefix, Collections.singletonList(nextHop), encapType,
index 422bf7eea5208b6581acaeee082d2a6ebd61cf0a..a605b3e25de50c1f1c7af685f4dc2bc0c781d9b2 100644 (file)
@@ -14,7 +14,6 @@ import java.util.List;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.apache.thrift.TException;
 import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_afi;
 import org.opendaylight.netvirt.bgpmanager.thrift.gen.af_safi;
 import org.opendaylight.netvirt.bgpmanager.thrift.gen.protocol_type;
@@ -115,48 +114,44 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
 
     @Override
     protected Object doExecute() throws Exception {
-        try {
-            if (op == null) {
-                session.getConsole().println("Please provide valid operation");
+        if (op == null) {
+            session.getConsole().println("Please provide valid operation");
+            usage();
+            session.getConsole().println(
+                    "exec configure-bgp -op [start-bgp-server | stop-bgp-server | add-neighbor | delete-neighbor|"
+                            + " add-route | delete-route | graceful-restart| enable-log ]");
+        }
+        switch (op) {
+            case "start-bgp-server":
+                startBgp();
+                break;
+            case "stop-bgp-server":
+                stopBgp();
+                break;
+            case "add-neighbor":
+                addNeighbor();
+                break;
+            case "delete-neighbor":
+                deleteNeighbor();
+                break;
+            case "add-route":
+                addRoute();
+                break;
+            case "delete-route":
+                deleteRoute();
+                break;
+            case "graceful-restart":
+                configureGR();
+                break;
+            case "enable-log":
+                enableBgpLogLevel();
+                break;
+            default:
+                session.getConsole().println("invalid operation");
                 usage();
                 session.getConsole().println(
-                        "exec configure-bgp -op [start-bgp-server | stop-bgp-server | add-neighbor | delete-neighbor|"
-                                + " add-route | delete-route | graceful-restart| enable-log ]");
-            }
-            switch (op) {
-                case "start-bgp-server":
-                    startBgp();
-                    break;
-                case "stop-bgp-server":
-                    stopBgp();
-                    break;
-                case "add-neighbor":
-                    addNeighbor();
-                    break;
-                case "delete-neighbor":
-                    deleteNeighbor();
-                    break;
-                case "add-route":
-                    addRoute();
-                    break;
-                case "delete-route":
-                    deleteRoute();
-                    break;
-                case "graceful-restart":
-                    configureGR();
-                    break;
-                case "enable-log":
-                    enableBgpLogLevel();
-                    break;
-                default:
-                    session.getConsole().println("invalid operation");
-                    usage();
-                    session.getConsole().println(
-                            "exec configure-bgp -op [start-bgp-server | stop-bgp-server | add-neighbor | "
-                                    + "delete-neighbor| graceful-restart| enable-log ]");
-            }
-        } catch (TException e) {
-            log.error("failed to handle the command", e);
+                        "exec configure-bgp -op [start-bgp-server | stop-bgp-server | add-neighbor | "
+                                + "delete-neighbor| graceful-restart| enable-log ]");
         }
         return null;
     }
@@ -177,7 +172,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
         return true;
     }
 
-    private void configureGR() throws TException {
+    private void configureGR() {
         boolean validStalepathTime = validateStalepathTime();
         if (!validStalepathTime) {
             return;
@@ -185,7 +180,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
         bgpManager.configureGR(Integer.parseInt(stalePathTime));
     }
 
-    private void deleteNeighbor() throws TException {
+    private void deleteNeighbor() {
         if (ip == null || !validateIp(ip)) {
             session.getConsole().println("invalid neighbor ip");
             printDeleteNeighborHelp();
@@ -295,7 +290,7 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
                 stalePathTime == null ? 0 : Integer.parseInt(stalePathTime), false);
     }
 
-    protected void addNeighbor() throws TException {
+    protected void addNeighbor() {
         if (!validateAsNumber(asNumber)) {
             printAddNeighborHelp();
             return;
@@ -370,12 +365,12 @@ public class ConfigureBgpCli extends OsgiCommandSupport {
         }
     }
 
-    protected void addRoute() throws Exception {
+    protected void addRoute() {
         bgpConfigurationManager.onUpdatePushRoute(protocol_type.PROTOCOL_EVPN, rd, prefix,
                 0, nexthop, 0, null, mac, l3vni, l2vni, null, null);
     }
 
-    protected void deleteRoute() throws Exception {
+    protected void deleteRoute() {
         bgpConfigurationManager.onUpdateWithdrawRoute(protocol_type.PROTOCOL_EVPN, rd, prefix,
                 0, nexthop, mac);
     }
index 10f916b1dec29d6aef7dd6dcb383999caf26300e..ca24351cf51ccba4ee36d69a29c4cdde49abcdb0 100644 (file)
@@ -61,7 +61,7 @@ public class VtyshCli extends OsgiCommandSupport {
     };
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         int handlerModule = 0;
         cmd = cmd.trim();
         if (cmd.equals("") || cmd.equals("help") || cmd.equals("-help") || cmd.equals("--help")) {
index e963cc2b1128f6be4fcfd0a4ec2434c1ecdb21ae..9799643e3105941ff888f53572474309dfb1f69b 100644 (file)
@@ -83,18 +83,18 @@ public class Cache extends OsgiCommandSupport {
         return null;
     }
 
-    public Object show(CommandSession session) throws Exception {
+    public Object show(CommandSession session) {
         this.session = session;
         return doExecute();
     }
 
-    public Object show() throws Exception {
+    public Object show() {
         return doExecute();
     }
 
     @SuppressWarnings("resource")
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         boolean listVrfs = false;
         boolean listNets = false;
         PrintStream ps = session.getConsole();
index 0db68f030e4a989c22093c623a3405f6178b97ea..00e69431f8259a8768afe114eda29fc332360020 100644 (file)
@@ -47,7 +47,7 @@ public class Connect extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         switch (action) {
             case "add":
                 if (host == null || port == null) {
index e2a7fd1f6ead44f6396ee088965939761ad5912d..0e1a31463099dcbeaccb2cc018e8f68afc86ef0e 100644 (file)
@@ -71,7 +71,7 @@ public class Misc extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         if (spt == null && file == null && level == null) {
             return usage();
         }
index 54f0b6e23b92bf4d9510a02d376029627c3a4201..1c577e03f9854f3aff228c7a59ccca123b993320 100644 (file)
@@ -58,7 +58,7 @@ public class Multipath extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         af_afi afi = af_afi.findByValue(1);
         af_safi safi = af_safi.findByValue(5);
 
index 784cfe4617d8852af80caf80a82e3378309dddbd..edddf7a6fec81f9d861c91c023a05a1dabfc2961 100644 (file)
@@ -82,7 +82,7 @@ public class Neighbor extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         switch (action) {
             case "add":
                 if (nbrIp == null) {
index 00a19d3115d52a054e75f425fbe6448087ea92eb..2c4270a9a6eb3cf31fa1cad5bdf3b47f5b2b294d 100644 (file)
@@ -79,7 +79,7 @@ public class Network extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         switch (action) {
             case "add":
                 int label = qbgpConstants.LBL_EXPLICIT_NULL;
index 2fd2d90f340454f7574922515f1d91d30432fd3d..e250107a2b205bc9502d915778e88abf12168b26 100644 (file)
@@ -63,7 +63,7 @@ public class Router extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         switch (action) {
             case "add":
                 // check: rtr already running?
index fc0e3151a052fdc63d6cbdcb7bb50cfe8f66d1a8..c4d1aa32d3c91d420b84e60be616613e7bada75f 100644 (file)
@@ -63,7 +63,7 @@ public class Vrf extends OsgiCommandSupport {
     }
 
     @Override
-    protected Object doExecute() throws Exception {
+    protected Object doExecute() {
         AddressFamily af = null;
         if (addrf.compareToIgnoreCase("IPV_4") == 0) {
             af = AddressFamily.IPV4;
index be11e713bc2e931638927aab37ce218c45813c92..ddcd417ab57a019af8ee04b80534a45845a3cc99 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.netvirt.bgpmanager.oam;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -54,37 +53,33 @@ public class BgpAlarms implements Runnable, AutoCloseable {
     @Override
     public void run() {
         List<Neighbors> nbrList = null;
-        try {
-            LOG.debug("Fetching neighbor status' from BGP");
-            BgpCounters.resetFile(BgpCounters.BGP_VPNV4_SUMMARY_FILE);
-            BgpCounters.resetFile(BgpCounters.BGP_VPNV6_SUMMARY_FILE);
-            BgpCounters.resetFile(BgpCounters.BGP_EVPN_SUMMARY_FILE);
-            Map<String, String> neighborStatusMap = new HashMap<>();
-
-            if (bgpMgr.getBgpCounters() != null) {
-                bgpMgr.getBgpCounters().fetchCmdOutputs(BgpCounters.BGP_VPNV4_SUMMARY_FILE,
-                        "show ip bgp vpnv4 all summary");
-                if (bgpMgr.getConfig() != null) {
-                    nbrList = bgpMgr.getConfig().getNeighbors();
-                }
-                BgpCounters.parseIpBgpVpnv4AllSummary(neighborStatusMap);
+        LOG.debug("Fetching neighbor status' from BGP");
+        BgpCounters.resetFile(BgpCounters.BGP_VPNV4_SUMMARY_FILE);
+        BgpCounters.resetFile(BgpCounters.BGP_VPNV6_SUMMARY_FILE);
+        BgpCounters.resetFile(BgpCounters.BGP_EVPN_SUMMARY_FILE);
+        Map<String, String> neighborStatusMap = new HashMap<>();
+
+        if (bgpMgr.getBgpCounters() != null) {
+            bgpMgr.getBgpCounters().fetchCmdOutputs(BgpCounters.BGP_VPNV4_SUMMARY_FILE,
+                    "show ip bgp vpnv4 all summary");
+            if (bgpMgr.getConfig() != null) {
+                nbrList = bgpMgr.getConfig().getNeighbors();
+            }
+            BgpCounters.parseIpBgpVpnv4AllSummary(neighborStatusMap);
 
-                bgpMgr.getBgpCounters().fetchCmdOutputs(BgpCounters.BGP_VPNV6_SUMMARY_FILE,
-                        "show ip bgp vpnv6 all summary");
+            bgpMgr.getBgpCounters().fetchCmdOutputs(BgpCounters.BGP_VPNV6_SUMMARY_FILE,
+                    "show ip bgp vpnv6 all summary");
 
-                BgpCounters.parseIpBgpVpnv6AllSummary(neighborStatusMap);
+            BgpCounters.parseIpBgpVpnv6AllSummary(neighborStatusMap);
 
-                bgpMgr.getBgpCounters().fetchCmdOutputs(BgpCounters.BGP_EVPN_SUMMARY_FILE,
-                        "show bgp l2vpn evpn all summary");
+            bgpMgr.getBgpCounters().fetchCmdOutputs(BgpCounters.BGP_EVPN_SUMMARY_FILE,
+                    "show bgp l2vpn evpn all summary");
 
-                BgpCounters.parseBgpL2vpnEvpnAllSummary(neighborStatusMap);
+            BgpCounters.parseBgpL2vpnEvpnAllSummary(neighborStatusMap);
 
-                processNeighborStatusMap(neighborStatusMap, nbrList);
-            }
-            LOG.debug("Finished getting the status of BGP neighbors");
-        } catch (IOException e) {
-            LOG.error("Failed to publish bgp counters ", e);
+            processNeighborStatusMap(neighborStatusMap, nbrList);
         }
+        LOG.debug("Finished getting the status of BGP neighbors");
     }
 
     private void processNeighborStatusMap(Map<String, String> nbrStatusMap, List<Neighbors> nbrs) {
index 7a0cf2aa9d9ecc53adae7cad85c27251510285b9..7a1669f69f1ddedec3072937731bfe080dbaa403 100644 (file)
@@ -69,25 +69,21 @@ public class BgpCounters implements Runnable, AutoCloseable {
 
     @Override
     public void run() {
-        try {
-            LOG.debug("Fetching counters from BGP");
-            resetCounters();
-            fetchCmdOutputs("cmd_ip_bgp_summary.txt", "show ip bgp summary");
-            fetchCmdOutputs("cmd_bgp_ipv4_unicast_statistics.txt", "show bgp ipv4 unicast statistics");
-            fetchCmdOutputs(BGP_VPNV4_FILE, "show ip bgp vpnv4 all");
-            fetchCmdOutputs(BGP_VPNV6_FILE, "show ip bgp vpnv6 all");
-            fetchCmdOutputs(BGP_EVPN_FILE, "show bgp l2vpn evpn all");
-            parseIpBgpSummary();
-            parseIpBgpVpnv4All();
-            parseIpBgpVpnv6All();
-            parseBgpL2vpnEvpnAll();
-            LOG.debug("Finished updating the counters from BGP");
-        } catch (IOException e) {
-            LOG.error("Failed to publish bgp counters ", e);
-        }
+        LOG.debug("Fetching counters from BGP");
+        resetCounters();
+        fetchCmdOutputs("cmd_ip_bgp_summary.txt", "show ip bgp summary");
+        fetchCmdOutputs("cmd_bgp_ipv4_unicast_statistics.txt", "show bgp ipv4 unicast statistics");
+        fetchCmdOutputs(BGP_VPNV4_FILE, "show ip bgp vpnv4 all");
+        fetchCmdOutputs(BGP_VPNV6_FILE, "show ip bgp vpnv6 all");
+        fetchCmdOutputs(BGP_EVPN_FILE, "show bgp l2vpn evpn all");
+        parseIpBgpSummary();
+        parseIpBgpVpnv4All();
+        parseIpBgpVpnv6All();
+        parseBgpL2vpnEvpnAll();
+        LOG.debug("Finished updating the counters from BGP");
     }
 
-    void fetchCmdOutputs(String filename, String cmdName) throws IOException {
+    void fetchCmdOutputs(String filename, String cmdName) {
         try (Socket socket = new Socket(bgpSdncMip, 2605);
              PrintWriter toRouter = new PrintWriter(socket.getOutputStream(), true);
              BufferedReader fromRouter = new BufferedReader(new InputStreamReader(socket.getInputStream()));
index 0cda7c400bebebf9c30da22a3a6b9cf513103f30..116f427aea60de7fed7464737d431ff27d8db47d 100644 (file)
@@ -470,7 +470,7 @@ public final class BgpRouter {
         dispatch(bop);
     }
 
-    public int initRibSync(BgpSyncHandle handle) throws TException, BgpRouterException {
+    public int initRibSync(BgpSyncHandle handle) throws BgpRouterException {
         if (bgpClient == null) {
             throw new BgpRouterException(BgpRouterException.BGP_ERR_NOT_INITED);
         }
@@ -481,7 +481,7 @@ public final class BgpRouter {
         return 0;
     }
 
-    public int endRibSync(BgpSyncHandle handle) throws TException, BgpRouterException {
+    public int endRibSync(BgpSyncHandle handle) throws BgpRouterException {
         if (bgpClient == null) {
             throw new BgpRouterException(BgpRouterException.BGP_ERR_NOT_INITED);
         }
index 469ca2d1d117f32b8fc680b37f5120860590c317..53139bad1dad9f9dfe4444054aa29df1a23049c4 100644 (file)
@@ -9,13 +9,10 @@
 package org.opendaylight.netvirt.bgpmanager.thrift.server;
 
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadFactory;
-
-import java.util.concurrent.TimeoutException;
 import org.apache.thrift.protocol.TBinaryProtocol;
 import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.server.ServerContext;
@@ -146,23 +143,19 @@ public class BgpThriftService {
             LOG.debug("Update on push route : rd {} prefix {} plen {}", rd, prefix, plen);
 
             // l2label is ignored even in case of RT5. only l3label considered
-            try {
-                bgpConfigManager.onUpdatePushRoute(
-                        protocolType,
-                        rd,
-                        prefix,
-                        plen,
-                        nexthop,
-                        ethtag,
-                        esi,
-                        macaddress,
-                        l3label,
-                        l2label,
-                        routermac,
-                        afi);
-            } catch (InterruptedException | ExecutionException | TimeoutException e) {
-                LOG.error("failed to handle update route ", e);
-            }
+            bgpConfigManager.onUpdatePushRoute(
+                    protocolType,
+                    rd,
+                    prefix,
+                    plen,
+                    nexthop,
+                    ethtag,
+                    esi,
+                    macaddress,
+                    l3label,
+                    l2label,
+                    routermac,
+                    afi);
         }
 
         @Override
@@ -177,22 +170,14 @@ public class BgpThriftService {
                                           int l3label,
                                           int l2label,
                                           af_afi afi) {
-            try {
-                LOG.debug("Route del ** {} ** {}/{} ", rd, prefix, plen);
-                bgpConfigManager.onUpdateWithdrawRoute(
-                        protocolType,
-                        rd,
-                        prefix,
-                        plen,
-                        nexthop,
-                        macaddress);
-            } catch (InterruptedException e1) {
-                LOG.error("Interrupted exception for withdraw route", e1);
-            } catch (ExecutionException e2) {
-                LOG.error("Execution exception for withdraw route", e2);
-            } catch (TimeoutException e3) {
-                LOG.error("Timeout exception for withdraw route", e3);
-            }
+            LOG.debug("Route del ** {} ** {}/{} ", rd, prefix, plen);
+            bgpConfigManager.onUpdateWithdrawRoute(
+                    protocolType,
+                    rd,
+                    prefix,
+                    plen,
+                    nexthop,
+                    macaddress);
         }
 
         @Override