From 91c19daebce1ca6dbcb0c6852e7daafdccbb172a Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Wed, 16 May 2018 07:52:11 +0200 Subject: routing: remove unused code from FibTableRequest Removes delete method and dependency on FibTable service. Change-Id: I7b34cb8f80bb00379846501ddd1b2c3d4f049bb6 Signed-off-by: Marek Gradzki --- .../routing/services/FibTableServiceImpl.java | 4 ++-- .../routing/write/factory/FibTableRequest.java | 24 ++-------------------- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/services/FibTableServiceImpl.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/services/FibTableServiceImpl.java index 711b687d8..643c6baac 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/services/FibTableServiceImpl.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/services/FibTableServiceImpl.java @@ -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); diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/FibTableRequest.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/FibTableRequest.java index fefbadefa..297ddc6b3 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/FibTableRequest.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/FibTableRequest.java @@ -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); -- cgit 1.2.3-korg