diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-06-13 14:58:50 +0200 |
---|---|---|
committer | Maros Marsalek <mmarsale@cisco.com> | 2016-06-15 10:32:09 +0000 |
commit | 48616592e8fb84332bff5e6302043a0505dc629b (patch) | |
tree | d316a2cf4bca3ce4a210d66118dd7b2776a16121 /v3po/v3po2vpp/src/test | |
parent | bbf5b67cad0e7b513cc2060fa721e385f80c2ad5 (diff) |
HONEYCOMB-91: initializer for L2 FIB tables
Change-Id: I7f133ea56fc3bb11e0f4b584839dabc0754a8d50
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test')
8 files changed, 85 insertions, 70 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java index 7baa028d8..b6309d86b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java @@ -88,13 +88,13 @@ public class L2CustomizerTest extends ChildReaderCustomizerTest<L2, L2Builder> { private InstanceIdentifier<L2> getL2Id(final String name) { return InstanceIdentifier.create(InterfacesState.class).child(Interface.class, new InterfaceKey(name)) - .augmentation( - VppInterfaceStateAugmentation.class).child(L2.class); + .augmentation( + VppInterfaceStateAugmentation.class).child(L2.class); } private void whenBridgeDomainSwIfDumpThenReturn(final List<BridgeDomainSwIfDetails> bdSwIfList, final List<BridgeDomainDetails> bridgeDomainDetailses) - throws ExecutionException, InterruptedException, VppInvocationException { + throws ExecutionException, InterruptedException, VppInvocationException { final BridgeDomainDetailsReplyDump reply = new BridgeDomainDetailsReplyDump(); reply.bridgeDomainSwIfDetails = bdSwIfList; reply.bridgeDomainDetails = bridgeDomainDetailses; @@ -117,7 +117,7 @@ public class L2CustomizerTest extends ChildReaderCustomizerTest<L2, L2Builder> { final BridgeBasedBuilder bbBuilder = new BridgeBasedBuilder(); bbBuilder.setBridgeDomain(bdName); bbBuilder.setSplitHorizonGroup((short) 1); - if(bvi != null) { + if (bvi != null) { bbBuilder.setBridgedVirtualInterface(bvi); } else { bbBuilder.setBridgedVirtualInterface(false); // false is default diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java index 5828da850..7e916eaf4 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/test/ContextTestUtils.java @@ -38,20 +38,23 @@ public class ContextTestUtils { return Optional.of(new MappingBuilder().setName(name).setIndex(index).build()); } - public static KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String name, final String namingContextName) { + public static KeyedInstanceIdentifier<Mapping, MappingKey> getMappingIid(final String name, + final String namingContextName) { return InstanceIdentifier.create(Contexts.class).child( - org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext.class, - new NamingContextKey(namingContextName)).child(Mappings.class).child(Mapping.class, new MappingKey(name)); + org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.context.rev160513.contexts.NamingContext.class, + new NamingContextKey(namingContextName)).child(Mappings.class).child(Mapping.class, new MappingKey(name)); } - public static void mockMapping(final MappingContext mappingContext, final String name, final int id, final String namingContextName) { - final InstanceIdentifier<Mappings> mappingsIid = getMappingIid(name, namingContextName).firstIdentifierOf(Mappings.class); + public static void mockMapping(final MappingContext mappingContext, final String name, final int id, + final String namingContextName) { + final InstanceIdentifier<Mappings> mappingsIid = + getMappingIid(name, namingContextName).firstIdentifierOf(Mappings.class); final Optional<Mapping> singleMapping = getMapping(name, id); final Optional<Mappings> previousMappings = mappingContext.read(mappingsIid); final MappingsBuilder mappingsBuilder; - if(previousMappings != null && previousMappings.isPresent()) { + if (previousMappings != null && previousMappings.isPresent()) { mappingsBuilder = new MappingsBuilder(previousMappings.get()); } else { mappingsBuilder = new MappingsBuilder(); @@ -61,7 +64,7 @@ public class ContextTestUtils { final List<Mapping> mappingList = mappingsBuilder.getMapping(); mappingList.add(singleMapping.get()); doReturn(Optional.of(mappingsBuilder.setMapping(mappingList).build())) - .when(mappingContext).read(mappingsIid); + .when(mappingContext).read(mappingsIid); doReturn(singleMapping).when(mappingContext).read(getMappingIid(name, namingContextName)); } } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java index 50311a945..ff9c0cf9b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/BridgeDomainCustomizerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package io.fd.honeycomb.v3po.translate.v3po.vpp; import static io.fd.honeycomb.v3po.translate.v3po.test.ContextTestUtils.getMapping; @@ -87,17 +88,17 @@ public class BridgeDomainCustomizerTest { private BridgeDomain generateBridgeDomain(final String bdName, final int arpTerm, final int flood, final int forward, final int learn, final int uuf) { return new BridgeDomainBuilder() - .setName(bdName) - .setArpTermination(BridgeDomainTestUtils.intToBoolean(arpTerm)) - .setFlood(BridgeDomainTestUtils.intToBoolean(flood)) - .setForward(BridgeDomainTestUtils.intToBoolean(forward)) - .setLearn(BridgeDomainTestUtils.intToBoolean(learn)) - .setUnknownUnicastFlood(BridgeDomainTestUtils.intToBoolean(uuf)) - .build(); + .setName(bdName) + .setArpTermination(BridgeDomainTestUtils.intToBoolean(arpTerm)) + .setFlood(BridgeDomainTestUtils.intToBoolean(flood)) + .setForward(BridgeDomainTestUtils.intToBoolean(forward)) + .setLearn(BridgeDomainTestUtils.intToBoolean(learn)) + .setUnknownUnicastFlood(BridgeDomainTestUtils.intToBoolean(uuf)) + .build(); } private void verifyBridgeDomainAddOrUpdateWasInvoked(final BridgeDomain bd, final int bdId) - throws VppInvocationException { + throws VppInvocationException { final byte arpTerm = BridgeDomainTestUtils.booleanToByte(bd.isArpTermination()); final byte flood = BridgeDomainTestUtils.booleanToByte(bd.isFlood()); final byte forward = BridgeDomainTestUtils.booleanToByte(bd.isForward()); @@ -131,7 +132,7 @@ public class BridgeDomainCustomizerTest { } private void whenBridgeDomainAddDelThenSuccess() - throws ExecutionException, InterruptedException, VppInvocationException { + throws ExecutionException, InterruptedException, VppInvocationException { final CompletionStage<BridgeDomainAddDelReply> replyCS = mock(CompletionStage.class); final CompletableFuture<BridgeDomainAddDelReply> replyFuture = mock(CompletableFuture.class); when(replyCS.toCompletableFuture()).thenReturn(replyFuture); @@ -141,9 +142,9 @@ public class BridgeDomainCustomizerTest { } private void whenBridgeDomainAddDelThenFailure() - throws ExecutionException, InterruptedException, VppInvocationException { + throws ExecutionException, InterruptedException, VppInvocationException { doReturn(TestHelperUtils.<BridgeDomainAddDelReply>createFutureException()).when(api) - .bridgeDomainAddDel(any(BridgeDomainAddDel.class)); + .bridgeDomainAddDel(any(BridgeDomainAddDel.class)); } @Test @@ -152,7 +153,7 @@ public class BridgeDomainCustomizerTest { final String bdName = "bd1"; final BridgeDomain bd = generateBridgeDomain(bdName); doReturn(Optional.absent()).when(mappingContext) - .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class)); + .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class)); whenBridgeDomainAddDelThenSuccess(); @@ -170,7 +171,7 @@ public class BridgeDomainCustomizerTest { // Returning no Mappings for "test-instance" makes bdContext.containsName() return false doReturn(Optional.absent()).when(mappingContext) - .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class)); + .read(getMappingIid(bdName, "test-instance").firstIdentifierOf(Mappings.class)); whenBridgeDomainAddDelThenFailure(); @@ -244,16 +245,15 @@ public class BridgeDomainCustomizerTest { final byte uufBefore = 0; final BridgeDomain dataBefore = - generateBridgeDomain(bdName, arpTermBefore, floodBefore, forwardBefore, learnBefore, uufBefore); + generateBridgeDomain(bdName, arpTermBefore, floodBefore, forwardBefore, learnBefore, uufBefore); final BridgeDomain dataAfter = - generateBridgeDomain(bdName, arpTermBefore ^ 1, floodBefore ^ 1, forwardBefore ^ 1, learnBefore ^ 1, - uufBefore ^ 1); + generateBridgeDomain(bdName, arpTermBefore ^ 1, floodBefore ^ 1, forwardBefore ^ 1, learnBefore ^ 1, + uufBefore ^ 1); whenBridgeDomainAddDelThenSuccess(); customizer - .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), dataBefore, dataAfter, ctx); - + .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), dataBefore, dataAfter, ctx); verifyBridgeDomainAddOrUpdateWasInvoked(dataAfter, bdId); } @@ -266,7 +266,7 @@ public class BridgeDomainCustomizerTest { try { customizer - .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx); + .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx); } catch (IllegalArgumentException e) { verify(api, never()).bridgeDomainAddDel(any(BridgeDomainAddDel.class)); return; @@ -278,16 +278,16 @@ public class BridgeDomainCustomizerTest { public void testUpdateBridgeDomainFailed() throws Exception { final int bdId = 1; final String bdName = "bd1"; - final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0 ,1, 0); - final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0 ,1, 0); + final BridgeDomain bdBefore = generateBridgeDomain(bdName, 0, 1, 0, 1, 0); + final BridgeDomain bdAfter = generateBridgeDomain(bdName, 1, 1, 0, 1, 0); doReturn(getMapping(bdName, bdId)).when(mappingContext).read(getMappingIid(bdName, "test-instance")); whenBridgeDomainAddDelThenFailure(); try { customizer - .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx); - } catch (WriteFailedException.UpdateFailedException e) { + .updateCurrentAttributes(BridgeDomainTestUtils.bdIdentifierForName(bdName), bdBefore, bdAfter, ctx); + } catch (WriteFailedException.UpdateFailedException e) { verifyBridgeDomainAddOrUpdateWasInvoked(bdAfter, bdId); return; } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java index 343794073..fb41b91c7 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vpp/L2FibEntryCustomizerTest.java @@ -86,7 +86,7 @@ public class L2FibEntryCustomizerTest { private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final PhysAddress address) { return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(BD_NAME)) - .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); + .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); } private void whenL2FibAddDelThenSuccess() { @@ -98,7 +98,7 @@ public class L2FibEntryCustomizerTest { private void whenL2FibAddDelThenFailure() { doReturn(TestHelperUtils.<L2InterfaceVlanTagRewriteReply>createFutureException()).when(api) - .l2FibAddDel(any(L2FibAddDel.class)); + .l2FibAddDel(any(L2FibAddDel.class)); } private L2FibAddDel generateL2FibAddDelRequest(final long mac, final byte isAdd) { @@ -126,7 +126,7 @@ public class L2FibEntryCustomizerTest { } private void verifyL2FibAddDelWasInvoked(final L2FibAddDel expected) throws - VppInvocationException { + VppInvocationException { ArgumentCaptor<L2FibAddDel> argumentCaptor = ArgumentCaptor.forClass(L2FibAddDel.class); verify(api).l2FibAddDel(argumentCaptor.capture()); final L2FibAddDel actual = argumentCaptor.getValue(); @@ -180,7 +180,7 @@ public class L2FibEntryCustomizerTest { @Test(expected = UnsupportedOperationException.class) public void testUpdate() throws Exception { customizer.updateCurrentAttributes(InstanceIdentifier.create(L2FibEntry.class), mock(L2FibEntry.class), - mock(L2FibEntry.class), writeContext); + mock(L2FibEntry.class), writeContext); } @Test diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java index 80403eb58..7639f4849 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizerTest.java @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package io.fd.honeycomb.v3po.translate.v3po.vppstate; import static org.mockito.Mockito.mock; @@ -29,7 +30,8 @@ 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.vpp.state.bridge.domains.BridgeDomainBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomainKey; -public class BridgeDomainCustomizerTest extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> { +public class BridgeDomainCustomizerTest + extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> { private NamingContext bdContext; private NamingContext interfacesContext; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java index 4808b6d88..1f668b817 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizerTest.java @@ -83,11 +83,11 @@ public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntr private static InstanceIdentifier<L2FibEntry> getL2FibEntryId(final String bdName, final PhysAddress address) { return InstanceIdentifier.create(BridgeDomains.class).child(BridgeDomain.class, new BridgeDomainKey(bdName)) - .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); + .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); } private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> l2FibTableEntryList) - throws ExecutionException, InterruptedException, VppInvocationException { + throws ExecutionException, InterruptedException, VppInvocationException { final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump(); reply.l2FibTableEntry = l2FibTableEntryList; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java index 8b11769d6..782924490 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java @@ -99,19 +99,21 @@ public class VppStateTest { bdContext = new NamingContext("generatedBdName", "bd-test-instance"); interfaceContext = new NamingContext("generatedIfaceName", "ifc-test-instance"); vppStateReader = VppStateTestUtils.getVppStateReader(api, bdContext); - readerRegistry = new DelegatingReaderRegistry(Collections.<Reader<? extends DataObject>>singletonList(vppStateReader)); + readerRegistry = + new DelegatingReaderRegistry(Collections.<Reader<? extends DataObject>>singletonList(vppStateReader)); } private static Version getVersion() { return new VersionBuilder() - .setName("test") - .setBuildDirectory("1") - .setBranch("2") - .setBuildDate("3") - .build(); + .setName("test") + .setBuildDirectory("1") + .setBranch("2") + .setBuildDate("3") + .build(); } - private void whenShowVersionThenReturn(int retval, Version version) throws ExecutionException, InterruptedException, VppInvocationException { + private void whenShowVersionThenReturn(int retval, Version version) + throws ExecutionException, InterruptedException, VppInvocationException { final CompletableFuture<ShowVersionReply> replyFuture = new CompletableFuture<>(); final ShowVersionReply reply = new ShowVersionReply(); reply.buildDate = version.getBuildDate().getBytes(); @@ -123,7 +125,8 @@ public class VppStateTest { when(api.showVersion(any(ShowVersion.class))).thenReturn(replyFuture); } - private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) throws ExecutionException, InterruptedException, VppInvocationException { + private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) + throws ExecutionException, InterruptedException, VppInvocationException { final CompletionStage<L2FibTableEntryReplyDump> replyCS = mock(CompletionStage.class); final CompletableFuture<L2FibTableEntryReplyDump> replyFuture = mock(CompletableFuture.class); when(replyCS.toCompletableFuture()).thenReturn(replyFuture); @@ -133,7 +136,8 @@ public class VppStateTest { when(api.l2FibTableDump(any(L2FibTableDump.class))).thenReturn(replyCS); } - private void whenBridgeDomainDumpThenReturn(final List<BridgeDomainDetails> bdList) throws ExecutionException, InterruptedException, VppInvocationException { + private void whenBridgeDomainDumpThenReturn(final List<BridgeDomainDetails> bdList) + throws ExecutionException, InterruptedException, VppInvocationException { final CompletionStage<BridgeDomainDetailsReplyDump> replyCS = mock(CompletionStage.class); final CompletableFuture<BridgeDomainDetailsReplyDump> replyFuture = mock(CompletableFuture.class); when(replyCS.toCompletableFuture()).thenReturn(replyFuture); @@ -142,7 +146,7 @@ public class VppStateTest { when(replyFuture.get()).thenReturn(reply); doAnswer(invocation -> { - BridgeDomainDump request = (BridgeDomainDump)invocation.getArguments()[0]; + BridgeDomainDump request = (BridgeDomainDump) invocation.getArguments()[0]; if (request.bdId == -1) { reply.bridgeDomainDetails = bdList; } else { @@ -167,9 +171,11 @@ public class VppStateTest { whenBridgeDomainDumpThenReturn(bdList); - final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects = readerRegistry.readAll(ctx); + final Multimap<InstanceIdentifier<? extends DataObject>, ? extends DataObject> dataObjects = + readerRegistry.readAll(ctx); assertEquals(dataObjects.size(), 1); - final VppState dataObject = (VppState)Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet()))); + final VppState dataObject = + (VppState) Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet()))); assertEquals(version, dataObject.getVersion()); assertEquals(2, dataObject.getBridgeDomains().getBridgeDomain().size()); } @@ -221,15 +227,19 @@ public class VppStateTest { whenL2FibTableDumpThenReturn(Collections.singletonList(l2FibEntry)); // Deep child without a dedicated reader with specific l2fib key - final InstanceIdentifier<? extends DataObject> idExisting = InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( - BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("01:02:03:04:05:06"))); + final InstanceIdentifier<? extends DataObject> idExisting = + InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( + BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class) + .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("01:02:03:04:05:06"))); Optional<? extends DataObject> read = readerRegistry.read(idExisting, ctx); assertTrue(read.isPresent()); // non existing l2fib - final InstanceIdentifier<? extends DataObject> idNonExisting = InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( - BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("FF:FF:FF:04:05:06"))); + final InstanceIdentifier<? extends DataObject> idNonExisting = + InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child( + BridgeDomain.class, new BridgeDomainKey("bdn1")).child(L2FibTable.class) + .child(L2FibEntry.class, new L2FibEntryKey(new PhysAddress("FF:FF:FF:04:05:06"))); read = readerRegistry.read(idNonExisting, ctx); assertFalse(read.isPresent()); } @@ -276,7 +286,7 @@ public class VppStateTest { assertTrue(read.isPresent()); assertEquals(readRoot.getBridgeDomains().getBridgeDomain().stream().filter( - input -> input.getKey().getName().equals(bdName)).findFirst().get(), + input -> input.getKey().getName().equals(bdName)).findFirst().get(), read.get()); } diff --git a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java index 8fd57d679..27095c7d9 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTestUtils.java @@ -50,31 +50,31 @@ final class VppStateTestUtils { @Nonnull final NamingContext bdContext) { final ChildReader<Version> versionReader = new CompositeChildReader<>( - Version.class, new VersionCustomizer(futureJVpp)); + Version.class, new VersionCustomizer(futureJVpp)); final CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader = - getBridgeDomainReader(futureJVpp, bdContext); + getBridgeDomainReader(futureJVpp, bdContext); final ChildReader<BridgeDomains> bridgeDomainsReader = new CompositeChildReader<>( - BridgeDomains.class, - RWUtils.singletonChildReaderList(bridgeDomainReader), - new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class)); + BridgeDomains.class, + RWUtils.singletonChildReaderList(bridgeDomainReader), + new ReflexiveChildReaderCustomizer<>(BridgeDomainsBuilder.class)); final List<ChildReader<? extends ChildOf<VppState>>> childVppReaders = new ArrayList<>(); childVppReaders.add(versionReader); childVppReaders.add(bridgeDomainsReader); return new CompositeRootReader<>( - VppState.class, - childVppReaders, - RWUtils.<VppState>emptyAugReaderList(), - new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class)); + VppState.class, + childVppReaders, + RWUtils.<VppState>emptyAugReaderList(), + new ReflexiveRootReaderCustomizer<>(VppStateBuilder.class)); } static CompositeListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> getBridgeDomainReader( - final @Nonnull FutureJVpp futureJVpp, @Nonnull final NamingContext bdContext) { + final @Nonnull FutureJVpp futureJVpp, @Nonnull final NamingContext bdContext) { return new CompositeListReader<>( - BridgeDomain.class, - new BridgeDomainCustomizer(futureJVpp, bdContext)); + BridgeDomain.class, + new BridgeDomainCustomizer(futureJVpp, bdContext)); } } |