diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2016-12-02 09:37:22 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-12-02 13:47:21 +0000 |
commit | 7088e80deb3384c84cefca8f92e92722b1f19fe9 (patch) | |
tree | e64f8ca4c0213d642b0a2f41532b25cf45a9be92 /routing/routing-impl/src/main | |
parent | 14542744e674673847e6f671ee179eeee30b2d5a (diff) |
HONEYCOMB-307 - Prevent re-mapping of already mapped names
Prevent invoking addName while initializing data for names
that are already in mappings
Change-Id: I56063fb28cfb215bbdb1ed745aaa44544ffa77a0
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'routing/routing-impl/src/main')
-rw-r--r-- | routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java index 220f07690..69b8e509e 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java @@ -61,9 +61,12 @@ public class RoutingProtocolCustomizer // while using ip_add_del_table routingProtocolContext.addName(tableId, newProtocolName, mappingContext); } else { - throw new IllegalStateException(String.format( - "An attempt to assign protocol %s to table id %s. Table id already assigned to protocol %s", - newProtocolName, tableId, routingProtocolContext.getName(tableId, mappingContext))); + // prevent to fail while restoring data(trying to remap already mapped name) + if (!newProtocolName.equals(routingProtocolContext.getName(tableId, mappingContext))) { + throw new IllegalStateException(String.format( + "An attempt to assign protocol %s to table id %s. Table id already assigned to protocol %s", + newProtocolName, tableId, routingProtocolContext.getName(tableId, mappingContext))); + } } } } |