diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2017-05-19 14:01:09 +0200 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2017-05-19 14:01:11 +0200 |
commit | b5d9c75265a5779ed7404b426f3f91a6b1e07e49 (patch) | |
tree | 12c935f9a56b345eb4d1e86d04eecba6f865fbed /v3po/v3po2vpp/src/test/java/io | |
parent | 1b5053846c1ee87fb6c23678717a7e7f74487699 (diff) |
Adapt to vpp API changes
Changes were introduced by
https://gerrit.fd.io/r/#/c/6662/
Change-Id: If5d4866339623c6789ac1674c5c190a4a28f51c6
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test/java/io')
3 files changed, 37 insertions, 41 deletions
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 96645551b..1d58efc5e 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 @@ -21,9 +21,14 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -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.translate.util.NamingContext; +import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; +import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails; +import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump; +import io.fd.vpp.jvpp.core.dto.BridgeDomainDump; +import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails; +import io.fd.vpp.jvpp.core.types.BridgeDomainSwIf; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -39,11 +44,6 @@ 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.rev170315.l2.base.attributes.Interconnection; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315.l2.base.attributes.interconnection.BridgeBasedBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails; -import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump; -import io.fd.vpp.jvpp.core.dto.BridgeDomainDump; -import io.fd.vpp.jvpp.core.dto.BridgeDomainSwIfDetails; -import io.fd.vpp.jvpp.core.dto.SwInterfaceDetails; public class L2CustomizerTest extends ReaderCustomizerTest<L2, L2Builder> { @@ -73,24 +73,21 @@ public class L2CustomizerTest extends ReaderCustomizerTest<L2, L2Builder> { VppInterfaceStateAugmentation.class).child(L2.class); } - private void whenBridgeDomainSwIfDumpThenReturn(final List<BridgeDomainSwIfDetails> bdSwIfList, - final List<BridgeDomainDetails> bridgeDomainDetailses) { + private void whenBridgeDomainDumpThenReturn(final List<BridgeDomainDetails> bridgeDomainDetails) { final BridgeDomainDetailsReplyDump reply = new BridgeDomainDetailsReplyDump(); - reply.bridgeDomainSwIfDetails = bdSwIfList; - reply.bridgeDomainDetails = bridgeDomainDetailses; - when(api.bridgeDomainSwIfDump(any(BridgeDomainDump.class))).thenReturn(future(reply)); + reply.bridgeDomainDetails = bridgeDomainDetails; + when(api.bridgeDomainDump(any(BridgeDomainDump.class))).thenReturn(future(reply)); } - private BridgeDomainSwIfDetails generateBdSwIfDetails(final int ifId, final int bdId) { - final BridgeDomainSwIfDetails bdSwIfDetails = new BridgeDomainSwIfDetails(); + private BridgeDomainSwIf generateBdSwIfDetails(final int ifId) { + final BridgeDomainSwIf bdSwIfDetails = new BridgeDomainSwIf(); bdSwIfDetails.swIfIndex = ifId; bdSwIfDetails.shg = 1; - bdSwIfDetails.bdId = bdId; return bdSwIfDetails; } - private Interconnection generateInterconnection(final int ifId, final String bdName, final Boolean bvi) { + private Interconnection generateInterconnection(final String bdName, final Boolean bvi) { final BridgeBasedBuilder bbBuilder = new BridgeBasedBuilder(); bbBuilder.setBridgeDomain(bdName); bbBuilder.setSplitHorizonGroup((short) 1); @@ -118,28 +115,28 @@ public class L2CustomizerTest extends ReaderCustomizerTest<L2, L2Builder> { cache.put(InterfaceCustomizer.DUMPED_IFCS_CONTEXT_KEY, cachedInterfaceDump); // BVIinterfaceContext - whenBridgeDomainSwIfDumpThenReturn(Collections.singletonList(generateBdSwIfDetails(ifId, bdId)), - Collections.singletonList(generateBdDetails(ifId, bdId))); + whenBridgeDomainDumpThenReturn(Collections.singletonList(generateBdDetails(ifId, ifId, bdId))); L2Builder builder = mock(L2Builder.class); getCustomizer().readCurrentAttributes(getL2Id(ifName), builder, ctx); - verify(builder).setInterconnection(generateInterconnection(ifId, bdName, true)); + verify(builder).setInterconnection(generateInterconnection(bdName, true)); // Not BVI - whenBridgeDomainSwIfDumpThenReturn(Collections.singletonList(generateBdSwIfDetails(ifId, bdId)), - Collections.singletonList(generateBdDetails(99 /* Different ifc is marked as BVI in bd details */, bdId))); + whenBridgeDomainDumpThenReturn(Collections + .singletonList(generateBdDetails(ifId, 99 /* Different ifc is marked as BVI in bd details */, bdId))); builder = mock(L2Builder.class); getCustomizer().readCurrentAttributes(getL2Id(ifName), builder, ctx); - verify(builder).setInterconnection(generateInterconnection(ifId, bdName, null)); + verify(builder).setInterconnection(generateInterconnection(bdName, null)); } - private BridgeDomainDetails generateBdDetails(final int ifId, final int bdId) { + private BridgeDomainDetails generateBdDetails(final int ifId, final int bviSwIfIndex, int bdId) { final BridgeDomainDetails bridgeDomainDetails = new BridgeDomainDetails(); - bridgeDomainDetails.bviSwIfIndex = ifId; + bridgeDomainDetails.bviSwIfIndex = bviSwIfIndex; bridgeDomainDetails.bdId = bdId; + bridgeDomainDetails.swIfDetails = new BridgeDomainSwIf[] {generateBdSwIfDetails(ifId)}; return bridgeDomainDetails; } }
\ No newline at end of file diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java index 1633cab5b..e9031c93f 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java @@ -22,15 +22,18 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; -import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest; +import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; +import io.fd.vpp.jvpp.VppInvocationException; +import io.fd.vpp.jvpp.core.dto.L2FibTableDetails; +import io.fd.vpp.jvpp.core.dto.L2FibTableDetailsReplyDump; +import io.fd.vpp.jvpp.core.dto.L2FibTableDump; import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutionException; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress; -import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315.BridgeDomains; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315.BridgeDomainsState; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315.L2FibForward; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315.bridge.domains.state.BridgeDomain; @@ -41,10 +44,6 @@ 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.rev170315.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315.l2.fib.attributes.l2.fib.table.L2FibEntryKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import io.fd.vpp.jvpp.VppInvocationException; -import io.fd.vpp.jvpp.core.dto.L2FibTableDump; -import io.fd.vpp.jvpp.core.dto.L2FibTableEntry; -import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump; public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntry, L2FibEntryKey, L2FibEntryBuilder> { @@ -78,10 +77,10 @@ public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntr .child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address)); } - private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> l2FibTableEntryList) + private void whenL2FibTableDumpThenReturn(final List<L2FibTableDetails> l2FibTableEntryList) throws ExecutionException, InterruptedException, VppInvocationException { - final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump(); - reply.l2FibTableEntry = l2FibTableEntryList; + final L2FibTableDetailsReplyDump reply = new L2FibTableDetailsReplyDump(); + reply.l2FibTableDetails = l2FibTableEntryList; when(api.l2FibTableDump(any(L2FibTableDump.class))).thenReturn(future(reply)); } @@ -104,8 +103,8 @@ public class L2FibEntryCustomizerTest extends ListReaderCustomizerTest<L2FibEntr verify(builder).setKey(new L2FibEntryKey(address)); } - private L2FibTableEntry generateL2FibEntry(final long mac) { - final L2FibTableEntry entry = new L2FibTableEntry(); + private L2FibTableDetails generateL2FibEntry(final long mac) { + final L2FibTableDetails entry = new L2FibTableDetails(); entry.mac = mac; entry.swIfIndex = IFACE_ID; return entry; diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java index 800bb8311..24b85587c 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java @@ -40,9 +40,9 @@ import io.fd.honeycomb.translate.read.registry.ReaderRegistry; import io.fd.vpp.jvpp.core.dto.BridgeDomainDetails; import io.fd.vpp.jvpp.core.dto.BridgeDomainDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.BridgeDomainDump; +import io.fd.vpp.jvpp.core.dto.L2FibTableDetails; +import io.fd.vpp.jvpp.core.dto.L2FibTableDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.L2FibTableDump; -import io.fd.vpp.jvpp.core.dto.L2FibTableEntry; -import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.Arrays; import java.util.Collections; @@ -107,9 +107,9 @@ public class L2StateTest implements FutureProducer, NamingContextHelper { readerRegistry = getVppStateReader(api, bdContext); } - private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) { - final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump(); - reply.l2FibTableEntry = entryList; + private void whenL2FibTableDumpThenReturn(final List<L2FibTableDetails> entryList) { + final L2FibTableDetailsReplyDump reply = new L2FibTableDetailsReplyDump(); + reply.l2FibTableDetails = entryList; when(api.l2FibTableDump(any(L2FibTableDump.class))).thenReturn(future(reply)); } |