diff options
Diffstat (limited to 'nat')
7 files changed, 4 insertions, 58 deletions
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); |