summaryrefslogtreecommitdiffstats
path: root/l3
diff options
context:
space:
mode:
authorMichal Cmarada <mcmarada@cisco.com>2019-02-11 09:35:12 +0100
committerMichal Cmarada <mcmarada@cisco.com>2019-03-01 14:03:15 +0100
commitee5597ccd4091fee6a1586849d61eb657a99225d (patch)
tree25b277a2e5beb18262103925f70fc3fa11aae574 /l3
parent35d3258fd1b7a4bd2b21f11bb0a9d7d78746f1a4 (diff)
add support for Enumsets
VPP API introduced flags which are by JVPP translated to EnumSets. This fixes several cases where flags are used. Change-Id: Ie52cba0c3a36fa6de2bda91c4688277471a67243 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.java7
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/read/ipv6/Ipv6NeighbourCustomizer.java7
-rw-r--r--l3/impl/src/main/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizer.java3
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/read/InterfaceChildNodeTest.java3
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv4/Ipv4NeighbourCustomizerTest.java3
-rw-r--r--l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java3
-rw-r--r--l3/utils/src/main/java/io/fd/hc2vpp/l3/utils/ip/write/IpWriter.java3
7 files changed, 19 insertions, 10 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 1da148a31..e6f5e17b1 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
@@ -82,9 +82,10 @@ public class Ipv4NeighbourCustomizer extends IpNeighbourReader
ipNeighborDetails.neighbor.ipAddress.un.getIp4().ip4Address))
.withKey(keyMapper().apply(ipNeighborDetails))
.setLinkLayerAddress(toPhysAddress(ipNeighborDetails.neighbor.macAddress.macaddress))
- .setOrigin(ipNeighborDetails.neighbor.flags != IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC
- ? Dynamic
- : Static));
+ .setOrigin(ipNeighborDetails.neighbor.flags
+ .contains(IpNeighborFlags.IpNeighborFlagsOptions.IP_API_NEIGHBOR_FLAG_STATIC)
+ ? Static
+ : Dynamic));
}
}
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 92f4962ee..54eccce63 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
@@ -77,9 +77,10 @@ public class Ipv6NeighbourCustomizer extends IpNeighbourReader
ipNeighborDetails.neighbor.ipAddress.un.getIp6().ip6Address))
.withKey(keyMapper().apply(ipNeighborDetails))
.setLinkLayerAddress(toPhysAddress(ipNeighborDetails.neighbor.macAddress.macaddress))
- .setOrigin(ipNeighborDetails.neighbor.flags != IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC
- ? Dynamic
- : Static));
+ .setOrigin(ipNeighborDetails.neighbor.flags
+ .contains(IpNeighborFlags.IpNeighborFlagsOptions.IP_API_NEIGHBOR_FLAG_STATIC)
+ ? Static
+ : Dynamic));
}
}
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 f7105088d..f57965778 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
@@ -98,7 +98,8 @@ public class Ipv6NeighbourCustomizer extends FutureJVppCustomizer
Neighbor data) throws WriteFailedException {
addDelNeighbour(id, () -> {
IpNeighborAddDel request = preBindRequest(add);
- request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC;
+ request.neighbor.flags = new IpNeighborFlags();
+ request.neighbor.flags.add(IpNeighborFlags.IpNeighborFlagsOptions.IP_API_NEIGHBOR_FLAG_STATIC);
request.neighbor.macAddress = parseMacAddress(data.getLinkLayerAddress().getValue());
request.neighbor.ipAddress = ipv6AddressToAddress(data.getIp());
request.neighbor.swIfIndex = parentInterfaceIndex;
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 9534ac966..f58422066 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
@@ -37,6 +37,7 @@ 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.IpNeighborFlags;
import io.fd.vpp.jvpp.core.types.MacAddress;
import java.util.Arrays;
import java.util.List;
@@ -209,6 +210,8 @@ public interface InterfaceChildNodeTest extends NamingContextHelper, FutureProdu
detail.neighbor.ipAddress.un = addressUnion;
detail.neighbor.macAddress = new MacAddress();
detail.neighbor.macAddress.macaddress = mac;
+ detail.neighbor.flags = new IpNeighborFlags();
+ detail.neighbor.flags.add(IpNeighborFlags.IpNeighborFlagsOptions.IP_API_NEIGHBOR_FLAG_STATIC);
return detail;
}
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 7d2b6472c..cb87b5e3e 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
@@ -137,7 +137,8 @@ public class Ipv4NeighbourCustomizerTest extends WriterCustomizerTest implements
ip4Address.ip4Address = new byte[]{(byte) 192, (byte) 168, 2, 1};
request.neighbor.ipAddress.un = new AddressUnion(ip4Address);
request.isAdd = booleanToByte(isAdd);
- request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC;
+ request.neighbor.flags = new IpNeighborFlags();
+ request.neighbor.flags.add(IpNeighborFlags.IpNeighborFlagsOptions.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/Ipv6NeighbourCustomizerTest.java b/l3/impl/src/test/java/io/fd/hc2vpp/l3/write/ipv6/Ipv6NeighbourCustomizerTest.java
index ec8734cf7..f5f906155 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
@@ -138,7 +138,8 @@ public class Ipv6NeighbourCustomizerTest extends WriterCustomizerTest implements
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.flags = new IpNeighborFlags();
+ request.neighbor.flags.add(IpNeighborFlags.IpNeighborFlagsOptions.IP_API_NEIGHBOR_FLAG_STATIC);
request.neighbor.swIfIndex = IFACE_ID;
return 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 00e34d3cc..5bfdbd49b 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
@@ -148,7 +148,8 @@ public interface IpWriter extends ByteDataTranslator, AddressTranslator, JvppRep
IpNeighborAddDel request = new IpNeighborAddDel();
request.neighbor = new IpNeighbor();
request.isAdd = ByteDataTranslator.INSTANCE.booleanToByte(add);
- request.neighbor.flags = IpNeighborFlags.IP_API_NEIGHBOR_FLAG_STATIC;
+ request.neighbor.flags = new IpNeighborFlags();
+ request.neighbor.flags.add(IpNeighborFlags.IpNeighborFlagsOptions.IP_API_NEIGHBOR_FLAG_STATIC);
return request;
}
}