summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-04-19 12:27:16 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-04-19 11:03:26 +0000
commit61678b785d4ce560f5bfba470beca885524415a8 (patch)
tree3fdb489edb2d6cb1814090ee487bc34341a30f6a /v3po/v3po2vpp/src/test
parent9fa8b2aab4efb67b714280ed64055e5a7c2a31a7 (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/test')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java
index d33211842..6a659f484 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/InterfaceCustomizerTest.java
@@ -43,10 +43,14 @@ public class InterfaceCustomizerTest extends WriterCustomizerTest implements Byt
private static final String IF_NAME = "eth1";
private static final int IF_INDEX = 1;
- private InterfaceCustomizer customizer;
- private InstanceIdentifier<Interface> IID =
+ private static final InstanceIdentifier<Interface> IID =
InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME));
+ private static final String LOCAL0_IFC_NAME = "local0";
+ private static final InstanceIdentifier<Interface> LOCAL0_IID =
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(LOCAL0_IFC_NAME));
+ private InterfaceCustomizer customizer;
+
@Override
protected void setUpTest() throws Exception {
customizer = new InterfaceCustomizer(api, new NamingContext("ifacePrefix", IFACE_CTX_NAME));
@@ -101,6 +105,13 @@ public class InterfaceCustomizerTest extends WriterCustomizerTest implements Byt
verifyZeroInteractions(api);
}
+ @Test(expected = WriteFailedException.DeleteFailedException.class)
+ public void testDeleteLocal0() throws WriteFailedException {
+ final Interface ifc = mock(Interface.class);
+ when(ifc.getName()).thenReturn(LOCAL0_IFC_NAME);
+ customizer.deleteCurrentAttributes(LOCAL0_IID, ifc, writeContext);
+ }
+
private Interface iface(final boolean enabled) {
return new InterfaceBuilder().setName(IF_NAME).setEnabled(enabled).build();
}