diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2018-04-19 12:27:16 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2018-04-19 11:03:26 +0000 |
commit | 61678b785d4ce560f5bfba470beca885524415a8 (patch) | |
tree | 3fdb489edb2d6cb1814090ee487bc34341a30f6a /v3po/v3po2vpp/src/main | |
parent | 9fa8b2aab4efb67b714280ed64055e5a7c2a31a7 (diff) |
HC2VPP-308: forbid local0 deletion
Adds special case for local0 in InterfaceCustomizer.deleteCurrentAttributes.
Change-Id: I1eb0826f90bd5dbbdb3b6cbb4b19ac5cadb1a68f
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
(cherry picked from commit 48566d84cd9f4047d96541540cdfc9ef4936acf8)
Diffstat (limited to 'v3po/v3po2vpp/src/main')
-rw-r--r-- | v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java index be50aa6b7..2f155bb87 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizer.java @@ -40,6 +40,8 @@ public class InterfaceCustomizer extends FutureJVppCustomizer implements ListWriterCustomizer<Interface, InterfaceKey>, JvppReplyConsumer { private static final Logger LOG = LoggerFactory.getLogger(InterfaceCustomizer.class); + private static final String LOCAL0_NAME = "local0"; + private final NamingContext interfaceContext; public InterfaceCustomizer(final FutureJVppCore vppApi, final NamingContext interfaceContext) { @@ -68,8 +70,14 @@ public class InterfaceCustomizer extends FutureJVppCustomizer @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id, @Nonnull final Interface dataBefore, - @Nonnull final WriteContext writeContext) { - // Nothing to be done here, customizers for specific interface types e.g. vxlan handle the delete + @Nonnull final WriteContext writeContext) + throws WriteFailedException.DeleteFailedException { + // Special handling for local0 interface (HC2VPP-308): + if (LOCAL0_NAME.equals(dataBefore.getName())) { + throw new WriteFailedException.DeleteFailedException(id, + new UnsupportedOperationException("Removing " + LOCAL0_NAME + " interface is not supported")); + } + // For other interfaces, delegate delete to customizers for specific interface types (e.g. VXLan, Tap). } private void setInterface(final InstanceIdentifier<Interface> id, final Interface swIf, |