diff options
author | Jan Srnicek <jsrnicek@cisco.com> | 2017-08-15 11:30:28 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-08-16 08:18:47 +0000 |
commit | b8cf23cd61c2d3f57f9450570236534bce69232e (patch) | |
tree | 1840014acfe504fb58f81787e1ed52841453631f /lisp/lisp2vpp | |
parent | 3a7a67fe142749eb6b41f660d101f3fdffb8b3de (diff) |
HONEYCOMB-386 - Hc2vpp Customizers update
Utilizes new default update implementation
Change-Id: I9bf8473336274ba5fcfc18804f7b414937b3708e
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp')
14 files changed, 12 insertions, 113 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java index cbb4b2f97..730f7663d 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathCustomizer.java @@ -54,16 +54,6 @@ public class NativeForwardPathCustomizer extends FutureJVppCustomizer createNativePath(id, dataAfter, writeContext); } - - @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NativeForwardPath> id, - @Nonnull final NativeForwardPath dataBefore, - @Nonnull final NativeForwardPath dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - deleteNativePath(id, dataBefore, writeContext); - createNativePath(id, dataAfter, writeContext); - } - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NativeForwardPath> id, @Nonnull final NativeForwardPath dataBefore, diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java index 6d2faf297..f04a13f5c 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizer.java @@ -53,18 +53,6 @@ public class NativeForwardPathsTableCustomizer extends FutureJVppCustomizer createFibTable(id, dataAfter); } - - @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NativeForwardPathsTable> id, - @Nonnull final NativeForwardPathsTable dataBefore, - @Nonnull final NativeForwardPathsTable dataAfter, - @Nonnull final WriteContext writeContext) - throws WriteFailedException { - // not sure if update makes sense, but just in case - deleteFibTable(id); - createFibTable(id, dataAfter); - } - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NativeForwardPathsTable> id, @Nonnull final NativeForwardPathsTable dataBefore, diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/BridgeDomainSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/BridgeDomainSubtableCustomizer.java index 4006628f0..b3fce3340 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/BridgeDomainSubtableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/BridgeDomainSubtableCustomizer.java @@ -67,14 +67,6 @@ public class BridgeDomainSubtableCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id, - @Nonnull final BridgeDomainSubtable dataBefore, - @Nonnull final BridgeDomainSubtable dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<BridgeDomainSubtable> id, @Nonnull final BridgeDomainSubtable dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/InterfaceCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/InterfaceCustomizer.java index bb963a4e3..8feb2e08a 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/InterfaceCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/InterfaceCustomizer.java @@ -80,12 +80,6 @@ public class InterfaceCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataBefore, Interface dataAfter, - WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(InstanceIdentifier<Interface> id, Interface dataBefore, WriteContext writeContext) throws WriteFailedException { checkNotNull(dataBefore, "Interface is null"); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java index f841ac579..3ec2a72dd 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizer.java @@ -53,15 +53,6 @@ public class ItrRemoteLocatorSetCustomizer extends CheckedLispCustomizer impleme } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id, - @Nonnull final ItrRemoteLocatorSet dataBefore, - @Nonnull final ItrRemoteLocatorSet dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ItrRemoteLocatorSet> id, @Nonnull final ItrRemoteLocatorSet dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java index dfd6a003d..614d538d5 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizer.java @@ -87,15 +87,6 @@ public class LocatorSetCustomizer extends CheckedLispCustomizer } @Override - public void updateCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id, - @Nonnull LocatorSet dataBefore, - @Nonnull LocatorSet dataAfter, - @Nonnull WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<LocatorSet> id, @Nonnull LocatorSet dataBefore, @Nonnull WriteContext writeContext) throws WriteFailedException { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapResolverCustomizer.java index 9f24e3c5f..b492627c0 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapResolverCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapResolverCustomizer.java @@ -63,13 +63,6 @@ public class MapResolverCustomizer extends CheckedLispCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id, - @Nonnull final MapResolver dataBefore, @Nonnull final MapResolver dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<MapResolver> id, @Nonnull final MapResolver dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizer.java index e9de1a917..3d33aaf9c 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizer.java @@ -49,15 +49,6 @@ public class MapServerCustomizer extends CheckedLispCustomizer } @Override - public void updateCurrentAttributes(@Nonnull InstanceIdentifier<MapServer> instanceIdentifier, - @Nonnull MapServer mapServerBefore, - @Nonnull MapServer mapServerAfter, - @Nonnull WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(instanceIdentifier, mapServerBefore, mapServerAfter, - new UnsupportedOperationException("Not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<MapServer> instanceIdentifier, @Nonnull MapServer mapServer, @Nonnull WriteContext writeContext) throws WriteFailedException { lispStateCheckService.checkLispEnabledBefore(writeContext); addDelMapServer(false, instanceIdentifier, mapServer); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java index e1f1371ee..fb3c89ded 100755 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VniTableCustomizer.java @@ -51,12 +51,6 @@ public class VniTableCustomizer extends CheckedLispCustomizer implements ListWri } @Override - public void updateCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, VniTable dataAfter, - WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(InstanceIdentifier<VniTable> id, VniTable dataBefore, WriteContext writeContext) throws WriteFailedException { lispStateCheckService.checkLispEnabledBefore(writeContext); diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VrfSubtableCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VrfSubtableCustomizer.java index e7314b683..d4c4a1ad5 100644 --- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VrfSubtableCustomizer.java +++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/write/VrfSubtableCustomizer.java @@ -59,13 +59,6 @@ public class VrfSubtableCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id, - @Nonnull final VrfSubtable dataBefore, @Nonnull final VrfSubtable dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VrfSubtable> id, @Nonnull final VrfSubtable dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java index 80bb2c600..e2f55fdd1 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/gpe/translate/write/NativeForwardPathsTableCustomizerTest.java @@ -79,7 +79,11 @@ public class NativeForwardPathsTableCustomizerTest extends WriterCustomizerTest @Test public void testUpdateValid() throws WriteFailedException { when(api.gpeAddDelNativeFwdRpath(any())).thenReturn(future(new GpeAddDelNativeFwdRpathReply())); - customizer.updateCurrentAttributes(validId, validTableBefore(), validTable(), writeContext); + final NativeForwardPathsTable before = validTableBefore(); + final NativeForwardPathsTable after = validTable(); + // emulates what default update would do + customizer.deleteCurrentAttributes(validId, before, writeContext); + customizer.writeCurrentAttributes(validId, after, writeContext); verify(api, times(2)).gpeAddDelIface(requestCaptor.capture()); final List<GpeAddDelIface> requests = requestCaptor.getAllValues(); diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java index 4d76f7d6f..a05866114 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/ItrRemoteLocatorSetCustomizerTest.java @@ -84,16 +84,9 @@ public class ItrRemoteLocatorSetCustomizerTest extends LispWriterCustomizerTest fail("Test should have thrown exception"); } - @Test - public void updateCurrentAttributes() { - try { - customizer.updateCurrentAttributes(validId, validData, validData, writeContext); - } catch (WriteFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - return; - } - - fail("Test should have thrown exception"); + @Test(expected = UnsupportedOperationException.class) + public void updateCurrentAttributes() throws WriteFailedException { + customizer.updateCurrentAttributes(validId, validData, validData, writeContext); } @Test diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java index edb648bd9..52ed5dfd1 100755 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/LocatorSetCustomizerTest.java @@ -18,7 +18,6 @@ package io.fd.hc2vpp.lisp.translate.write; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -121,18 +120,10 @@ public class LocatorSetCustomizerTest extends LispWriterCustomizerTest { assertEquals(1, request.isAdd); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws WriteFailedException { final InstanceIdentifier<LocatorSet> identifier = InstanceIdentifier.create(LocatorSet.class); - try { - customizer - .updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext); - } catch (WriteFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - assertEquals(identifier, e.getFailedId()); - return; - } - fail("Test should have failed"); + customizer.updateCurrentAttributes(identifier, mock(LocatorSet.class), mock(LocatorSet.class), writeContext); } @Test(expected = NullPointerException.class) diff --git a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java index 19f8b0af4..27c716080 100644 --- a/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java +++ b/lisp/lisp2vpp/src/test/java/io/fd/hc2vpp/lisp/translate/write/MapServerCustomizerTest.java @@ -72,15 +72,9 @@ public class MapServerCustomizerTest extends LispWriterCustomizerTest implements } - @Test + @Test(expected = UnsupportedOperationException.class) public void updateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(ID, data, data, writeContext); - } catch (WriteFailedException e) { - assertTrue(e instanceof WriteFailedException.UpdateFailedException); - assertTrue(e.getCause() instanceof UnsupportedOperationException); - verify(api, times(0)).oneAddDelMapServer(any()); - } + customizer.updateCurrentAttributes(ID, data, data, writeContext); } @Test |