From 3751ef96ae1427cc8d5ecb9cbba705e837bb63ca Mon Sep 17 00:00:00 2001 From: Michal Cmarada Date: Wed, 6 Feb 2019 09:41:39 +0100 Subject: fix after changes in VPP API - fixes for mac adress - fixes for ipaddress - fixes refactoring in ipsec Change-Id: Idc3e3557b72a5f1ac5b32b9738d90ca23ed6ed9e Signed-off-by: Michal Cmarada --- .../fd/hc2vpp/l3/read/InterfaceChildNodeTest.java | 27 +++++++++++++++++++--- .../l3/read/ipv6/nd/NdProxyCustomizerTest.java | 10 +++++--- .../hc2vpp/l3/write/ProxyRangeCustomizerTest.java | 9 +++++--- .../l3/write/ipv4/Ipv4NeighbourCustomizerTest.java | 23 ++++++++++++++---- .../l3/write/ipv6/Ipv6NeighbourCustomizerTest.java | 23 ++++++++++++++---- .../l3/write/ipv6/nd/NdProxyCustomizerTest.java | 7 ++++-- 6 files changed, 78 insertions(+), 21 deletions(-) (limited to 'l3/impl/src/test') diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/InterfaceChildNodeTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/InterfaceChildNodeTest.java index 48a1b7327..9534ac966 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/InterfaceChildNodeTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/InterfaceChildNodeTest.java @@ -31,6 +31,13 @@ import io.fd.vpp.jvpp.core.dto.IpNeighborDetails; import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump; import io.fd.vpp.jvpp.core.dto.IpNeighborDump; import io.fd.vpp.jvpp.core.future.FutureJVppCore; +import io.fd.vpp.jvpp.core.types.Address; +import io.fd.vpp.jvpp.core.types.AddressFamily; +import io.fd.vpp.jvpp.core.types.AddressUnion; +import io.fd.vpp.jvpp.core.types.Ip4Address; +import io.fd.vpp.jvpp.core.types.Ip6Address; +import io.fd.vpp.jvpp.core.types.IpNeighbor; +import io.fd.vpp.jvpp.core.types.MacAddress; import java.util.Arrays; import java.util.List; import javax.annotation.Nonnull; @@ -185,9 +192,23 @@ public interface InterfaceChildNodeTest extends NamingContextHelper, FutureProdu static IpNeighborDetails neighborDump(byte[] address, int isIpv6, byte[] mac) { IpNeighborDetails detail = new IpNeighborDetails(); - detail.ipAddress = address; - detail.isIpv6 = (byte) isIpv6; - detail.macAddress = mac; + detail.neighbor = new IpNeighbor(); + detail.neighbor.ipAddress = new Address(); + AddressUnion addressUnion; + if (isIpv6 == 1) { + Ip6Address ip6Address = new Ip6Address(); + ip6Address.ip6Address = address; + addressUnion =new AddressUnion(ip6Address); + detail.neighbor.ipAddress.af = AddressFamily.ADDRESS_IP6; + } else { + Ip4Address ip4Address = new Ip4Address(); + ip4Address.ip4Address = address; + addressUnion =new AddressUnion(ip4Address); + detail.neighbor.ipAddress.af = AddressFamily.ADDRESS_IP4; + } + detail.neighbor.ipAddress.un = addressUnion; + detail.neighbor.macAddress = new MacAddress(); + detail.neighbor.macAddress.macaddress = mac; return detail; } diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizerTest.java index bc4cab554..a29250783 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizerTest.java @@ -29,6 +29,7 @@ import io.fd.honeycomb.translate.read.ReadFailedException; import io.fd.honeycomb.translate.spi.read.ReaderCustomizer; import io.fd.vpp.jvpp.core.dto.Ip6NdProxyDetails; import io.fd.vpp.jvpp.core.dto.Ip6NdProxyDetailsReplyDump; +import io.fd.vpp.jvpp.core.types.Ip6Address; import java.util.List; import org.junit.Test; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.nd.proxy.rev170315.NdProxyIp6StateAugmentation; @@ -63,13 +64,16 @@ public class NdProxyCustomizerTest extends InitializingListReaderCustomizerTest< final Ip6NdProxyDetailsReplyDump reply = new Ip6NdProxyDetailsReplyDump(); final Ip6NdProxyDetails proxy1 = new Ip6NdProxyDetails(); proxy1.swIfIndex = IF1_INDEX; - proxy1.address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}; + proxy1.ip = new Ip6Address(); + proxy1.ip.ip6Address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}; final Ip6NdProxyDetails proxy2 = new Ip6NdProxyDetails(); proxy2.swIfIndex = IF1_INDEX; - proxy2.address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}; + proxy2.ip = new Ip6Address(); + proxy2.ip.ip6Address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02}; final Ip6NdProxyDetails proxy3 = new Ip6NdProxyDetails(); proxy3.swIfIndex = IF2_INDEX; - proxy3.address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03}; + proxy3.ip = new Ip6Address(); + proxy3.ip.ip6Address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03}; reply.ip6NdProxyDetails.add(proxy1); reply.ip6NdProxyDetails.add(proxy2); reply.ip6NdProxyDetails.add(proxy3); diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java index 5a0de6667..eda79fc83 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java @@ -26,6 +26,7 @@ import io.fd.hc2vpp.l3.write.ipv4.ProxyRangeCustomizer; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.core.dto.ProxyArpAddDel; import io.fd.vpp.jvpp.core.dto.ProxyArpAddDelReply; +import io.fd.vpp.jvpp.core.types.Ip4Address; import io.fd.vpp.jvpp.core.types.ProxyArp; import org.junit.Test; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.proxy.arp.rev180703.ProxyRanges; @@ -90,9 +91,11 @@ public class ProxyRangeCustomizerTest extends WriterCustomizerTest implements By final ProxyArpAddDel request = new ProxyArpAddDel(); request.isAdd = booleanToByte(isAdd); request.proxy = new ProxyArp(); - request.proxy.vrfId = 123; - request.proxy.lowAddress = new byte[] {10, 1, 1, 1}; - request.proxy.hiAddress = new byte[] {10, 1, 1, 2}; + request.proxy.tableId = 123; + request.proxy.low = new Ip4Address(); + request.proxy.low.ip4Address = new byte[] {10, 1, 1, 1}; + request.proxy.hi = new Ip4Address(); + request.proxy.hi.ip4Address = new byte[] {10, 1, 1, 2}; return request; } } diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java index bab261a31..7d2b6472c 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java @@ -30,6 +30,13 @@ import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.VppBaseCallException; import io.fd.vpp.jvpp.core.dto.IpNeighborAddDel; import io.fd.vpp.jvpp.core.dto.IpNeighborAddDelReply; +import io.fd.vpp.jvpp.core.types.Address; +import io.fd.vpp.jvpp.core.types.AddressFamily; +import io.fd.vpp.jvpp.core.types.AddressUnion; +import io.fd.vpp.jvpp.core.types.Ip4Address; +import io.fd.vpp.jvpp.core.types.IpNeighbor; +import io.fd.vpp.jvpp.core.types.IpNeighborFlags; +import io.fd.vpp.jvpp.core.types.MacAddress; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone; @@ -120,12 +127,18 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements } private IpNeighborAddDel getExpectedRequest(final boolean isAdd) { final IpNeighborAddDel request = new IpNeighborAddDel(); - request.isIpv6 = 0; + request.neighbor = new IpNeighbor(); + request.neighbor.macAddress = new MacAddress(); + request.neighbor.macAddress.macaddress = + new byte[]{(byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xee, 0x11, 0x22}; + request.neighbor.ipAddress = new Address(); + request.neighbor.ipAddress.af = AddressFamily.ADDRESS_IP4; + Ip4Address ip4Address = new Ip4Address(); + ip4Address.ip4Address = new byte[]{(byte) 192, (byte) 168, 2, 1}; + request.neighbor.ipAddress.un = new AddressUnion(ip4Address); request.isAdd = booleanToByte(isAdd); - request.isStatic = 1; - request.dstAddress = new byte[] {(byte) 192, (byte) 168, 2, 1}; - request.macAddress = new byte[] {(byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xee, 0x11, 0x22}; - request.swIfIndex = IFACE_ID; + request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC; + request.neighbor.swIfIndex = IFACE_ID; return request; } } \ No newline at end of file diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java index 5f11a5d5c..ec8734cf7 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java @@ -29,6 +29,13 @@ import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.VppBaseCallException; import io.fd.vpp.jvpp.core.dto.IpNeighborAddDel; import io.fd.vpp.jvpp.core.dto.IpNeighborAddDelReply; +import io.fd.vpp.jvpp.core.types.Address; +import io.fd.vpp.jvpp.core.types.AddressFamily; +import io.fd.vpp.jvpp.core.types.AddressUnion; +import io.fd.vpp.jvpp.core.types.Ip6Address; +import io.fd.vpp.jvpp.core.types.IpNeighbor; +import io.fd.vpp.jvpp.core.types.IpNeighborFlags; +import io.fd.vpp.jvpp.core.types.MacAddress; import org.junit.Test; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone; @@ -121,12 +128,18 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements private IpNeighborAddDel getExpectedRequest(final boolean isAdd) { final IpNeighborAddDel request = new IpNeighborAddDel(); - request.isIpv6 = 1; request.isAdd = booleanToByte(isAdd); - request.isStatic = 1; - request.dstAddress = new byte[]{32, 1, 13, -72, 10, 11, 18, -16, 0, 0, 0, 0, 0, 0, 0, 1}; - request.macAddress = new byte[]{(byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xee, 0x11, 0x22}; - request.swIfIndex = IFACE_ID; + request.neighbor = new IpNeighbor(); + request.neighbor.macAddress = new MacAddress(); + request.neighbor.macAddress.macaddress = + new byte[]{(byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xee, 0x11, 0x22}; + request.neighbor.ipAddress = new Address(); + request.neighbor.ipAddress.af = AddressFamily.ADDRESS_IP6; + Ip6Address ip6Address = new Ip6Address(); + ip6Address.ip6Address = new byte[]{32, 1, 13, -72, 10, 11, 18, -16, 0, 0, 0, 0, 0, 0, 0, 1}; + request.neighbor.ipAddress.un = new AddressUnion(ip6Address); + request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC; + request.neighbor.swIfIndex = IFACE_ID; return request; } diff --git a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java index 1bdad2e2e..582b8e916 100644 --- a/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java +++ b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java @@ -26,6 +26,7 @@ import io.fd.hc2vpp.common.translate.util.NamingContext; import io.fd.honeycomb.translate.write.WriteFailedException; import io.fd.vpp.jvpp.core.dto.Ip6NdProxyAddDel; import io.fd.vpp.jvpp.core.dto.Ip6NdProxyAddDelReply; +import io.fd.vpp.jvpp.core.types.Ip6Address; import org.junit.Test; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.nd.proxy.rev170315.NdProxyIp6Augmentation; import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.nd.proxy.rev170315.interfaces._interface.ipv6.NdProxies; @@ -66,7 +67,8 @@ public class NdProxyCustomizerTest extends WriterCustomizerTest { customizer.writeCurrentAttributes(getId(address), data, writeContext); final Ip6NdProxyAddDel request = new Ip6NdProxyAddDel(); request.swIfIndex = IF_INDEX; - request.address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}; + request.ip = new Ip6Address(); + request.ip.ip6Address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x01}; verify(api).ip6NdProxyAddDel(request); } @@ -85,7 +87,8 @@ public class NdProxyCustomizerTest extends WriterCustomizerTest { final Ip6NdProxyAddDel request = new Ip6NdProxyAddDel(); request.isDel = 1; request.swIfIndex = IF_INDEX; - request.address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03}; + request.ip = new Ip6Address(); + request.ip.ip6Address = new byte[] {0x20, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03}; verify(api).ip6NdProxyAddDel(request); } -- cgit 1.2.3-korg