summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--v3po/api/src/main/yang/v3po.yang107
-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
6 files changed, 94 insertions, 64 deletions
diff --git a/v3po/api/src/main/yang/v3po.yang b/v3po/api/src/main/yang/v3po.yang
index 83db8e232..9d0c286fc 100644
--- a/v3po/api/src/main/yang/v3po.yang
+++ b/v3po/api/src/main/yang/v3po.yang
@@ -54,6 +54,29 @@ module v3po {
base if:interface-type;
}
+ identity l2-fib-action {
+ description "Base identity for l2-fib actions";
+ }
+
+ identity l2-fib-forward {
+ base l2-fib-action;
+ description
+ "Forwards packet with configured mac address";
+ }
+
+ identity l2-fib-filter {
+ base l2-fib-action;
+ description
+ "Drops packet with configured mac address";
+ }
+
+ typedef l2-fib-action {
+ type identityref {
+ base "l2-fib-action";
+ }
+ description "Identifies a specific L2 FIB action";
+ }
+
typedef vxlan-vni {
// FIXME: should be in a vxlan-specific model
description "VNI used in a VXLAN tunnel";
@@ -126,6 +149,40 @@ module v3po {
}
}
+ grouping l2-fib-attributes {
+ container l2-fib-table {
+ list l2-fib-entry {
+ key "phys-address";
+
+ leaf phys-address {
+ type yang:phys-address;
+ }
+
+ leaf outgoing-interface {
+ type string;
+ mandatory true;
+ description
+ "One of interfaces assigned to the FIB table's bridge-domain";
+ }
+ leaf static-config {
+ type boolean;
+ default false;
+ description
+ "Static entries cannot be overridden by mac learning";
+ }
+ leaf action {
+ type l2-fib-action;
+ mandatory true;
+ }
+ leaf bridged-virtual-interface {
+ when "../v3po:action = 'forward'";
+ type boolean;
+ config false; // FIXME setting bvi is currently not supported by VPP's binary api
+ }
+ }
+ }
+ }
+
grouping tap-interface-base-attributes {
leaf tap-name {
type string;
@@ -265,6 +322,7 @@ module v3po {
case bridge-based {
leaf bridge-domain {
type bridge-domain-ref;
+ mandatory true;
description
"Interfaces in a bridge-domain forward packets to other
interfaces in the same bridge-domain based on
@@ -273,9 +331,8 @@ module v3po {
leaf split-horizon-group {
when "../bridge-domain";
type uint8 {
- range "0..255";
+ range "1..255"; // TODO update postman collection
}
- default 0;
description
"Interface's split-horizon group. Interfaces in the same
bridge-domain and split-horizon group can not forward
@@ -356,24 +413,10 @@ module v3po {
}
uses bridge-domain-attributes;
+ uses l2-fib-attributes;
- list l2-fib {
- key "phys-address";
-
- leaf phys-address {
- type yang:phys-address;
- }
- leaf action {
- type enumeration {
- enum "forward";
- enum "filter";
- }
- mandatory true;
- }
- leaf outgoing-interface {
- type if:interface-ref;
- }
- }
+ description
+ "bridge-domain configuration";
}
}
}
@@ -449,32 +492,8 @@ module v3po {
}
uses bridge-domain-attributes;
+ uses l2-fib-attributes;
- list l2-fib {
- key "phys-address";
-
- leaf phys-address {
- type yang:phys-address;
- }
- leaf static-config {
- type boolean;
- }
- leaf outgoing-interface {
- when "../v3po:action = 'forward'";
- type if:interface-state-ref;
- }
- leaf action {
- type enumeration {
- enum "forward";
- enum "filter";
- }
- mandatory true;
- }
- leaf bridged-virtual-interface {
- when "../v3po:action = 'forward'";
- type boolean;
- }
- }
description
"bridge-domain operational data";
}
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());
}