summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main/java/io/fd
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-07-20 14:33:32 +0200
committerJan Srnicek <jsrnicek@cisco.com>2017-07-20 14:33:32 +0200
commit4f15c1ba2bec17a5e62e3bb2656454abb86ca6e5 (patch)
tree74ba80833e9665f1fc3f01cc3786855438009c3f /lisp/lisp2vpp/src/main/java/io/fd
parent11ffb028cb49cf55b6ac17172ad9b52bc4d27115 (diff)
HC2VPP-192 - Removing of locator pair mapping
When negative mapping(no locators present), do not invoke read as it would fail on non existing parent data Change-Id: Ia20d707efd4d7fdab62d9dc0cd0b4003bc7de3cb Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io/fd')
-rw-r--r--lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java
index a7d84d2b6..766478fd5 100644
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java
@@ -69,7 +69,11 @@ public class GpeLocatorPairMappingContextImpl implements GpeLocatorPairMappingCo
public void removeMapping(@Nonnull final String entryId,
@Nonnull final MappingContext mappingContext) {
LOG.debug("Removing all mappings for Gpe entry[id={}]", entryId);
- mappingContext.delete(getMappingId(entryId));
+ KeyedInstanceIdentifier<Mapping, MappingKey> mappingId = getMappingId(entryId);
+ // if no mapping present, no need to invoke delete(it would throw error because of non existing parent data)
+ if (mappingContext.read(mappingId).isPresent()) {
+ mappingContext.delete(mappingId);
+ }
LOG.debug("All mappings for Gpe entry[id={}] removed", entryId);
}