use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address in project openflowplugin by opendaylight.
the class OxmIpv6SrcSerializerTest method prepareMatchEntry.
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, String value) {
final MatchEntryBuilder builder = prepareHeader(hasMask);
Ipv6SrcCaseBuilder caseBuilder = new Ipv6SrcCaseBuilder();
Ipv6SrcBuilder srcBuilder = new Ipv6SrcBuilder();
srcBuilder.setIpv6Address(new Ipv6Address(value));
if (hasMask) {
srcBuilder.setMask(new byte[] { 15, 15, 0, 0 });
}
caseBuilder.setIpv6Src(srcBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
return builder;
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address in project openflowplugin by opendaylight.
the class Ipv6DestinationEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Ipv6Prefix ipv6Address = new Ipv6Prefix("2001:db8::/32");
final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Destination(ipv6Address).build()).build();
assertMatch(ipv6abmMatch, true, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
byte[] mask = new byte[16];
out.readBytes(mask);
assertArrayEquals(mask, IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(ipv6Address)));
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address in project openflowplugin by opendaylight.
the class Ipv6DestinationEntrySerializerTest method testSerializeWithoutMask.
@Test
public void testSerializeWithoutMask() throws Exception {
final Ipv6Prefix ipv6Address = new Ipv6Prefix("2001:db8::123/128");
final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Destination(ipv6Address).build()).build();
assertMatch(ipv6abmMatch, false, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address in project openflowplugin by opendaylight.
the class Ipv6NdTargetEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Ipv6Address ipv6NdTarget = new Ipv6Address("2001:db8::");
final Match ipv6NdTargetMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6NdTarget(ipv6NdTarget).build()).build();
assertMatch(ipv6NdTargetMatch, false, (out) -> {
byte[] addressBytes = new byte[16];
out.readBytes(addressBytes);
assertArrayEquals(addressBytes, IetfInetUtil.INSTANCE.ipv6AddressBytes(ipv6NdTarget));
});
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address in project openflowplugin by opendaylight.
the class Ipv6SourceEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Ipv6Prefix ipv6Address = new Ipv6Prefix("2001:db8::/32");
final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Source(ipv6Address).build()).build();
assertMatch(ipv6abmMatch, true, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
byte[] mask = new byte[16];
out.readBytes(mask);
assertArrayEquals(mask, IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(ipv6Address)));
});
}
Aggregations