From 512143ddd9995d16d9bb055481721fa276ccfa01 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Wed, 5 Oct 2016 12:05:18 +0200 Subject: HONEYCOMB-176 : Implemented delete for Routing Change-Id: Idbf139773441e72e47c49518235b03a71e398acf Signed-off-by: Jan Srnicek --- .../v3po/interfaces/RoutingCustomizerTest.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'v3po/v3po2vpp/src/test/java/io') diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java index 54dc81d6a..930e3d14f 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/translate/v3po/interfaces/RoutingCustomizerTest.java @@ -24,6 +24,8 @@ import static org.mockito.Mockito.when; import io.fd.honeycomb.translate.vpp.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.honeycomb.vpp.test.write.WriterCustomizerTest; +import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTable; +import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTableReply; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface; @@ -32,16 +34,14 @@ 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.rev150105.interfaces._interface.Routing; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.RoutingBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTable; -import io.fd.vpp.jvpp.core.dto.SwInterfaceSetTableReply; public class RoutingCustomizerTest extends WriterCustomizerTest { private static final String IFACE_CTX_NAME = "interface-ctx"; private static final String IF_NAME = "eth1"; private static final int IF_INDEX = 1; private static final InstanceIdentifier IID = - InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)) - .augmentation(VppInterfaceAugmentation.class).child(Routing.class); + InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(IF_NAME)) + .augmentation(VppInterfaceAugmentation.class).child(Routing.class); private RoutingCustomizer customizer; @@ -80,8 +80,15 @@ public class RoutingCustomizerTest extends WriterCustomizerTest { @Test public void testDelete() throws WriteFailedException { + when(api.swInterfaceSetTable(any())).thenReturn(future(new SwInterfaceSetTableReply())); + customizer.deleteCurrentAttributes(IID, routing(123), writeContext); + verify(api).swInterfaceSetTable(expectedRequest(0)); + } + + @Test(expected = WriteFailedException.DeleteFailedException.class) + public void testDeleteFailed() throws WriteFailedException { + when(api.swInterfaceSetTable(any())).thenReturn(failedFuture()); customizer.deleteCurrentAttributes(IID, routing(123), writeContext); - verifyZeroInteractions(api); } private Routing routing(final long vrfId) { -- cgit 1.2.3-korg