summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java5
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java2
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java23
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/L2CustomizerTest.java3
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/VppStateTest.java18
5 files changed, 31 insertions, 20 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java
index 917d2e7ee..b3b05500a 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfaces/InterconnectionWriteUtils.java
@@ -98,7 +98,10 @@ final class InterconnectionWriteUtils {
byte bvi = bb.isBridgedVirtualInterface()
? (byte) 1
: (byte) 0;
- byte shg = bb.getSplitHorizonGroup().byteValue();
+ byte shg = 0;
+ if (bb.getSplitHorizonGroup() != null) {
+ shg = bb.getSplitHorizonGroup().byteValue();
+ }
final CompletionStage<SwInterfaceSetL2BridgeReply> swInterfaceSetL2BridgeReplyCompletionStage = futureJvpp
.swInterfaceSetL2Bridge(getL2BridgeRequest(swIfIndex, bdId, shg, bvi, (byte) 1 /* enable */));
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java
index f5c0e5972..b60121a45 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/interfacesstate/InterconnectionReadUtils.java
@@ -83,6 +83,8 @@ final class InterconnectionReadUtils {
checkState(bridgeDomainForInterface.isPresent());
if (bridgeDomainForInterface.get().bviSwIfIndex == ifaceId) {
bbBuilder.setBridgedVirtualInterface(true);
+ } else {
+ bbBuilder.setBridgedVirtualInterface(false);
}
if (bdSwIfDetails.shg != 0) {
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
index 86caf6e5f..a6a31e2ae 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/BridgeDomainCustomizer.java
@@ -32,13 +32,16 @@ import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
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.rev150105.L2FibFilter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.L2FibForward;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.L2FibTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomainsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain;
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;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.bridge.domain.L2Fib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.bridge.domain.L2FibBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.bridge.domain.L2FibKey;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -105,7 +108,7 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer
try {
final L2FibTableEntryReplyDump dump =
getFutureJVpp().l2FibTableDump(l2FibRequest).toCompletableFuture().get();
- final List<L2Fib> l2Fibs;
+ final List<L2FibEntry> l2Fibs;
if(null == dump || null == dump.l2FibTableEntry) {
l2Fibs = Collections.emptyList();
@@ -115,19 +118,19 @@ public final class BridgeDomainCustomizer extends FutureJVppCustomizer
// entry.mac is a long value in the format 66:55:44:33:22:11:XX:XX
// where mac address is 11:22:33:44:55:66
final PhysAddress address = new PhysAddress(getMacAddress(Longs.toByteArray(entry.mac)));
- l2Fibs.add(new L2FibBuilder()
- .setAction((byteToBoolean(entry.filterMac)
- ? L2Fib.Action.Filter
- : L2Fib.Action.Forward))
+ l2Fibs.add(new L2FibEntryBuilder()
+ .setAction(byteToBoolean(entry.filterMac)
+ ? L2FibFilter.class
+ : L2FibForward.class)
.setBridgedVirtualInterface(byteToBoolean(entry.bviMac))
.setOutgoingInterface(interfaceContext.getName(entry.swIfIndex, context.getMappingContext()))
.setStaticConfig(byteToBoolean(entry.staticMac))
.setPhysAddress(address)
- .setKey(new L2FibKey(address))
+ .setKey(new L2FibEntryKey(address))
.build());
}
}
- builder.setL2Fib(l2Fibs);
+ builder.setL2FibTable(new L2FibTableBuilder().setL2FibEntry(l2Fibs).build());
} catch (Exception e) {
LOG.warn("Failed to acquire l2FibTableDump for domain id={}", bdId, e);
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 6ddeaebda..7baa028d8 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
@@ -117,9 +117,10 @@ public class L2CustomizerTest extends ChildReaderCustomizerTest<L2, L2Builder> {
final BridgeBasedBuilder bbBuilder = new BridgeBasedBuilder();
bbBuilder.setBridgeDomain(bdName);
bbBuilder.setSplitHorizonGroup((short) 1);
- // Empty type
if(bvi != null) {
bbBuilder.setBridgedVirtualInterface(bvi);
+ } else {
+ bbBuilder.setBridgedVirtualInterface(false); // false is default
}
return bbBuilder.build();
}
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 6b91a2416..4ca89da8f 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
@@ -55,14 +55,15 @@ import org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.naming.cont
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.rev150105.VppState;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppStateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.L2FibTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.l2.fib.attributes.l2.fib.table.L2FibEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.BridgeDomains;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.Version;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.VersionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.BridgeDomain;
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;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.bridge.domain.L2Fib;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.vpp.state.bridge.domains.bridge.domain.L2FibKey;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.openvpp.jvpp.VppInvocationException;
@@ -207,6 +208,7 @@ public class VppStateTest {
* L2fib does not have a dedicated reader, relying on auto filtering
*/
@Test
+ @SuppressWarnings("unchecked")
public void testReadL2Fib() throws Exception {
final BridgeDomainDetails bd = new BridgeDomainDetails();
bd.bdId = 0;
@@ -221,16 +223,16 @@ 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")));
Optional<? extends DataObject> read =
- readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey("bdn1"))
- .child(L2Fib.class, new L2FibKey(new PhysAddress("01:02:03:04:05:06"))), ctx);
+ readerRegistry.read(idExisting, ctx);
assertTrue(read.isPresent());
// non existing l2fib
- read = readerRegistry.read(InstanceIdentifier.create(VppState.class).child(BridgeDomains.class).child(
- BridgeDomain.class, new BridgeDomainKey("bdn1"))
- .child(L2Fib.class, new L2FibKey(new PhysAddress("FF:FF:FF:04:05:06"))), ctx);
+ 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());
}