summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp
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 /v3po/v3po2vpp
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>
Diffstat (limited to 'v3po/v3po2vpp')
-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
4 files changed, 13 insertions, 6 deletions
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());