summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/test
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-03-14 09:29:12 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-03-14 14:33:40 +0100
commit5ec31f19f7a74a884e2bef8e5238fdd4cfa2c4c2 (patch)
tree53a3542d6ea26cb9d6f4ab5d827a12b2d9543db9 /v3po/v3po2vpp/src/test
parent4616f0300655582153362a21910bd1f0b14937ae (diff)
HC2VPP-7 - Split vpp state/Cli RPC to separate module
Introduces VppManageModule containing - Vpp state attributes - CLI RPC support - Keep-alive Change-Id: I8907e57132cc9e57840aa3b9607fa131a77f767d Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/test')
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java10
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java (renamed from v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java)8
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizerTest.java (renamed from v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizerTest.java)10
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizerTest.java (renamed from v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizerTest.java)8
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizerTest.java (renamed from v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizerTest.java)17
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java (renamed from v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizerTest.java)11
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java (renamed from v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VppStateTest.java)178
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java52
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java60
-rw-r--r--v3po/v3po2vpp/src/test/resources/v3po.json3
10 files changed, 63 insertions, 294 deletions
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java
index 66231b2ff..9d799d850 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/V3poModuleTest.java
@@ -19,7 +19,6 @@ package io.fd.hc2vpp.v3po;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.Matchers.empty;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.mockito.MockitoAnnotations.initMocks;
@@ -29,7 +28,6 @@ import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
-import io.fd.hc2vpp.v3po.cfgattrs.V3poConfiguration;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.translate.impl.write.registry.FlatWriterRegistryBuilder;
@@ -70,9 +68,6 @@ public class V3poModuleTest {
@Inject
private Set<WriterFactory> writerFactories = new HashSet<>();
- @Inject
- private V3poConfiguration configuration;
-
@Before
public void setUp() {
initMocks(this);
@@ -99,8 +94,5 @@ public class V3poModuleTest {
assertNotNull(registryBuilder.build());
}
- @Test
- public void testConfiguration() {
- assertEquals(30, configuration.getKeepaliveDelay());
- }
+
} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java
index c1dd5b170..29caf068b 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/ArpTerminationTableEntryCustomizerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po.vpp;
+package io.fd.hc2vpp.v3po.l2;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
@@ -38,13 +38,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
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.rev161214.BridgeDomains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.ArpTerminationTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domain.attributes.arp.termination.table.ArpTerminationTableEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest {
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizerTest.java
index 25b398fab..8bf7007fe 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/BridgeDomainCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/BridgeDomainCustomizerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po.vpp;
+package io.fd.hc2vpp.v3po.l2;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
@@ -38,14 +38,14 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppInterfaceAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.interfaces._interface.L2Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.base.attributes.interconnection.BridgeBasedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizerTest.java
index 551b0879e..b00e9e7e2 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/L2FibEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2/L2FibEntryCustomizerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po.vpp;
+package io.fd.hc2vpp.v3po.l2;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -34,15 +34,15 @@ import io.fd.vpp.jvpp.core.dto.L2FibAddDelReply;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
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.rev161214.BridgeDomains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibFilter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.BridgeDomainKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class L2FibEntryCustomizerTest extends WriterCustomizerTest {
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizerTest.java
index 0fbdb986e..98e0cde08 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/BridgeDomainCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/BridgeDomainCustomizerTest.java
@@ -14,15 +14,16 @@
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po.vppstate;
+package io.fd.hc2vpp.v3po.l2state;
-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 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey;
+
public class BridgeDomainCustomizerTest
extends ListReaderCustomizerTest<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> {
@@ -31,7 +32,7 @@ public class BridgeDomainCustomizerTest
private NamingContext interfacesContext;
public BridgeDomainCustomizerTest() {
- super(BridgeDomain.class, BridgeDomainsBuilder.class);
+ super(BridgeDomain.class, BridgeDomainsStateBuilder.class);
}
@Override
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java
index 94a654c15..836653b28 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/L2FibEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2FibEntryCustomizerTest.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po.vppstate;
+package io.fd.hc2vpp.v3po.l2state;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
@@ -30,15 +30,16 @@ 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.rev161214.BridgeDomains;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.L2FibForward;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import io.fd.vpp.jvpp.VppInvocationException;
import io.fd.vpp.jvpp.core.dto.L2FibTableDump;
@@ -73,7 +74,7 @@ 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))
+ return InstanceIdentifier.create(BridgeDomainsState.class).child(BridgeDomain.class, new BridgeDomainKey(bdName))
.child(L2FibTable.class).child(L2FibEntry.class, new L2FibEntryKey(address));
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VppStateTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java
index 7134a595a..9a0d0e4c8 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VppStateTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/l2state/L2StateTest.java
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package io.fd.hc2vpp.v3po.vppstate;
+package io.fd.hc2vpp.v3po.l2state;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doAnswer;
@@ -28,53 +27,39 @@ import static org.mockito.MockitoAnnotations.initMocks;
import com.google.common.base.Optional;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
+import io.fd.hc2vpp.common.test.util.FutureProducer;
+import io.fd.hc2vpp.common.test.util.NamingContextHelper;
+import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
+import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
import io.fd.honeycomb.translate.read.ReadContext;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.read.registry.ReaderRegistry;
-import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
-import io.fd.hc2vpp.common.test.util.NamingContextHelper;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.common.test.util.FutureProducer;
-import io.fd.vpp.jvpp.dto.ControlPing;
-import io.fd.vpp.jvpp.dto.ControlPingReply;
+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.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;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;
-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.rev161214.VppState;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.L2FibTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomains;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.BridgeDomainsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomain;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.bridge.domains.BridgeDomainKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsState;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.BridgeDomainsStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomain;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.bridge.domains.state.BridgeDomainKey;
import org.opendaylight.yangtools.yang.binding.DataObject;
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.L2FibTableDump;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntry;
-import io.fd.vpp.jvpp.core.dto.L2FibTableEntryReplyDump;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-public class VppStateTest implements FutureProducer, NamingContextHelper {
+public class L2StateTest implements FutureProducer, NamingContextHelper {
private static final String BD_CTX_NAME = "bd-test-instance";
@Mock
@@ -88,7 +73,7 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
private ReaderRegistry readerRegistry;
- private static InstanceIdentifier<BridgeDomains> bridgeDomainsId;
+ private static InstanceIdentifier<BridgeDomainsState> bridgeDomainsId;
/**
* Create root VppState reader with all its children wired.
@@ -97,14 +82,9 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
@Nonnull final NamingContext bdContext) {
final CompositeReaderRegistryBuilder registry = new CompositeReaderRegistryBuilder();
- // VppState(Structural)
- final InstanceIdentifier<VppState> vppStateId = InstanceIdentifier.create(VppState.class);
- registry.addStructuralReader(vppStateId, VppStateBuilder.class);
- // Version
- registry.add(new GenericReader<>(vppStateId.child(Version.class), new VersionCustomizer(jVpp)));
// BridgeDomains(Structural)
- bridgeDomainsId = vppStateId.child(BridgeDomains.class);
- registry.addStructuralReader(bridgeDomainsId, BridgeDomainsBuilder.class);
+ bridgeDomainsId = InstanceIdentifier.create(BridgeDomainsState.class);
+ registry.addStructuralReader(bridgeDomainsId, BridgeDomainsStateBuilder.class);
// BridgeDomain
registry.add(getBridgeDomainReader(jVpp, bdContext));
return registry.build();
@@ -127,27 +107,6 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
readerRegistry = getVppStateReader(api, bdContext);
}
- private static Version getVersion() {
- return new VersionBuilder()
- .setName("test")
- .setBuildDirectory("1")
- .setBranch("2")
- .setBuildDate("3")
- .setPid(0L)
- .build();
- }
-
- private void whenShowVersionThenReturn(final Version version) {
- final ShowVersionReply reply = new ShowVersionReply();
- reply.buildDate = version.getBuildDate().getBytes();
- reply.program = version.getName().getBytes();
- reply.version = version.getBranch().getBytes();
- reply.buildDirectory = version.getBuildDirectory().getBytes();
- when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply));
- // Version Customizer uses ControlPing to obtain PID
- when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply()));
- }
-
private void whenL2FibTableDumpThenReturn(final List<L2FibTableEntry> entryList) {
final L2FibTableEntryReplyDump reply = new L2FibTableEntryReplyDump();
reply.l2FibTableEntry = entryList;
@@ -171,9 +130,6 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
@Test
public void testReadAll() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
-
final BridgeDomainDetails bridgeDomainDetails = new BridgeDomainDetails();
final BridgeDomainDetails bridgeDomainDetails2 = new BridgeDomainDetails();
bridgeDomainDetails2.bdId = 1;
@@ -187,74 +143,23 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
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())));
- assertEquals(version, dataObject.getVersion());
- assertEquals(2, dataObject.getBridgeDomains().getBridgeDomain().size());
- }
-
- @Test
- public void testReadSpecific() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
- whenBridgeDomainDumpThenReturn(Collections.emptyList());
-
- final Optional<? extends DataObject> read = readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx);
- assertTrue(read.isPresent());
- assertEquals(version, ((VppState) read.get()).getVersion());
+ final BridgeDomainsState dataObject =
+ (BridgeDomainsState) Iterables.getOnlyElement(dataObjects.get(Iterables.getOnlyElement(dataObjects.keySet())));
+ assertEquals(2, dataObject.getBridgeDomain().size());
}
@Test
public void testReadBridgeDomains() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
final BridgeDomainDetails details = new BridgeDomainDetails();
whenBridgeDomainDumpThenReturn(Collections.singletonList(details));
mockBdMapping(details, "bdn1");
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
-
- Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class), ctx);
- assertTrue(read.isPresent());
- assertEquals(readRoot.getBridgeDomains(), read.get());
- }
-
- /**
- * L2fib does not have a dedicated reader, relying on auto filtering
- */
- @Test
- @Ignore("L2 FIB was moved to dedicated customizer. TODO: add infra test that covers such case")
- @SuppressWarnings("unchecked")
- public void testReadL2Fib() throws Exception {
- final BridgeDomainDetails bd = new BridgeDomainDetails();
- bd.bdId = 0;
- final String bdName = "bdn1";
- mockBdMapping(bd, bdName);
- defineMapping(mappingContext, "eth1", 0, "ifc-test-instance");
+ BridgeDomainsState readRoot = (BridgeDomainsState) readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx).get();
- whenBridgeDomainDumpThenReturn(Collections.singletonList(bd));
- final L2FibTableEntry l2FibEntry = new L2FibTableEntry();
- l2FibEntry.bdId = 0;
- l2FibEntry.mac = 0x0605040302010000L;
- 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")));
Optional<? extends DataObject> read =
- readerRegistry.read(idExisting, ctx);
+ readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), 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")));
- read = readerRegistry.read(idNonExisting, ctx);
- assertFalse(read.isPresent());
+ assertEquals(readRoot.getBridgeDomain(), BridgeDomainsState.class.cast(read.get()).getBridgeDomain());
}
private void mockBdMapping(final BridgeDomainDetails bd, final String bdName) {
@@ -263,22 +168,20 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
@Test
public void testReadBridgeDomainAll() throws Exception {
- final Version version = getVersion();
- whenShowVersionThenReturn(version);
final BridgeDomainDetails details = new BridgeDomainDetails();
whenBridgeDomainDumpThenReturn(Collections.singletonList(details));
mockBdMapping(details, "bd2");
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
+ BridgeDomainsState readRoot = (BridgeDomainsState) readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx).get();
final GenericListReader<BridgeDomain, BridgeDomainKey, BridgeDomainBuilder> bridgeDomainReader =
getBridgeDomainReader(api, bdContext);
final List<BridgeDomain> read =
- bridgeDomainReader.readList(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
+ bridgeDomainReader.readList(InstanceIdentifier.create(BridgeDomainsState.class).child(
BridgeDomain.class), ctx);
- assertEquals(readRoot.getBridgeDomains().getBridgeDomain(), read);
+ assertEquals(readRoot.getBridgeDomain(), read);
}
@Test
@@ -289,16 +192,15 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
mockBdMapping(bd, bdName);
whenBridgeDomainDumpThenReturn(Collections.singletonList(bd));
- whenShowVersionThenReturn(getVersion());
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
+ BridgeDomainsState readRoot = (BridgeDomainsState) readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class), ctx).get();
final Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
+ readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class).child(
BridgeDomain.class, new BridgeDomainKey(bdName)), ctx);
assertTrue(read.isPresent());
- assertEquals(readRoot.getBridgeDomains().getBridgeDomain().stream().filter(
+ assertEquals(readRoot.getBridgeDomain().stream().filter(
input -> input.getKey().getName().equals(bdName)).findFirst().get(),
read.get());
}
@@ -308,19 +210,7 @@ public class VppStateTest implements FutureProducer, NamingContextHelper {
final String nonExistingBdName = "NOT EXISTING";
noMappingDefined(mappingContext, nonExistingBdName, BD_CTX_NAME);
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
+ readerRegistry.read(InstanceIdentifier.create(BridgeDomainsState.class).child(
BridgeDomain.class, new BridgeDomainKey(nonExistingBdName)), ctx);
}
-
- @Test
- public void testReadVersion() throws Exception {
- whenShowVersionThenReturn(getVersion());
- whenBridgeDomainDumpThenReturn(Collections.emptyList());
- VppState readRoot = (VppState) readerRegistry.read(InstanceIdentifier.create(VppState.class), ctx).get();
-
- Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(Version.class), ctx);
- assertTrue(read.isPresent());
- assertEquals(readRoot.getVersion(), read.get());
- }
} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java
deleted file mode 100644
index baedba6fc..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/rpc/CliInbandServiceTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.rpc;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
-import io.fd.hc2vpp.common.test.util.FutureProducer;
-import io.fd.vpp.jvpp.core.dto.CliInbandReply;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.CliInbandOutput;
-
-public class CliInbandServiceTest implements FutureProducer {
-
- @Mock
- private FutureJVppCore api;
-
- @Test
- public void testInvoke() throws Exception {
- initMocks(this);
- final String replyString = "CLI output";
-
- final CliInbandService service = new CliInbandService(api);
- final CliInbandReply reply = new CliInbandReply();
- reply.reply = replyString.getBytes();
- when(api.cliInband(any())).thenReturn(future(reply));
-
- final CliInbandInput request = new CliInbandInputBuilder().setCmd("cmd").build();
- final CliInbandOutput response = service.invoke(request).toCompletableFuture().get();
- assertEquals(replyString, response.getReply());
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java
deleted file mode 100644
index 2f12cbde1..000000000
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vppstate/VersionCustomizerTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.v3po.vppstate;
-
-import static org.mockito.Matchers.any;
-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.test.read.ReaderCustomizerTest;
-import io.fd.vpp.jvpp.core.dto.ShowVersion;
-import io.fd.vpp.jvpp.core.dto.ShowVersionReply;
-import io.fd.vpp.jvpp.dto.ControlPing;
-import io.fd.vpp.jvpp.dto.ControlPingReply;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.VppStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.Version;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.state.VersionBuilder;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class VersionCustomizerTest extends ReaderCustomizerTest<Version, VersionBuilder> {
-
- public VersionCustomizerTest() {
- super(Version.class, VppStateBuilder.class);
- }
-
- @Override
- protected ReaderCustomizer<Version, VersionBuilder> initCustomizer() {
- return new VersionCustomizer(api);
- }
-
- @Test
- public void testReadCurrentAttributes() throws Exception {
- final ShowVersionReply reply = new ShowVersionReply();
- reply.version = new byte[] {};
- reply.program = new byte[] {};
- reply.buildDate = new byte[] {};
- reply.buildDirectory = new byte[] {};
-
- when(api.showVersion(any(ShowVersion.class))).thenReturn(future(reply));
- when(api.send(any(ControlPing.class))).thenReturn(future(new ControlPingReply()));
- getCustomizer().readCurrentAttributes(InstanceIdentifier.create(Version.class), new VersionBuilder(), ctx);
- verify(api).showVersion(any(ShowVersion.class));
- verify(api).send(any(ControlPing.class));
- }
-} \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/test/resources/v3po.json b/v3po/v3po2vpp/src/test/resources/v3po.json
deleted file mode 100644
index 9ea66efe8..000000000
--- a/v3po/v3po2vpp/src/test/resources/v3po.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "keepalive-delay": "30"
-}