routing: remove unused code from FibTableRequest 81/12581/2
authorMarek Gradzki <[email protected]>
Wed, 16 May 2018 05:52:11 +0000 (07:52 +0200)
committerMarek Gradzki <[email protected]>
Wed, 16 May 2018 05:57:36 +0000 (07:57 +0200)
Removes delete method and dependency on FibTable service.

Change-Id: I7b34cb8f80bb00379846501ddd1b2c3d4f049bb6
Signed-off-by: Marek Gradzki <[email protected]>
routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/services/FibTableServiceImpl.java
routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/FibTableRequest.java

index 711b687..643c6ba 100644 (file)
@@ -67,8 +67,8 @@ public class FibTableServiceImpl extends FutureJVppCustomizer implements FibTabl
     @Override
     public void write(InstanceIdentifier<?> identifier, @Nonnegative int tableId, @Nonnull String tableName,
                       boolean isIpv6) throws WriteFailedException {
-        //register fib table in VPP
-        FibTableRequest fibTableRequest = new FibTableRequest(getFutureJVpp(), this, modificationCache);
+        // Register fib table in VPP
+        FibTableRequest fibTableRequest = new FibTableRequest(getFutureJVpp(), modificationCache);
         fibTableRequest.setFibName(tableName);
         fibTableRequest.setIpv6(isIpv6);
         fibTableRequest.setFibTable(tableId);
index fefbade..297ddc6 100644 (file)
@@ -21,9 +21,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
 
 import io.fd.hc2vpp.common.translate.util.AddressTranslator;
 import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.routing.services.FibTableService;
 import io.fd.honeycomb.translate.ModificationCache;
-import io.fd.honeycomb.translate.read.ReadFailedException;
 import io.fd.honeycomb.translate.write.WriteFailedException;
 import io.fd.vpp.jvpp.core.dto.IpTableAddDel;
 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
@@ -33,7 +31,6 @@ import org.slf4j.LoggerFactory;
 
 public class FibTableRequest implements AddressTranslator, JvppReplyConsumer {
 
-    private final FibTableService fibTableService;
     private final ModificationCache modificationCache;
     private static final Logger LOG = LoggerFactory.getLogger(FibTableRequest.class);
 
@@ -53,9 +50,8 @@ public class FibTableRequest implements AddressTranslator, JvppReplyConsumer {
      */
     private boolean isIpv6;
 
-    public FibTableRequest(FutureJVppCore api, FibTableService fibTableService, ModificationCache modificationCache) {
+    public FibTableRequest(FutureJVppCore api, ModificationCache modificationCache) {
         this.api = api;
-        this.fibTableService = fibTableService;
         this.modificationCache = modificationCache;
     }
 
@@ -64,22 +60,6 @@ public class FibTableRequest implements AddressTranslator, JvppReplyConsumer {
         checkArgument(!getFibName().isEmpty(), "Fib table name must not be empty");
     }
 
-    public void delete(InstanceIdentifier<?> identifier) throws WriteFailedException {
-        try {
-            fibTableService.checkTableExist(getFibTable(), modificationCache);
-            IpTableAddDel tableAddDel = new IpTableAddDel();
-            tableAddDel.tableId = getFibTable();
-            tableAddDel.isIpv6 = (booleanToByte(isIpv6()));
-            tableAddDel.isAdd = (booleanToByte(false));
-            tableAddDel.name = getFibName().getBytes();
-            getReplyForWrite(api.ipTableAddDel(tableAddDel).toCompletableFuture(), identifier);
-        } catch (ReadFailedException e) {
-            throw new IllegalArgumentException(e);
-        } catch (FibTableService.FibTableDoesNotExistException e){
-            LOG.debug("Request to delete non existing Fib table");
-        }
-    }
-
     public void write(InstanceIdentifier<?> identifier) throws WriteFailedException {
         IpTableAddDel tableAddDel = new IpTableAddDel();
         try {
@@ -88,7 +68,7 @@ public class FibTableRequest implements AddressTranslator, JvppReplyConsumer {
             tableAddDel.isAdd = (booleanToByte(true));
             tableAddDel.name = getFibName().getBytes();
             getReplyForWrite(api.ipTableAddDel(tableAddDel).toCompletableFuture(), identifier);
-        } catch (Exception ex){
+        } catch (Exception ex) {
             LOG.error("Error writing fib table. fibTable: {}, api: {}, cache: {}, id: {}", tableAddDel, api,
                       modificationCache, identifier);
             throw new WriteFailedException(identifier, ex);