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 | |
parent | 3a7a67fe142749eb6b41f660d101f3fdffb8b3de (diff) |
HONEYCOMB-386 - Hc2vpp Customizers update
Utilizes new default update implementation
Change-Id: I9bf8473336274ba5fcfc18804f7b414937b3708e
Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
63 files changed, 69 insertions, 511 deletions
diff --git a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/InterfaceAclMacIpCustomizer.java b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/InterfaceAclMacIpCustomizer.java index 9f9ac5228..fc0acd223 100644 --- a/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/InterfaceAclMacIpCustomizer.java +++ b/acl/acl-impl/src/main/java/io/fd/hc2vpp/acl/write/InterfaceAclMacIpCustomizer.java @@ -56,15 +56,6 @@ public class InterfaceAclMacIpCustomizer extends FutureJVppAclCustomizer impleme } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VppMacipAcl> id, - @Nonnull final VppMacipAcl dataBefore, - @Nonnull final VppMacipAcl 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<VppMacipAcl> id, @Nonnull final VppMacipAcl dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/iface/acl/AclInterfaceAssignmentRequestTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/iface/acl/AclInterfaceAssignmentRequestTest.java index 3427dc7fd..fb5d61458 100644 --- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/iface/acl/AclInterfaceAssignmentRequestTest.java +++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/util/iface/acl/AclInterfaceAssignmentRequestTest.java @@ -115,7 +115,6 @@ public class AclInterfaceAssignmentRequestTest implements NamingContextHelper, F private void verifyVariant(final AclInterfaceAssignmentRequest request) throws WriteFailedException { verifyCreateFailsWithNullPointer(request); - verifyUpdateFailsWithNullPointer(request); verifyDeleteFailsWithNullPointer(request); } @@ -128,14 +127,6 @@ public class AclInterfaceAssignmentRequestTest implements NamingContextHelper, F } @Test - public void executeAsUpdate() throws Exception { - createValidRequest().executeAsUpdate(api, mock(Acl.class), mock(Acl.class)); - - verify(api).aclInterfaceSetAclList(requestCaptor.capture()); - verifyValidRequest(requestCaptor.getValue()); - } - - @Test public void executeAsDelete() throws Exception { create(mappingContext) .identifier(validIdentifier) @@ -190,16 +181,6 @@ public class AclInterfaceAssignmentRequestTest implements NamingContextHelper, F fail("Test should have thrown null pointer"); } - private void verifyUpdateFailsWithNullPointer(final AclInterfaceAssignmentRequest request) - throws WriteFailedException { - try { - request.executeAsUpdate(api, mock(Acl.class), mock(Acl.class)); - } catch (NullPointerException e) { - return; - } - fail("Test should have thrown null pointer"); - } - private void verifyDeleteFailsWithNullPointer(final AclInterfaceAssignmentRequest request) throws WriteFailedException { try { diff --git a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/InterfaceAclMacipCustomizerTest.java b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/InterfaceAclMacipCustomizerTest.java index 5bf66d894..b5fa649ca 100644 --- a/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/InterfaceAclMacipCustomizerTest.java +++ b/acl/acl-impl/src/test/java/io/fd/hc2vpp/acl/write/InterfaceAclMacipCustomizerTest.java @@ -24,7 +24,6 @@ import io.fd.hc2vpp.acl.AclTestSchemaContext; import io.fd.hc2vpp.acl.util.AclContextManager; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.acl.dto.MacipAclInterfaceAddDel; import io.fd.vpp.jvpp.acl.dto.MacipAclInterfaceAddDelReply; import io.fd.vpp.jvpp.acl.future.FutureJVppAclFacade; @@ -80,7 +79,7 @@ public class InterfaceAclMacipCustomizerTest extends WriterCustomizerTest implem verify(aclApi).macipAclInterfaceAddDel(request); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws Exception { customizer.updateCurrentAttributes(ACL_IID, acl, acl, writeContext); } diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizer.java index 1cdd46ef6..b66877ff0 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizer.java @@ -63,13 +63,6 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, Address dataAfter, - WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4Customizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4Customizer.java index e1fdb5914..6b0859ce8 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4Customizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4Customizer.java @@ -41,13 +41,6 @@ public class Ipv4Customizer extends FutureJVppCustomizer implements WriterCustom } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id, - @Nonnull final Ipv4 dataBefore, @Nonnull final Ipv4 dataAfter, - @Nonnull final WriteContext writeContext) { - LOG.debug("Handling Ipv4 leaves (mtu, forwarding) is not supported by VPP API. Ignoring configuration"); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv4> id, @Nonnull final Ipv4 dataBefore, @Nonnull final WriteContext writeContext) { LOG.debug("Handling Ipv4 leaves (mtu, forwarding) is not supported by VPP API. Ignoring configuration"); diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java index af77fedaf..f8edcfb15 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java @@ -73,13 +73,6 @@ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore, - @Nonnull Neighbor dataAfter, - @Nonnull WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor data, @Nonnull WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java index ea1cf8d83..7c506e995 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyArpCustomizer.java @@ -55,15 +55,6 @@ public class ProxyArpCustomizer extends FutureJVppCustomizer implements WriterCu } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ProxyArp> id, - @Nonnull final ProxyArp dataBefore, - @Nonnull final ProxyArp dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Proxy ARP feature update is not supported.")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ProxyArp> id, @Nonnull final ProxyArp dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java index 345cef736..852959807 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java @@ -52,15 +52,6 @@ public class ProxyRangeCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ProxyRange> id, - @Nonnull final ProxyRange dataBefore, - @Nonnull final ProxyRange dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("ARP proxy range update is not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ProxyRange> id, @Nonnull final ProxyRange dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4AddressCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4AddressCustomizer.java index ba744efb8..42d6b45c1 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4AddressCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4AddressCustomizer.java @@ -63,13 +63,6 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, Address dataAfter, - WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, WriteContext writeContext) throws WriteFailedException { setAddress(false, id, dataBefore, writeContext); diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java index 818be6d96..67454d376 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java @@ -68,13 +68,6 @@ public class SubInterfaceIpv4NeighbourCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore, - @Nonnull Neighbor dataAfter, - @Nonnull WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor data, @Nonnull WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6AddressCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6AddressCustomizer.java index d6b357c90..0c66babc4 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6AddressCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6AddressCustomizer.java @@ -70,15 +70,6 @@ public class Ipv6AddressCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Address> id, - @Nonnull final Address dataBefore, - @Nonnull final Address 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<Address> id, @Nonnull final Address dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6Customizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6Customizer.java index 6194dfd4f..7a4c427ea 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6Customizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6Customizer.java @@ -41,13 +41,6 @@ public class Ipv6Customizer extends FutureJVppCustomizer implements WriterCustom } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, - @Nonnull final Ipv6 dataBefore, @Nonnull final Ipv6 dataAfter, - @Nonnull final WriteContext writeContext) { - LOG.warn("Unsupported, ignoring configuration {}", dataAfter); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Ipv6> id, @Nonnull final Ipv6 dataBefore, @Nonnull final WriteContext writeContext) { LOG.warn("Unsupported, ignoring configuration delete {}", id); diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java index 2a9ef03d6..ed06ab08f 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java @@ -72,13 +72,6 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore, - @Nonnull Neighbor dataAfter, - @Nonnull WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore, @Nonnull WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java index 5a57d96d4..fd7a024eb 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java @@ -58,14 +58,6 @@ public final class NdProxyCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NdProxy> id, - @Nonnull final NdProxy dataBefore, @Nonnull final NdProxy dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("NdProxy update is not supported.")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NdProxy> id, @Nonnull final NdProxy dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6AddressCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6AddressCustomizer.java index 455d44777..2a066b417 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6AddressCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6AddressCustomizer.java @@ -49,13 +49,6 @@ public class SubInterfaceIpv6AddressCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, Address dataAfter, - WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(InstanceIdentifier<Address> id, Address dataBefore, WriteContext writeContext) throws WriteFailedException { setAddress(false, id, dataBefore, writeContext); diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java index 62818b001..fd9eb90d1 100644 --- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java +++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java @@ -68,13 +68,6 @@ public class SubInterfaceIpv6NeighbourCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor dataBefore, - @Nonnull Neighbor dataAfter, - @Nonnull WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Operation not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull InstanceIdentifier<Neighbor> id, @Nonnull Neighbor data, @Nonnull WriteContext writeContext) throws WriteFailedException { diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java index e604df478..366d181fe 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyArpCustomizerTest.java @@ -68,7 +68,7 @@ public class ProxyArpCustomizerTest extends WriterCustomizerTest implements Byte customizer.writeCurrentAttributes(IID, data, writeContext); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws WriteFailedException { customizer.updateCurrentAttributes(IID, data, data, writeContext); } diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java index 49f4d0bc0..bdc382c40 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java @@ -67,7 +67,7 @@ public class ProxyRangeCustomizerTest extends WriterCustomizerTest implements By customizer.writeCurrentAttributes(IID, RANGE, writeContext); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws WriteFailedException { customizer.updateCurrentAttributes(IID, RANGE, RANGE, writeContext); } diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java index 269781319..74745c485 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4AddressCustomizerTest.java @@ -133,7 +133,7 @@ public class Ipv4AddressCustomizerTest extends WriterCustomizerTest { fail("WriteFailedException was expected"); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws Exception { final Address data = mock(Address.class); customizer.updateCurrentAttributes(getAddressId(IFACE_NAME), data, data, writeContext); diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/SubInterfaceIpv4AddressCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/SubInterfaceIpv4AddressCustomizerTest.java index 6416a1d8c..24a58febe 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/SubInterfaceIpv4AddressCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/SubInterfaceIpv4AddressCustomizerTest.java @@ -124,7 +124,7 @@ public class SubInterfaceIpv4AddressCustomizerTest extends WriterCustomizerTest return request; } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws Exception { final Address address = address(prefixLength()); customizer.updateCurrentAttributes(IID, address, address, writeContext); diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java index bf6fe9d2c..e0e506879 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java @@ -70,7 +70,7 @@ public class NdProxyCustomizerTest extends WriterCustomizerTest { verify(api).ip6NdProxyAddDel(request); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws WriteFailedException { final Ipv6AddressNoZone address = new Ipv6AddressNoZone("2001::2"); final NdProxy data = new NdProxyBuilder().setAddress(address).build(); 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 diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java index 505318c22..61fedbd48 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizer.java @@ -60,15 +60,6 @@ final class ExternalIpPoolCustomizer implements ListWriterCustomizer<ExternalIpA } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id, - @Nonnull final ExternalIpAddressPool dataBefore, - @Nonnull final ExternalIpAddressPool dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Address range update is not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ExternalIpAddressPool> id, @Nonnull final ExternalIpAddressPool dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java index 0d08a5587..35ed9e2d8 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizer.java @@ -127,15 +127,6 @@ final class MappingEntryCustomizer implements ListWriterCustomizer<MappingEntry, } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<MappingEntry> id, - @Nonnull final MappingEntry dataBefore, - @Nonnull final MappingEntry dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - deleteCurrentAttributes(id, dataBefore, writeContext); - writeCurrentAttributes(id, dataAfter, writeContext); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<MappingEntry> id, @Nonnull final MappingEntry dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatInstaceCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatInstaceCustomizer.java index 5d1c2b53c..fa5cfa8e2 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatInstaceCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/NatInstaceCustomizer.java @@ -38,13 +38,6 @@ final class NatInstaceCustomizer implements ListWriterCustomizer<NatInstance, Na } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NatInstance> id, - @Nonnull final NatInstance dataBefore, @Nonnull final NatInstance dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - LOG.trace("Updating nat-instance: {}", id); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NatInstance> id, @Nonnull final NatInstance dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java index 82af93481..76d6549f8 100644 --- a/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java +++ b/nat/nat2vpp/src/main/java/io/fd/hc2vpp/nat/write/ifc/AbstractInterfaceNatCustomizer.java @@ -66,14 +66,6 @@ abstract class AbstractInterfaceNatCustomizer<D extends InterfaceNatVppFeatureAt } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, - @Nonnull final D dataBefore, @Nonnull final D dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Unable to update NAT feature")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<D> id, @Nonnull final D dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java index c414c2b4e..e2db427a5 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ExternalIpPoolCustomizerTest.java @@ -71,7 +71,7 @@ public class ExternalIpPoolCustomizerTest extends WriterCustomizerTest implement verify(jvppSnat).snatAddAddressRange(expectedRequest); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws WriteFailedException { final ExternalIpAddressPool data = mock(ExternalIpAddressPool.class); customizer.updateCurrentAttributes(IID, data, data, writeContext); diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java index 008ac087b..96726cb11 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/MappingEntryCustomizerTest.java @@ -95,27 +95,7 @@ public class MappingEntryCustomizerTest extends WriterCustomizerTest implements customizer.writeCurrentAttributes(IID, extractMappingEntry(data), writeContext); } - @Test(expected = IllegalArgumentException.class) - public void testWriteNat64UnsupportedProtocol( - @InjectTestData(resourcePath = "/nat64/static-mapping-unsupported-proto.json", id = MAPPING_TABLE_PATH) MappingTable data) - throws WriteFailedException { - customizer.writeCurrentAttributes(IID, extractMappingEntry(data), writeContext); - } - - @Test - public void testUpdateNat44( - @InjectTestData(resourcePath = "/nat44/static-mapping.json", id = MAPPING_TABLE_PATH) MappingTable before, - @InjectTestData(resourcePath = "/nat44/static-mapping-address-update.json", id = MAPPING_TABLE_PATH) MappingTable after) - throws WriteFailedException { - customizer.updateCurrentAttributes(IID, extractMappingEntry(before), extractMappingEntry(after), writeContext); - final SnatAddStaticMapping expectedDeleteRequest = getExpectedNat44Request(); - verify(jvppSnat).snatAddStaticMapping(expectedDeleteRequest); - final SnatAddStaticMapping expectedUpdateRequest = getExpectedNat44UpdateRequest(); - expectedUpdateRequest.isAdd = 1; - verify(jvppSnat).snatAddStaticMapping(expectedUpdateRequest); - } - - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdateNat64( @InjectTestData(resourcePath = "/nat64/static-mapping.json", id = MAPPING_TABLE_PATH) MappingTable before, @InjectTestData(resourcePath = "/nat64/static-mapping-address-update.json", id = MAPPING_TABLE_PATH) MappingTable after) diff --git a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java index 273d376cd..a8496529b 100644 --- a/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java +++ b/nat/nat2vpp/src/test/java/io/fd/hc2vpp/nat/write/ifc/AbstractNatCustomizerTest.java @@ -23,7 +23,6 @@ import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeature; import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelFeatureReply; import io.fd.vpp.jvpp.snat.dto.SnatInterfaceAddDelOutputFeature; @@ -71,13 +70,13 @@ abstract class AbstractNatCustomizerTest<D extends InterfaceNatVppFeatureAttribu verify(snatApi).snatInterfaceAddDelOutputFeature(expectedPostRoutingRequest(data, true)); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdatePreRouting() throws Exception { customizer.updateCurrentAttributes(getIId(IFACE_NAME), getPreRoutingConfig(), getPreRoutingConfig(), writeContext); } - @Test(expected = WriteFailedException.UpdateFailedException.class) + @Test(expected = UnsupportedOperationException.class) public void testUpdatePostRouting() throws Exception { customizer.updateCurrentAttributes(getIId(IFACE_NAME), getPostRoutingConfig(), getPostRoutingConfig(), writeContext); diff --git a/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizer.java index 122594c3d..988c9948d 100755 --- a/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizer.java +++ b/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshEntryWriterCustomizer.java @@ -19,17 +19,18 @@ package io.fd.hc2vpp.vppnsh.impl.config; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import io.fd.honeycomb.translate.MappingContext; -import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.hc2vpp.vppnsh.impl.util.FutureJVppNshCustomizer; +import io.fd.honeycomb.translate.MappingContext; +import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.hc2vpp.vppnsh.impl.util.FutureJVppNshCustomizer; import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntry; import io.fd.vpp.jvpp.nsh.dto.NshAddDelEntryReply; import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh; +import java.util.List; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.Ethernet; @@ -39,16 +40,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh. import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.MdType2; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.NshMdType1Augment; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.NshMdType2Augment; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.nsh.md.type2.attributes.Md2Data; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.entries.NshEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.entries.NshEntryKey; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.nsh.md.type2.attributes.Md2Data; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.nio.charset.StandardCharsets; -import java.util.List; - /** * Writer customizer responsible for NshEntry create/delete. */ @@ -77,13 +75,6 @@ public class NshEntryWriterCustomizer extends FutureJVppNshCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NshEntry> id, - @Nonnull final NshEntry dataBefore, @Nonnull final NshEntry dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Nsh entry update is not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NshEntry> id, @Nonnull final NshEntry dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizer.java b/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizer.java index eaa1e75ee..23b05da35 100755 --- a/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizer.java +++ b/nsh/impl/src/main/java/io/fd/hc2vpp/vppnsh/impl/config/NshMapWriterCustomizer.java @@ -19,26 +19,26 @@ package io.fd.hc2vpp.vppnsh.impl.config; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; -import io.fd.honeycomb.translate.MappingContext; -import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.hc2vpp.common.translate.util.ByteDataTranslator; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.hc2vpp.vppnsh.impl.util.FutureJVppNshCustomizer; +import io.fd.honeycomb.translate.MappingContext; +import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.hc2vpp.vppnsh.impl.util.FutureJVppNshCustomizer; import io.fd.vpp.jvpp.nsh.dto.NshAddDelMap; import io.fd.vpp.jvpp.nsh.dto.NshAddDelMapReply; import io.fd.vpp.jvpp.nsh.future.FutureJVppNsh; import java.util.concurrent.CompletionStage; import javax.annotation.Nonnull; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.None; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.Pop; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.Push; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.Swap; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.VxlanGpe; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.Vxlan4; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.Vxlan6; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.None; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.VxlanGpe; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.maps.NshMap; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.nsh.rev170315.vpp.nsh.nsh.maps.NshMapKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; @@ -77,13 +77,6 @@ implements ListWriterCustomizer<NshMap, NshMapKey>, ByteDataTranslator, JvppRepl } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id, - @Nonnull final NshMap dataBefore, @Nonnull final NshMap dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException("Nsh map update is not supported"); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<NshMap> id, @Nonnull final NshMap dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java index 9d87a5bea..b8d34edc7 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java @@ -102,15 +102,6 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier, - @Nonnull final Route route, - @Nonnull final Route d1, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - throw new WriteFailedException(instanceIdentifier, - new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier, @Nonnull final Route route, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java index bd50ce77b..0e99aeead 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java @@ -40,13 +40,6 @@ public class RoutingCustomizer implements WriterCustomizer<Routing> { } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> instanceIdentifier, - @Nonnull final Routing before, @Nonnull final Routing after, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - LOG.debug("Updating {} to {}", instanceIdentifier, after); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Routing> instanceIdentifier, @Nonnull final Routing routing, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java index fa6885d5d..7d63647e0 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java @@ -47,15 +47,6 @@ public class RoutingInstanceCustomizer implements ListWriterCustomizer<RoutingIn } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingInstance> id, - @Nonnull final RoutingInstance dataBefore, - @Nonnull final RoutingInstance 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<RoutingInstance> id, @Nonnull final RoutingInstance dataBefore, @Nonnull final WriteContext writeContext) 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 69b8e509e..d79f9d666 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 @@ -72,15 +72,6 @@ public class RoutingProtocolCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier, - @Nonnull final RoutingProtocol routingProtocolBefore, - @Nonnull final RoutingProtocol routingProtocolAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(instanceIdentifier, routingProtocolBefore, - routingProtocolAfter, new UnsupportedOperationException("Operation not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier, @Nonnull final RoutingProtocol routingProtocol, @Nonnull final WriteContext writeContext) diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java index dc932cd0f..8a52b8cc6 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java @@ -18,8 +18,6 @@ package io.fd.hc2vpp.routing.write; import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_INDEX; import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_NAME; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; import com.google.common.collect.ImmutableList; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; @@ -119,17 +117,10 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest requestCaptor); } - @Test - public void testUpdate() { - try { - customizer.updateCurrentAttributes(validId, Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_BLACKHOLE_HOP, - Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_RECEIVE_HOP, writeContext); - } catch (WriteFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - verifyNotInvoked(api); - return; - } - fail("Test should have thrown exception"); + @Test(expected = UnsupportedOperationException.class) + public void testUpdate() throws WriteFailedException { + customizer.updateCurrentAttributes(validId, Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_BLACKHOLE_HOP, + Ipv6RouteData.IPV6_ROUTE_WITH_CLASSIFIER_RECEIVE_HOP, writeContext); } @Test diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java index 68fcba5ac..2e073d726 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java @@ -15,13 +15,11 @@ */ package io.fd.hc2vpp.routing.write; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.Mockito.when; import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; import io.fd.hc2vpp.routing.RoutingConfiguration; -import io.fd.honeycomb.translate.write.WriteFailedException; import org.junit.Test; import org.mockito.Mock; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstance; @@ -67,15 +65,9 @@ public class RoutingInstanceCustomizerTest extends WriterCustomizerTest { customizer.writeCurrentAttributes(id, invalidData, writeContext); } - @Test + @Test(expected = UnsupportedOperationException.class) public void updateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(id, validData, validData, writeContext); - } catch (WriteFailedException.UpdateFailedException e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - return; - } - fail("Test should throw WriteFailedException.UpdateFailedException"); + customizer.updateCurrentAttributes(id, validData, validData, writeContext); } @Test diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java index 21a2bdc14..6174f8473 100644 --- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java +++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java @@ -125,14 +125,8 @@ public class RoutingProtocolCustomizerTest extends WriterCustomizerTest { fail("Test should have thrown exception"); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws WriteFailedException { - try { - customizer.updateCurrentAttributes(validId, validData, validData, writeContext); - } catch (Exception e) { - assertTrue(e.getCause() instanceof UnsupportedOperationException); - return; - } - fail("Test should have thrown exception"); + customizer.updateCurrentAttributes(validId, validData, validData, writeContext); } } diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java index bad859176..5208849c9 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizer.java @@ -75,14 +75,6 @@ public class GreCustomizer extends AbstractInterfaceTypeCustomizer<Gre> implemen } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Gre> id, @Nonnull final Gre dataBefore, - @Nonnull final Gre dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException.UpdateFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Gre tunnel update is not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Gre> id, @Nonnull final Gre dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/L2Customizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/L2Customizer.java index 00656a1bf..583f02392 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/L2Customizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/L2Customizer.java @@ -16,16 +16,16 @@ package io.fd.hc2vpp.v3po.interfaces; -import io.fd.honeycomb.translate.spi.write.WriterCustomizer; import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer; import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.honeycomb.translate.spi.write.WriterCustomizer; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.vpp.jvpp.core.future.FutureJVppCore; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces._interface.L2; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/LoopbackCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/LoopbackCustomizer.java index 6f3cda7eb..f0333004c 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/LoopbackCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/LoopbackCustomizer.java @@ -59,14 +59,6 @@ public final class LoopbackCustomizer extends AbstractInterfaceTypeCustomizer<Lo } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Loopback> id, @Nonnull final Loopback dataBefore, - @Nonnull final Loopback dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Modification of loopback interface is not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Loopback> id, @Nonnull final Loopback dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java index 068796e38..f21b0198f 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java @@ -18,11 +18,19 @@ package io.fd.hc2vpp.v3po.interfaces; import static com.google.common.base.Preconditions.checkArgument; +import com.google.common.net.InetAddresses; +import io.fd.hc2vpp.common.translate.util.AbstractInterfaceTypeCustomizer; +import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; +import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.hc2vpp.v3po.DisabledInterfacesManager; +import io.fd.honeycomb.translate.write.WriteContext; +import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel; +import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply; +import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.net.InetAddress; import java.util.concurrent.CompletionStage; - import javax.annotation.Nonnull; - import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -34,18 +42,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.net.InetAddresses; - -import io.fd.hc2vpp.common.translate.util.AbstractInterfaceTypeCustomizer; -import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; -import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.hc2vpp.v3po.DisabledInterfacesManager; -import io.fd.honeycomb.translate.write.WriteContext; -import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel; -import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply; -import io.fd.vpp.jvpp.core.future.FutureJVppCore; - public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> implements JvppReplyConsumer { private static final Logger LOG = LoggerFactory.getLogger(VxlanCustomizer.class); @@ -75,14 +71,6 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Vxlan> id, @Nonnull final Vxlan dataBefore, - @Nonnull final Vxlan dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException.UpdateFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("Vxlan tunnel update is not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Vxlan> id, @Nonnull final Vxlan dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java index 80b666732..1cf4d7bd3 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizer.java @@ -19,10 +19,10 @@ package io.fd.hc2vpp.v3po.interfaces; import static com.google.common.base.Preconditions.checkArgument; import com.google.common.net.InetAddresses; -import io.fd.hc2vpp.v3po.DisabledInterfacesManager; import io.fd.hc2vpp.common.translate.util.AbstractInterfaceTypeCustomizer; import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer; import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.hc2vpp.v3po.DisabledInterfacesManager; import io.fd.honeycomb.translate.write.WriteContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.core.dto.VxlanGpeAddDelTunnel; @@ -69,15 +69,6 @@ public class VxlanGpeCustomizer extends AbstractInterfaceTypeCustomizer<VxlanGpe } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanGpe> id, - @Nonnull final VxlanGpe dataBefore, - @Nonnull final VxlanGpe dataAfter, @Nonnull final WriteContext writeContext) - throws WriteFailedException.UpdateFailedException { - throw new WriteFailedException.UpdateFailedException(id, dataBefore, dataAfter, - new UnsupportedOperationException("VxlanGpe tunnel update is not supported")); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<VxlanGpe> id, @Nonnull final VxlanGpe dataBefore, @Nonnull final WriteContext writeContext) diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfaceCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfaceCustomizer.java index 15d51a830..66ffa7f50 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfaceCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfaceCustomizer.java @@ -78,16 +78,6 @@ public final class MirroredInterfaceCustomizer extends FutureJVppCustomizer sourceInterfaceName, destinationInterfaceName, spanState); } - - @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<MirroredInterface> instanceIdentifier, - @Nonnull final MirroredInterface mirroredInterfaceBefore, - @Nonnull final MirroredInterface mirroredInterfaceAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - deleteCurrentAttributes(instanceIdentifier, mirroredInterfaceBefore, writeContext); - writeCurrentAttributes(instanceIdentifier, mirroredInterfaceAfter, writeContext); - } - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<MirroredInterface> id, @Nonnull final MirroredInterface mirroredInterface, diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizer.java index b97885fd2..002899649 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizer.java @@ -67,15 +67,6 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id, - @Nonnull final ArpTerminationTableEntry dataBefore, - @Nonnull final ArpTerminationTableEntry dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException( - "ARP termination table entry update is not supported. It has to be deleted and then created."); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ArpTerminationTableEntry> id, @Nonnull final ArpTerminationTableEntry dataBefore, @Nonnull final WriteContext writeContext) diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizer.java index e19f00b9e..1b5248f79 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizer.java @@ -74,14 +74,6 @@ public class L2FibEntryCustomizer extends FutureJVppCustomizer } @Override - public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id, - @Nonnull final L2FibEntry dataBefore, @Nonnull final L2FibEntry dataAfter, - @Nonnull final WriteContext writeContext) throws WriteFailedException { - throw new UnsupportedOperationException( - "L2 FIB entry update is not supported. It has to be deleted and then created."); - } - - @Override public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<L2FibEntry> id, @Nonnull final L2FibEntry dataBefore, @Nonnull final WriteContext writeContext) throws WriteFailedException { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java index 50d6754de..5b371e6a1 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/GreCustomizerTest.java @@ -153,15 +153,9 @@ public class GreCustomizerTest extends WriterCustomizerTest { fail("WriteFailedException.CreateFailedException was expected"); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(id, generateGre(), generateGre(), writeContext); - } catch (WriteFailedException.UpdateFailedException e) { - assertEquals(UnsupportedOperationException.class, e.getCause().getClass()); - return; - } - fail("WriteFailedException.UpdateFailedException was expected"); + customizer.updateCurrentAttributes(id, generateGre(), generateGre(), writeContext); } @Test diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java index 3c6ffaf51..af4f6bd40 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java @@ -27,6 +27,15 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.google.common.net.InetAddresses; +import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; +import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.hc2vpp.v3po.DisabledInterfacesManager; +import io.fd.honeycomb.translate.write.WriteFailedException; +import io.fd.vpp.jvpp.VppBaseCallException; +import io.fd.vpp.jvpp.VppInvocationException; +import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel; +import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; @@ -42,17 +51,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces._interface.VxlanBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import com.google.common.net.InetAddresses; - -import io.fd.hc2vpp.common.test.write.WriterCustomizerTest; -import io.fd.hc2vpp.common.translate.util.NamingContext; -import io.fd.hc2vpp.v3po.DisabledInterfacesManager; -import io.fd.honeycomb.translate.write.WriteFailedException; -import io.fd.vpp.jvpp.VppBaseCallException; -import io.fd.vpp.jvpp.VppInvocationException; -import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnel; -import io.fd.vpp.jvpp.core.dto.VxlanAddDelTunnelReply; - public class VxlanCustomizerTest extends WriterCustomizerTest { private static final byte ADD_VXLAN = 1; @@ -187,15 +185,9 @@ public class VxlanCustomizerTest extends WriterCustomizerTest { fail("WriteFailedException.CreateFailedException was expected"); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(id, generateVxlan(10), generateVxlan(11), writeContext); - } catch (WriteFailedException.UpdateFailedException e) { - assertEquals(UnsupportedOperationException.class, e.getCause().getClass()); - return; - } - fail("WriteFailedException.UpdateFailedException was expected"); + customizer.updateCurrentAttributes(id, generateVxlan(10), generateVxlan(11), writeContext); } @Test diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java index 1f3c7ec65..f5bb60fd0 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanGpeCustomizerTest.java @@ -175,15 +175,9 @@ public class VxlanGpeCustomizerTest extends WriterCustomizerTest { fail("WriteFailedException.CreateFailedException was expected"); } - @Test + @Test(expected = UnsupportedOperationException.class) public void testUpdateCurrentAttributes() throws Exception { - try { - customizer.updateCurrentAttributes(id, generateVxlanGpe(10), generateVxlanGpe(11), writeContext); - } catch (WriteFailedException.UpdateFailedException e) { - assertEquals(UnsupportedOperationException.class, e.getCause().getClass()); - return; - } - fail("WriteFailedException.UpdateFailedException was expected"); + customizer.updateCurrentAttributes(id, generateVxlanGpe(10), generateVxlanGpe(11), writeContext); } @Test diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfacesCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfacesCustomizerTest.java index 998c81f8c..edf31a608 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfacesCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/span/MirroredInterfacesCustomizerTest.java @@ -84,12 +84,9 @@ public class MirroredInterfacesCustomizerTest extends WriterCustomizerTest { assertCreateRequest(requestCaptor.getValue()); } - @Test + @Test(expected = UnsupportedOperationException.class) public void updateCurrentAttributes() throws Exception { customizer.updateCurrentAttributes(validId, validData, validData, writeContext); - verify(api, times(2)).swInterfaceSpanEnableDisable(requestCaptor.capture()); - assertDeleteRequest(requestCaptor.getAllValues().get(0)); - assertCreateRequest(requestCaptor.getAllValues().get(1)); } @Test |