summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2017-01-04 10:18:37 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-01-04 14:41:34 +0000
commit7c0f620652cd014b791a3e243f9ca7b08e697d3a (patch)
tree273d0c3ad98244f32d27aa8882e39c7038836584
parentaf188c5c99d4b4fcb669a6e666b2b421ad69e8d9 (diff)
HONEYCOMB-187 - Ipv6 support for arp termination
Change-Id: I27e9c3d30960d6d9d845c6148edc0429b66be66d Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java11
-rw-r--r--v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java21
2 files changed, 25 insertions, 7 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java
index e7c1dea3d..2b9f59209 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizer.java
@@ -17,12 +17,12 @@
package io.fd.hc2vpp.v3po.vpp;
import com.google.common.base.Preconditions;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.hc2vpp.common.translate.util.FutureJVppCustomizer;
import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.hc2vpp.common.translate.util.NamingContext;
+import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.BdIpMacAddDel;
@@ -31,7 +31,6 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.concurrent.CompletionStage;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
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.ArpTerminationTableEntryKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev161214.vpp.bridge.domains.BridgeDomain;
@@ -107,12 +106,10 @@ public class ArpTerminationTableEntryCustomizer extends FutureJVppCustomizer
request.macAddress = parseMac(entry.getPhysAddress().getValue());
final IpAddress ipAddress = entry.getIpAddress();
- if (ipAddress.getIpv6Address() != null) {
- // FIXME: HONEYCOMB-187 vpp does not support ipv6 in arp-termination table (based on analysis of l2_bd.c)
- throw new UnsupportedOperationException("IPv6 address for ARP termination table is not supported yet");
- }
- request.ipAddress = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(ipAddress.getIpv4Address()));
+ request.ipAddress = ipAddressToArray(ipAddress);
+ request.isIpv6 = booleanToByte(isIpv6(ipAddress));
+
return request;
}
}
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/vpp/ArpTerminationTableEntryCustomizerTest.java
index 4d5675630..c1dd5b170 100644
--- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
+++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/vpp/ArpTerminationTableEntryCustomizerTest.java
@@ -36,6 +36,7 @@ import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
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.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;
@@ -56,10 +57,13 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
private static final int IFACE_ID = 123;
private ArpTerminationTableEntryCustomizer customizer;
private byte[] ipAddressRaw;
+ private byte[] ip6AddressRaw;
private byte[] physAddressRaw;
private PhysAddress physAddress;
private IpAddress ipAddress;
+ private IpAddress ip6Address;
private ArpTerminationTableEntry entry;
+ private ArpTerminationTableEntry ip6entry;
private InstanceIdentifier<ArpTerminationTableEntry> id;
private static InstanceIdentifier<ArpTerminationTableEntry> getArpEntryId(final IpAddress ipAddress,
@@ -74,11 +78,14 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
customizer = new ArpTerminationTableEntryCustomizer(api, new NamingContext("generatedBdName", BD_CTX_NAME));
ipAddressRaw = new byte[]{1, 2, 3, 4};
+ ip6AddressRaw = new byte[]{32, 1, 13, -72, 10, 11, 18, -16, 0, 0, 0, 0, 0, 0, 0, 1};
physAddressRaw = new byte[]{1, 2, 3, 4, 5, 6};
physAddress = new PhysAddress("01:02:03:04:05:06");
ipAddress = new IpAddress(Ipv4AddressNoZone.getDefaultInstance("1.2.3.4"));
+ ip6Address = new IpAddress(Ipv6AddressNoZone.getDefaultInstance("2001:0db8:0a0b:12f0:0000:0000:0000:0001"));
entry = generateArpEntry(ipAddress, physAddress);
+ ip6entry = generateArpEntry(ip6Address, physAddress);
id = getArpEntryId(ipAddress, physAddress);
defineMapping(mappingContext, BD_NAME, BD_ID, BD_CTX_NAME);
@@ -130,6 +137,13 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
}
@Test
+ public void testCreateIpv6() throws Exception {
+ whenBdIpMacAddDelThenSuccess();
+ customizer.writeCurrentAttributes(id, ip6entry, writeContext);
+ verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ip6AddressRaw, physAddressRaw, (byte) 1));
+ }
+
+ @Test
public void testCreateFailed() throws Exception {
whenBdIpMacAddDelThenFailure();
try {
@@ -157,6 +171,13 @@ public class ArpTerminationTableEntryCustomizerTest extends WriterCustomizerTest
}
@Test
+ public void testDeleteIpv6() throws Exception {
+ whenBdIpMacAddDelThenSuccess();
+ customizer.deleteCurrentAttributes(id, ip6entry, writeContext);
+ verifyBdIpMacAddDelWasInvoked(generateBdIpMacAddDelRequest(ip6AddressRaw, physAddressRaw, (byte) 0));
+ }
+
+ @Test
public void testDeleteFailed() throws Exception {
whenBdIpMacAddDelThenFailure();
try {