summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main/java
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 17:50:42 +0000
commiteabd18bdb037d38fce1d1d918788b57b355e9b68 (patch)
tree0d0179f3d5d4992501579b7e1129a4bcdd223e8b /lisp/lisp2vpp/src/main/java
parent17ac1638bfa864ba6cfd8d2aab5d795cff33c4b9 (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')
-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);
}