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 | cc306a6e41824f2de2fe9f3cd2f788c7e5c41cd5 (patch) | |
tree | 537b1ae2d6b17f003e2fec0dfddd9cbaf17ab4fa /v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate | |
parent | cb00de1bc91091060dfb688876b45b7dc740318e (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/java/io/fd/honeycomb/v3po/translate/v3po/vppstate')
4 files changed, 44 insertions, 32 deletions
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)); } } |