summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java33
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java63
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java35
3 files changed, 45 insertions, 86 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
index c6c92aa35..58c3549fc 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/ArpTerminationTableEntryCustomizer.java
@@ -23,9 +23,11 @@ import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
+import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -34,10 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
-import io.fd.vpp.jvpp.core.dto.BdIpMacAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,14 +62,9 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer
@Nonnull final ArpTerminationTableEntry dataAfter,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Creating ARP termination table entry: {} {}", id, dataAfter);
- bdIpMacAddDel(id, dataAfter, writeContext, true);
- LOG.debug("L2 ARP termination table entry created successfully: {} {}", id, dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create ARP termination table entry: {} {}", id, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+ LOG.debug("Creating ARP termination table entry: {} {}", id, dataAfter);
+ bdIpMacAddDel(id, dataAfter, writeContext, true);
+ LOG.debug("L2 ARP termination table entry created successfully: {} {}", id, dataAfter);
}
@Override
@@ -88,20 +81,14 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer
@Nonnull final ArpTerminationTableEntry dataBefore,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Deleting ARP termination table entry entry: {} {}", id, dataBefore);
- bdIpMacAddDel(id, dataBefore, writeContext, false);
- LOG.debug("ARP termination table entry deleted successfully: {} {}", id, dataBefore);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete ARP termination table entry: {} {}", id, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ LOG.debug("Deleting ARP termination table entry entry: {} {}", id, dataBefore);
+ bdIpMacAddDel(id, dataBefore, writeContext, false);
+ LOG.debug("ARP termination table entry deleted successfully: {} {}", id, dataBefore);
}
private void bdIpMacAddDel(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id,
@Nonnull final ArpTerminationTableEntry entry,
- final WriteContext writeContext, boolean isAdd)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext, boolean isAdd) throws WriteFailedException {
final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext());
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
index 1f704e727..327247b41 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/BridgeDomainCustomizer.java
@@ -25,18 +25,16 @@ import io.fd.honeycomb.translate.vpp.util.ByteDataTranslator;
import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
+import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.GuardedBy;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDel;
-import io.fd.vpp.jvpp.core.dto.BridgeDomainAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +57,7 @@ public class BridgeDomainCustomizer
private BridgeDomainAddDelReply addOrUpdateBridgeDomain(@Nonnull final InstanceIdentifier<BridgeDomain> id,
final int bdId, @Nonnull final BridgeDomain bd)
- throws VppBaseCallException, WriteTimeoutException {
+ throws WriteFailedException {
final BridgeDomainAddDelReply reply;
final BridgeDomainAddDel request = new BridgeDomainAddDel();
request.bdId = bdId;
@@ -86,27 +84,22 @@ public class BridgeDomainCustomizer
// Invoke 1. check index, 2. increase index 3. create ND 4. store mapping in a synchronized block to prevent
// race conditions in case of concurrent invocation
synchronized (this) {
- try {
- int index;
- if (bdContext.containsIndex(bdName, ctx.getMappingContext())) {
- index = bdContext.getIndex(bdName, ctx.getMappingContext());
- } else {
- // Critical section due to bridgeDomainIndexCounter read and write access
- // TODO HONEYCOMB-199 move this "get next available index" into naming context or an adapter
- // or a dedicated object
-
- // Use counter to assign bridge domain index, but still check naming context if it's not taken there
- while (bdContext.containsName(bridgeDomainIndexCounter, ctx.getMappingContext())) {
- bridgeDomainIndexCounter++;
- }
- index = bridgeDomainIndexCounter;
+ int index;
+ if (bdContext.containsIndex(bdName, ctx.getMappingContext())) {
+ index = bdContext.getIndex(bdName, ctx.getMappingContext());
+ } else {
+ // Critical section due to bridgeDomainIndexCounter read and write access
+ // TODO HONEYCOMB-199 move this "get next available index" into naming context or an adapter
+ // or a dedicated object
+
+ // Use counter to assign bridge domain index, but still check naming context if it's not taken there
+ while (bdContext.containsName(bridgeDomainIndexCounter, ctx.getMappingContext())) {
+ bridgeDomainIndexCounter++;
}
- addOrUpdateBridgeDomain(id, index, dataBefore);
- bdContext.addName(index, bdName, ctx.getMappingContext());
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create bridge domain", e);
- throw new WriteFailedException.CreateFailedException(id, dataBefore, e);
+ index = bridgeDomainIndexCounter;
}
+ addOrUpdateBridgeDomain(id, index, dataBefore);
+ bdContext.addName(index, bdName, ctx.getMappingContext());
}
}
@@ -118,17 +111,12 @@ public class BridgeDomainCustomizer
LOG.debug("deleteCurrentAttributes: id={}, dataBefore={}, ctx={}", id, dataBefore, ctx);
final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
int bdId = bdContext.getIndex(bdName, ctx.getMappingContext());
- try {
- final BridgeDomainAddDel request = new BridgeDomainAddDel();
- request.bdId = bdId;
+ final BridgeDomainAddDel request = new BridgeDomainAddDel();
+ request.bdId = bdId;
- getReplyForWrite(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture(), id);
- LOG.debug("Bridge domain {} (id={}) deleted successfully", bdName, bdId);
- } catch (VppBaseCallException e) {
- LOG.warn("Bridge domain {} (id={}) delete failed", bdName, bdId);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+ getReplyForWrite(getFutureJVpp().bridgeDomainAddDel(request).toCompletableFuture(), id);
+ LOG.debug("Bridge domain {} (id={}) deleted successfully", bdName, bdId);
}
@Override
@@ -143,12 +131,7 @@ public class BridgeDomainCustomizer
checkArgument(bdName.equals(dataBefore.getName()),
"BridgeDomain name changed. It should be deleted and then created.");
- try {
- addOrUpdateBridgeDomain(id, bdContext.getIndex(bdName, ctx.getMappingContext()), dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create bridge domain", e);
- throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, e);
- }
+ addOrUpdateBridgeDomain(id, bdContext.getIndex(bdName, ctx.getMappingContext()), dataAfter);
}
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
index eb7247b1c..59198b58a 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/vpp/L2FibEntryCustomizer.java
@@ -24,9 +24,11 @@ import io.fd.honeycomb.translate.vpp.util.FutureJVppCustomizer;
import io.fd.honeycomb.translate.vpp.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.vpp.util.MacTranslator;
import io.fd.honeycomb.translate.vpp.util.NamingContext;
-import io.fd.honeycomb.translate.vpp.util.WriteTimeoutException;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
+import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.L2FibFilter;
@@ -34,10 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.bridge.domains.BridgeDomain;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDel;
-import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,14 +63,10 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer
public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
@Nonnull final L2FibEntry dataAfter, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Creating L2 FIB entry: {} {}", id, dataAfter);
- l2FibAddDel(id, dataAfter, writeContext, true);
- LOG.debug("L2 FIB entry created successfully: {} {}", id, dataAfter);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to create L2 FIB entry: {} {}", id, dataAfter);
- throw new WriteFailedException.CreateFailedException(id, dataAfter, e);
- }
+
+ LOG.debug("Creating L2 FIB entry: {} {}", id, dataAfter);
+ l2FibAddDel(id, dataAfter, writeContext, true);
+ LOG.debug("L2 FIB entry created successfully: {} {}", id, dataAfter);
}
@Override
@@ -87,19 +81,14 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer
public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id,
@Nonnull final L2FibEntry dataBefore, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
- try {
- LOG.debug("Deleting L2 FIB entry: {} {}", id, dataBefore);
- l2FibAddDel(id, dataBefore, writeContext, false);
- LOG.debug("L2 FIB entry deleted successfully: {} {}", id, dataBefore);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to delete L2 FIB entry: {} {}", id, dataBefore);
- throw new WriteFailedException.DeleteFailedException(id, e);
- }
+
+ LOG.debug("Deleting L2 FIB entry: {} {}", id, dataBefore);
+ l2FibAddDel(id, dataBefore, writeContext, false);
+ LOG.debug("L2 FIB entry deleted successfully: {} {}", id, dataBefore);
}
private void l2FibAddDel(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntry entry,
- final WriteContext writeContext, boolean isAdd)
- throws VppBaseCallException, WriteTimeoutException {
+ final WriteContext writeContext, boolean isAdd) throws WriteFailedException {
final String bdName = id.firstKeyOf(BridgeDomain.class).getName();
final int bdId = bdContext.getIndex(bdName, writeContext.getMappingContext());