From 4f15c1ba2bec17a5e62e3bb2656454abb86ca6e5 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Thu, 20 Jul 2017 14:33:32 +0200 Subject: 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 --- .../lisp/gpe/translate/ctx/GpeLocatorPairMappingContextImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lisp/lisp2vpp/src/main/java/io/fd') 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 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); } -- cgit 1.2.3-korg