From 3a7a67fe142749eb6b41f660d101f3fdffb8b3de Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Wed, 16 Aug 2017 08:09:19 +0200 Subject: HC2VPP-22 - Interconnetion improvements Change-Id: I0abb937df505663ecbae47f4c4a75681b3ff75be Signed-off-by: Jan Srnicek --- .../v3po/interfacesstate/L2CustomizerTest.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'v3po/v3po2vpp/src/test/java/io/fd') diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/L2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/L2CustomizerTest.java index 53934ff80..f3640769b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/L2CustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/L2CustomizerTest.java @@ -105,7 +105,7 @@ public class L2CustomizerTest extends ReaderCustomizerTest { } @Test - public void testRead() throws Exception { + public void testReadBvi() throws Exception { final int ifId = 1; final int bdId = 1; final String bdName = "bd001"; @@ -123,12 +123,28 @@ public class L2CustomizerTest extends ReaderCustomizerTest { getCustomizer().readCurrentAttributes(getL2Id(ifName), builder, ctx); verify(builder).setInterconnection(generateInterconnection(bdName, true)); + } + + // split to separate test to avoid using cached value from previous run(cannot mock cache) + @Test + public void testReadNoBvi() throws Exception { + final Map cachedInterfaceDump = new HashMap<>(); + final int ifId = 1; + final int bdId = 1; + final String bdName = "bd001"; + final String ifName = "eth0.sub0"; + defineMapping(mappingContext, ifName, ifId, IFC_CTX_NAME); + defineMapping(mappingContext, bdName, bdId, BD_CTX_NAME); + + final SwInterfaceDetails ifaceDetails = new SwInterfaceDetails(); + ifaceDetails.subId = ifId; + cachedInterfaceDump.put(ifId, ifaceDetails); // Not BVI whenBridgeDomainDumpThenReturn(Collections .singletonList(generateBdDetails(ifId, 99 /* Different ifc is marked as BVI in bd details */, bdId))); - builder = mock(L2Builder.class); + L2Builder builder = mock(L2Builder.class); getCustomizer().readCurrentAttributes(getL2Id(ifName), builder, ctx); verify(builder).setInterconnection(generateInterconnection(bdName, null)); -- cgit 1.2.3-korg