summaryrefslogtreecommitdiffstats
path: root/l3
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-02-06 09:41:39 +0100
committerMichal Cmarada <mcmarada@cisco.com>2019-02-06 09:41:39 +0100
commit3751ef96ae1427cc8d5ecb9cbba705e837bb63ca (patch)
tree08c01465ea307e9eebcdf1e12990ebdb66961228 /l3
parentacf5a8a052e2f7f7c2b03c023df3dd489688cb00 (diff)
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 <mcmarada@cisco.com>
Diffstat (limited to 'l3')
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/Ipv4NeighbourCustomizer.java14
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java11
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/Ipv6NeighbourCustomizer.java14
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizer.java2
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java11
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java16
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java9
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java16
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java26
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java4
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java18
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/read/InterfaceChildNodeTest.java27
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizerTest.java10
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ProxyRangeCustomizerTest.java9
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java23
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java23
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizerTest.java7
-rw-r--r--l3/utils/src/main/java/io/fd/hc2vpp/l3/utils/ip/write/IpWriter.java22
18 files changed, 162 insertions, 100 deletions
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/Ipv4NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/Ipv4NeighbourCustomizer.java
index 48a2d5aed..1da148a31 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/Ipv4NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/Ipv4NeighbourCustomizer.java
@@ -30,6 +30,7 @@ import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager.DumpCacheManag
import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.IpNeighborFlags;
import java.util.List;
import java.util.function.Function;
import javax.annotation.Nonnull;
@@ -74,12 +75,14 @@ public class Ipv4NeighbourCustomizer extends IpNeighbourReader
if (dumpOpt.isPresent()) {
dumpOpt.get().ipNeighborDetails
.stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress)))
+ .filter(ipNeighborDetails -> ip.equals(arrayToIpv4AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address)))
.findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress))
+ .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv4AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address))
.withKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress))
- .setOrigin(ipNeighborDetails.isStatic == 0
+ .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.neighbor.macAddress.macaddress))
+ .setOrigin(ipNeighborDetails.neighbor.flags != IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC
? Dynamic
: Static));
}
@@ -97,6 +100,7 @@ public class Ipv4NeighbourCustomizer extends IpNeighbourReader
}
private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress));
+ return ipNeighborDetails -> new NeighborKey(
+ arrayToIpv4AddressNoZone(ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address));
}
} \ No newline at end of file
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
index 8e0267aca..c1c2f8559 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
@@ -67,11 +67,13 @@ public class SubInterfaceIpv4NeighbourCustomizer extends IpNeighbourReader
if (dumpOpt.isPresent()) {
dumpOpt.get().ipNeighborDetails
.stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress)))
+ .filter(ipNeighborDetails -> ip.equals(arrayToIpv4AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address)))
.findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress))
+ .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv4AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address))
.withKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress)));
+ .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.neighbor.macAddress.macaddress)));
}
}
@@ -87,6 +89,7 @@ public class SubInterfaceIpv4NeighbourCustomizer extends IpNeighbourReader
}
private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv4AddressNoZone(ipNeighborDetails.ipAddress));
+ return ipNeighborDetails -> new NeighborKey(
+ arrayToIpv4AddressNoZone(ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address));
}
}
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/Ipv6NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/Ipv6NeighbourCustomizer.java
index 7d7578777..92f4962ee 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/Ipv6NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/Ipv6NeighbourCustomizer.java
@@ -31,6 +31,7 @@ import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
import io.fd.vpp.jvpp.core.dto.IpNeighborDetails;
import io.fd.vpp.jvpp.core.dto.IpNeighborDetailsReplyDump;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.IpNeighborFlags;
import java.util.List;
import java.util.function.Function;
import javax.annotation.Nonnull;
@@ -69,12 +70,14 @@ public class Ipv6NeighbourCustomizer extends IpNeighbourReader
if (dumpOpt.isPresent()) {
dumpOpt.get().ipNeighborDetails
.stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress)))
+ .filter(ipNeighborDetails -> ip.equals(arrayToIpv6AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address)))
.findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress))
+ .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv6AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address))
.withKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress))
- .setOrigin(ipNeighborDetails.isStatic == 0
+ .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.neighbor.macAddress.macaddress))
+ .setOrigin(ipNeighborDetails.neighbor.flags != IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC
? Dynamic
: Static));
}
@@ -92,6 +95,7 @@ public class Ipv6NeighbourCustomizer extends IpNeighbourReader
}
private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress));
+ return ipNeighborDetails -> new NeighborKey(
+ arrayToIpv6AddressNoZone(ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address));
}
} \ No newline at end of file
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizer.java
index acdb2098b..93e6275b9 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/nd/NdProxyCustomizer.java
@@ -88,7 +88,7 @@ public final class NdProxyCustomizer extends FutureJVppCustomizer
return dump.get().ip6NdProxyDetails.stream()
.filter(detail -> detail.swIfIndex == swIfIndex)
- .map(detail -> new NdProxyKey(arrayToIpv6AddressNoZone(detail.address)))
+ .map(detail -> new NdProxyKey(arrayToIpv6AddressNoZone(detail.ip.ip6Address)))
.collect(Collectors.toList());
}
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
index 4a0286173..1227abc03 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
@@ -67,11 +67,13 @@ public class SubInterfaceIpv6NeighbourCustomizer extends IpNeighbourReader
if (dumpOpt.isPresent()) {
dumpOpt.get().ipNeighborDetails
.stream()
- .filter(ipNeighborDetails -> ip.equals(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress)))
+ .filter(ipNeighborDetails -> ip.equals(arrayToIpv6AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address)))
.findFirst()
- .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress))
+ .ifPresent(ipNeighborDetails -> builder.setIp(arrayToIpv6AddressNoZone(
+ ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address))
.withKey(keyMapper().apply(ipNeighborDetails))
- .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.macAddress)));
+ .setLinkLayerAddress(toPhysAddress(ipNeighborDetails.neighbor.macAddress.macaddress)));
}
}
@@ -87,6 +89,7 @@ public class SubInterfaceIpv6NeighbourCustomizer extends IpNeighbourReader
}
private Function<IpNeighborDetails, NeighborKey> keyMapper() {
- return ipNeighborDetails -> new NeighborKey(arrayToIpv6AddressNoZone(ipNeighborDetails.ipAddress));
+ return ipNeighborDetails -> new NeighborKey(
+ arrayToIpv6AddressNoZone(ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address));
}
}
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java
index f8edcfb15..d5988fa9c 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizer.java
@@ -61,11 +61,11 @@ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Processing request for Neighbour {} write", id);
addDelNeighbour(id, () -> {
- IpNeighborAddDel request = preBindIpv4Request(true);
+ IpNeighborAddDel request = preBindRequest(true);
- request.dstAddress = ipv4AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = interfaceContext
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv4AddressNoZoneToAddress(data.getIp());
+ request.neighbor.swIfIndex = interfaceContext
.getIndex(id.firstKeyOf(Interface.class).getName(), writeContext.getMappingContext());
return request;
}, getFutureJVpp());
@@ -80,11 +80,11 @@ public class Ipv4NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Processing request for Neighbour {} delete", id);
addDelNeighbour(id, () -> {
- IpNeighborAddDel request = preBindIpv4Request(false);
+ IpNeighborAddDel request = preBindRequest(false);
- request.dstAddress = ipv4AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = interfaceContext
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv4AddressNoZoneToAddress(data.getIp());
+ request.neighbor.swIfIndex = interfaceContext
.getIndex(id.firstKeyOf(Interface.class).getName(), writeContext.getMappingContext());
return request;
}, getFutureJVpp());
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java
index 79d0e55e5..461de46c3 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/ProxyRangeCustomizer.java
@@ -25,6 +25,7 @@ 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.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.Ip4Address;
import io.fd.vpp.jvpp.core.types.ProxyArp;
import java.util.concurrent.Future;
import javax.annotation.Nonnull;
@@ -88,9 +89,11 @@ public class ProxyRangeCustomizer extends FutureJVppCustomizer
final ProxyArpAddDel proxyArpAddDel = new ProxyArpAddDel();
proxyArpAddDel.isAdd = isAdd;
proxyArpAddDel.proxy = new ProxyArp();
- proxyArpAddDel.proxy.lowAddress = Ipv4Translator.INSTANCE.ipv4AddressNoZoneToArray(lAddr);
- proxyArpAddDel.proxy.hiAddress = Ipv4Translator.INSTANCE.ipv4AddressNoZoneToArray(hAddr);
- proxyArpAddDel.proxy.vrfId = vrfId;
+ proxyArpAddDel.proxy.low = new Ip4Address();
+ proxyArpAddDel.proxy.low.ip4Address = Ipv4Translator.INSTANCE.ipv4AddressNoZoneToArray(lAddr);
+ proxyArpAddDel.proxy.hi = new Ip4Address();
+ proxyArpAddDel.proxy.hi.ip4Address = Ipv4Translator.INSTANCE.ipv4AddressNoZoneToArray(hAddr);
+ proxyArpAddDel.proxy.tableId = vrfId;
return proxyArpAddDel;
}
}
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
index 61685af9c..89d6dbf51 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv4/subinterface/SubInterfaceIpv4NeighbourCustomizer.java
@@ -55,11 +55,11 @@ public class SubInterfaceIpv4NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Processing request for Neighbour {} write", id);
addDelNeighbour(id, () -> {
- IpNeighborAddDel request = preBindIpv4Request(true);
+ IpNeighborAddDel request = preBindRequest(true);
- request.dstAddress = ipv4AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv4AddressNoZoneToAddress(data.getIp());
+ request.neighbor.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
// we don't have support for sub-interface routing, so not setting vrf
return request;
@@ -75,11 +75,11 @@ public class SubInterfaceIpv4NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Processing request for Neighbour {} delete", id);
addDelNeighbour(id, () -> {
- IpNeighborAddDel request = preBindIpv4Request(false);
+ IpNeighborAddDel request = preBindRequest(false);
- request.dstAddress = ipv4AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv4AddressNoZoneToAddress(data.getIp());
+ request.neighbor.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
//TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid
//request.vrfId
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java
index ed06ab08f..f7105088d 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java
@@ -25,12 +25,14 @@ 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.hc2vpp.l3.utils.ip.write.IpWriter;
import io.fd.honeycomb.translate.MappingContext;
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.IpNeighborAddDel;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.IpNeighborFlags;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv6.Neighbor;
@@ -40,7 +42,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
- implements ListWriterCustomizer<Neighbor, NeighborKey>, ByteDataTranslator, AddressTranslator,
+ implements ListWriterCustomizer<Neighbor, NeighborKey>, ByteDataTranslator, AddressTranslator, IpWriter,
JvppReplyConsumer {
private static final Logger LOG = LoggerFactory.getLogger(Ipv6NeighbourCustomizer.class);
@@ -59,7 +61,7 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
checkNotNull(dataAfter, "Cannot write null neighbour");
checkArgument(id.firstKeyOf(Interface.class) != null, "No parent interface key found");
- LOG.debug("Processing request for Neigbour write");
+ LOG.debug("Processing request for Neighbour write");
String interfaceName = id.firstKeyOf(Interface.class).getName();
MappingContext mappingContext = writeContext.getMappingContext();
@@ -79,7 +81,7 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
checkNotNull(dataBefore, "Cannot delete null neighbour");
checkArgument(id.firstKeyOf(Interface.class) != null, "No parent interface key found");
- LOG.debug("Processing request for Neigbour delete");
+ LOG.debug("Processing request for Neighbour delete");
String interfaceName = id.firstKeyOf(Interface.class).getName();
MappingContext mappingContext = writeContext.getMappingContext();
@@ -94,15 +96,13 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
private void addDelNeighbourAndReply(InstanceIdentifier<Neighbor> id, boolean add, int parentInterfaceIndex,
Neighbor data) throws WriteFailedException {
-
- IpNeighborAddDel request = new IpNeighborAddDel();
-
- request.isAdd = booleanToByte(add);
- request.isIpv6 = 1;
- request.isStatic = 1;
- request.dstAddress = ipv6AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = parentInterfaceIndex;
- getReplyForWrite(getFutureJVpp().ipNeighborAddDel(request).toCompletableFuture(), id);
+ addDelNeighbour(id, () -> {
+ IpNeighborAddDel request = preBindRequest(add);
+ request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC;
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv6AddressToAddress(data.getIp());
+ request.neighbor.swIfIndex = parentInterfaceIndex;
+ return request;
+ }, getFutureJVpp());
}
}
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java
index ca6e2bf87..23556a468 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/nd/NdProxyCustomizer.java
@@ -27,6 +27,7 @@ import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.Ip6NdProxyAddDel;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.Ip6Address;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.nd.proxy.rev170315.interfaces._interface.ipv6.nd.proxies.NdProxy;
import org.opendaylight.yang.gen.v1.http.fd.io.hc2vpp.yang.nd.proxy.rev170315.interfaces._interface.ipv6.nd.proxies.NdProxyKey;
@@ -76,7 +77,8 @@ public final class NdProxyCustomizer extends FutureJVppCustomizer
final Ip6NdProxyAddDel request = new Ip6NdProxyAddDel();
request.swIfIndex = swIfIndex;
- request.address = addressBytes;
+ request.ip = new Ip6Address();
+ request.ip.ip6Address = addressBytes;
request.isDel = booleanToByte(!add);
getReplyForWrite(getFutureJVpp().ip6NdProxyAddDel(request).toCompletableFuture(), id);
diff --git a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
index 3fc43f76b..00e499f92 100644
--- a/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
+++ b/l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/subinterface/SubInterfaceIpv6NeighbourCustomizer.java
@@ -55,11 +55,10 @@ public class SubInterfaceIpv6NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Processing request for Neighbour {} write", id);
addDelNeighbour(id, () -> {
- IpNeighborAddDel request = preBindIpv6Request(true);
-
- request.dstAddress = ipv6AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
+ IpNeighborAddDel request = preBindRequest(true);
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv6AddressToAddress(data.getIp());
+ request.neighbor.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
// we don't have support for sub-interface routing, so not setting vrf
return request;
@@ -75,11 +74,10 @@ public class SubInterfaceIpv6NeighbourCustomizer extends FutureJVppCustomizer
LOG.debug("Processing request for Neighbour {} delete", id);
addDelNeighbour(id, () -> {
- IpNeighborAddDel request = preBindIpv6Request(false);
-
- request.dstAddress = ipv6AddressNoZoneToArray(data.getIp());
- request.macAddress = parseMac(data.getLinkLayerAddress().getValue());
- request.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
+ IpNeighborAddDel request = preBindRequest(false);
+ request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
+ request.neighbor.ipAddress = ipv6AddressToAddress(data.getIp());
+ request.neighbor.swIfIndex = subInterfaceIndex(id, interfaceContext, writeContext.getMappingContext());
//TODO HONEYCOMB-182 if it is necessary for future use ,make adjustments to be able to set vrfid
//request.vrfId
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);
}
diff --git a/l3/utils/src/main/java/io/fd/hc2vpp/l3/utils/ip/write/IpWriter.java b/l3/utils/src/main/java/io/fd/hc2vpp/l3/utils/ip/write/IpWriter.java
index d3b328cd3..00e34d3cc 100644
--- a/l3/utils/src/main/java/io/fd/hc2vpp/l3/utils/ip/write/IpWriter.java
+++ b/l3/utils/src/main/java/io/fd/hc2vpp/l3/utils/ip/write/IpWriter.java
@@ -29,6 +29,8 @@ import io.fd.vpp.jvpp.core.dto.IpNeighborAddDel;
import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddress;
import io.fd.vpp.jvpp.core.dto.SwInterfaceAddDelAddressReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import io.fd.vpp.jvpp.core.types.IpNeighbor;
+import io.fd.vpp.jvpp.core.types.IpNeighborFlags;
import java.util.concurrent.CompletionStage;
import java.util.function.Supplier;
import javax.annotation.Nonnegative;
@@ -142,25 +144,11 @@ public interface IpWriter extends ByteDataTranslator, AddressTranslator, JvppRep
getReplyForWrite(api.ipNeighborAddDel(requestSupplier.get()).toCompletableFuture(), id);
}
- default IpNeighborAddDel preBindIpv4Request(final boolean add) {
- IpNeighborAddDel request = staticPreBindRequest(add);
- request.isIpv6 = 0;
-
- return request;
- }
-
- default IpNeighborAddDel preBindIpv6Request(final boolean add) {
- IpNeighborAddDel request = staticPreBindRequest(add);
- request.isIpv6 = 1;
-
- return request;
- }
-
- static IpNeighborAddDel staticPreBindRequest(final boolean add) {
+ default IpNeighborAddDel preBindRequest(final boolean add) {
IpNeighborAddDel request = new IpNeighborAddDel();
-
+ request.neighbor = new IpNeighbor();
request.isAdd = ByteDataTranslator.INSTANCE.booleanToByte(add);
- request.isStatic = 1;
+ request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC;
return request;
}
}