summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-08-15 10:15:06 +0200
committerMarek Gradzki <mgradzki@cisco.com>2017-08-16 05:37:09 +0000
commitb1b07f942fd77b7d987cc44aabd492db5e8c29a0 (patch)
treebca9afe1e431c7287600c6fd5daa851dc70d3967 /v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java
parentbe31f4746e6ee61dbe448ce0d49b8236bdbcc6f8 (diff)
HC2VPP-205 / HC2VPP-25 - Sub interface caching improvement
Improves dumping mechanism for sub interfaces in a way that if full dump was already performed, it will be used from cache instead of new dump call. Also prevents creating dump dto's if not necessary Change-Id: I46a305ec1b325c2d949bff9e2b151752ccd508b6 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java
index b83b74e2d..e58877eb1 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VhostUserCustomizerTest.java
@@ -21,13 +21,18 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.common.test.read.ReaderCustomizerTest;
import io.fd.hc2vpp.common.test.util.InterfaceDumpHelper;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.hc2vpp.v3po.interfacesstate.cache.InterfaceCacheDumpManager;
+import io.fd.honeycomb.translate.read.ReadFailedException;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetails;
+import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetailsReplyDump;
import java.math.BigInteger;
import org.junit.Test;
+import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceKey;
@@ -37,21 +42,21 @@ 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.state._interface.VhostUser;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces.state._interface.VhostUserBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetails;
-import io.fd.vpp.jvpp.core.dto.SwInterfaceVhostUserDetailsReplyDump;
public class VhostUserCustomizerTest extends ReaderCustomizerTest<VhostUser, VhostUserBuilder> implements
- InterfaceDumpHelper {
+ InterfaceDumpHelper {
private static final String IFC_CTX_NAME = "ifc-test-instance";
private static final String IF_NAME = "VirtualEthernet1";
private static final int IF_INDEX = 1;
private static final InstanceIdentifier<VhostUser> IID =
- InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
- .augmentation(VppInterfaceStateAugmentation.class).child(VhostUser.class);
+ InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(IF_NAME))
+ .augmentation(VppInterfaceStateAugmentation.class).child(VhostUser.class);
private NamingContext interfaceContext;
+ @Mock
+ private InterfaceCacheDumpManager dumpCacheManager;
+
public VhostUserCustomizerTest() {
super(VhostUser.class, VppInterfaceStateAugmentationBuilder.class);
}
@@ -60,7 +65,7 @@ public class VhostUserCustomizerTest extends ReaderCustomizerTest<VhostUser, Vho
protected void setUp() throws Exception {
interfaceContext = new NamingContext("generatedIfaceName", IFC_CTX_NAME);
defineMapping(mappingContext, IF_NAME, IF_INDEX, IFC_CTX_NAME);
- whenSwInterfaceDumpThenReturn(api, ifaceDetails());
+ when(dumpCacheManager.getInterfaceDetail(IID, ctx, IF_NAME)).thenReturn(ifaceDetails());
}
private SwInterfaceDetails ifaceDetails() {
@@ -73,7 +78,7 @@ public class VhostUserCustomizerTest extends ReaderCustomizerTest<VhostUser, Vho
@Override
protected ReaderCustomizer<VhostUser, VhostUserBuilder> initCustomizer() {
- return new VhostUserCustomizer(api, interfaceContext);
+ return new VhostUserCustomizer(api, interfaceContext, dumpCacheManager);
}
@Test