summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-07-02 13:09:26 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-07-02 13:12:12 +0200
commit99db0d333b6e7b101fb55c759f5a4ac028ee0d0b (patch)
tree95de1fa14a3ede56653ab429473d986c86236f00
parentc428881044008b3865c8e934dd53240b43c084f1 (diff)
HC2VPP-346: use fib-table-list-ref for VXLAN configuration
User is required to explicitly configure FIB tables using vpp-fib-management module. The change does not require modification of RESTCONF and NETCONF requests. Change-Id: Ie3cbff61281ba1a7a9e14c0a26cbd9ce6e44587f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rw-r--r--v3po/api/src/main/yang/v3po@2017-06-07.yang9
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java8
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java4
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java5
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java2
5 files changed, 20 insertions, 8 deletions
diff --git a/v3po/api/src/main/yang/v3po@2017-06-07.yang b/v3po/api/src/main/yang/v3po@2017-06-07.yang
index 3d669e0a0..09ac9848d 100644
--- a/v3po/api/src/main/yang/v3po@2017-06-07.yang
+++ b/v3po/api/src/main/yang/v3po@2017-06-07.yang
@@ -18,6 +18,10 @@ module v3po {
import yang-ext {
prefix "ext";
}
+ import vpp-fib-table-management {
+ prefix fib-management;
+ revision-date 2018-05-21;
+ }
organization
"FD.io - The Fast Data Project";
@@ -132,7 +136,7 @@ module v3po {
typedef vxlan-vni {
// FIXME: should be in a vxlan-specific model
- description "VNI used in a VXLAN tunnel";
+ description "VXLAN Network Identifier";
type uint32 {
range "0..16777215";
}
@@ -451,7 +455,8 @@ module v3po {
type vxlan-vni;
}
leaf encap-vrf-id {
- type uint32;
+ /*mandatory true;*/
+ type fib-management:fib-table-list-ref;
}
leaf decap-next {
type vxlan-decap-node;
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java
index f21b0198f..97d300385 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizer.java
@@ -87,7 +87,9 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
final InetAddress srcAddress = InetAddresses.forString(getAddressString(vxlan.getSrc()));
final InetAddress dstAddress = InetAddresses.forString(getAddressString(vxlan.getDst()));
- int encapVrfId = vxlan.getEncapVrfId().intValue();
+ checkArgument(vxlan.getEncapVrfId() != null && vxlan.getEncapVrfId().getValue() != null,
+ "encap-vrf-id is mandatory but was not given");
+ int encapVrfId = vxlan.getEncapVrfId().getValue().intValue();
int vni = vxlan.getVni().getValue().intValue();
int decapNext = -1;
@@ -157,7 +159,9 @@ public class VxlanCustomizer extends AbstractInterfaceTypeCustomizer<Vxlan> impl
final InetAddress srcAddress = InetAddresses.forString(getAddressString(vxlan.getSrc()));
final InetAddress dstAddress = InetAddresses.forString(getAddressString(vxlan.getDst()));
- int encapVrfId = vxlan.getEncapVrfId().intValue();
+ checkArgument(vxlan.getEncapVrfId() != null && vxlan.getEncapVrfId().getValue() != null,
+ "encap-vrf-id is mandatory but was not given");
+ int encapVrfId = vxlan.getEncapVrfId().getValue().intValue();
int vni = vxlan.getVni().getValue().intValue();
int decapNext = -1;
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java
index dd9f84090..dac59d6f4 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java
@@ -18,6 +18,7 @@ package io.fd.hc2vpp.v3po.interfacesstate;
import static com.google.common.base.Preconditions.checkState;
+import com.google.common.primitives.UnsignedInts;
import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
import io.fd.hc2vpp.common.translate.util.Ipv4Translator;
import io.fd.hc2vpp.common.translate.util.Ipv6Translator;
@@ -46,6 +47,7 @@ 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.rev170607.VxlanVni;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces.state._interface.Vxlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces.state._interface.VxlanBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.VniReference;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -123,7 +125,7 @@ public class VxlanCustomizer extends FutureJVppCustomizer
builder.setDst(new IpAddress(arrayToIpv4AddressNoZone(swInterfaceVxlanDetails.dstAddress)));
builder.setSrc(new IpAddress(arrayToIpv4AddressNoZone(swInterfaceVxlanDetails.srcAddress)));
}
- builder.setEncapVrfId((long) swInterfaceVxlanDetails.encapVrfId);
+ builder.setEncapVrfId(new VniReference(UnsignedInts.toLong(swInterfaceVxlanDetails.encapVrfId)));
builder.setVni(new VxlanVni((long) swInterfaceVxlanDetails.vni));
switch (swInterfaceVxlanDetails.decapNextIndex) {
case 1:
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java
index af4f6bd40..7203c1b54 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfaces/VxlanCustomizerTest.java
@@ -49,6 +49,7 @@ 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.rev170607.VxlanVni;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces._interface.Vxlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607.interfaces._interface.VxlanBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.fib.table.management.rev180521.VniReference;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class VxlanCustomizerTest extends WriterCustomizerTest {
@@ -67,7 +68,7 @@ public class VxlanCustomizerTest extends WriterCustomizerTest {
final VxlanBuilder builder = new VxlanBuilder();
builder.setSrc(new IpAddress(new Ipv4Address("192.168.20.10")));
builder.setDst(new IpAddress(new Ipv4Address("192.168.20.11")));
- builder.setEncapVrfId(Long.valueOf(123));
+ builder.setEncapVrfId(new VniReference(123L));
builder.setVni(new VxlanVni(Long.valueOf(vni)));
builder.setDecapNext(L2Input.class);
return builder.build();
@@ -108,7 +109,7 @@ public class VxlanCustomizerTest extends WriterCustomizerTest {
actual.srcAddress);
assertArrayEquals(InetAddresses.forString(vxlan.getDst().getIpv4Address().getValue()).getAddress(),
actual.dstAddress);
- assertEquals(vxlan.getEncapVrfId().intValue(), actual.encapVrfId);
+ assertEquals(vxlan.getEncapVrfId().getValue().intValue(), actual.encapVrfId);
assertEquals(vxlan.getVni().getValue().intValue(), actual.vni);
return actual;
}
diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java
index bfeb7eaa9..f2384979e 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java
@@ -96,7 +96,7 @@ public class VxlanCustomizerTest extends ReaderCustomizerTest<Vxlan, VxlanBuilde
getCustomizer().readCurrentAttributes(IID, builder, ctx);
assertEquals(9, builder.getVni().getValue().intValue());
- assertEquals(55, builder.getEncapVrfId().intValue());
+ assertEquals(55, builder.getEncapVrfId().getValue().intValue());
assertEquals(L2Input.class, builder.getDecapNext());
assertNull(builder.getSrc().getIpv6Address());