summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-05-24 16:52:31 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-05-24 16:52:31 +0200
commit78111d9f0ca926664e1724850051c7f394b7bb0d (patch)
tree35e23c8478e23eb2c5bda1ae3c166e355b3b6031 /v3po/v3po2vpp/src/main/java/io/fd
parentd70f76a3626eb1b3786a5cfac4528a449b476583 (diff)
Replace interface mapping context for reused vxlan tunnel
This can occur when vxlan interface is deleted and then added, but read between those operations cached zombie vxlan interface in the interface mapping context Change-Id: I74fd5126bbcd0df5b5f78725c51030584effe9e4 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java
index df9c25f6a..bec0e8366 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/VxlanCustomizer.java
@@ -118,6 +118,19 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> {
throw new VppApiInvocationException("vxlanAddDelTunnel", reply.context, reply.retval);
} else {
LOG.debug("Vxlan tunnel set successfully for: {}, vxlan: {}", swIfName, vxlan);
+ if(interfaceContext.containsName(reply.swIfIndex, writeContext.getMappingContext())) {
+ // VPP keeps vxlan tunnels present even after they are delete(reserving ID for next tunnel)
+ // This may cause inconsistencies in mapping context when configuring tunnels like this:
+ // 1. Add tunnel 2. Delete tunnel 3. Read interfaces (reserved mapping e.g. vxlan_tunnel0 -> 6
+ // will get into mapping context) 4. Add tunnel (this will add another mapping with the same
+ // reserved ID and context is invalid)
+ // That's why a check has to be performed here removing mapping vxlan_tunnel0 -> 6 mapping and storing
+ // new name for that ID
+ final String formerName = interfaceContext.getName(reply.swIfIndex, writeContext.getMappingContext());
+ LOG.debug("Removing updated mapping of a vxlan tunnel, id: {}, former name: {}, new name: {}",
+ reply.swIfIndex, formerName, swIfName);
+ interfaceContext.removeName(formerName, writeContext.getMappingContext());
+ }
// Add new interface to our interface context
interfaceContext.addName(reply.swIfIndex, swIfName, writeContext.getMappingContext());
}