use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix in project openflowplugin by opendaylight.
the class Ipv6SourceEntrySerializerTest 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().setIpv6Source(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.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix in project openflowplugin by opendaylight.
the class AddressNormalizationUtilTest method normalizeIpv6Arbitrary.
@Test
public void normalizeIpv6Arbitrary() throws Exception {
final Ipv6Address leftAddress = new Ipv6Address("1E3D:5678:9ABC::");
final Ipv6ArbitraryMask leftMask = new Ipv6ArbitraryMask("FFFF:FF00::");
final Ipv6Prefix right = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
assertEquals(right, AddressNormalizationUtil.normalizeIpv6Arbitrary(leftAddress, leftMask));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix in project openflowplugin by opendaylight.
the class AddressNormalizationUtilTest method normalizeIpv6Prefix.
@Test
public void normalizeIpv6Prefix() throws Exception {
final Ipv6Prefix left = new Ipv6Prefix("1E3D:5678:9ABC::/24");
final Ipv6Prefix right = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
assertEquals(right, AddressNormalizationUtil.normalizeIpv6Prefix(left));
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix in project openflowplugin by opendaylight.
the class MatchNormalizationUtilTest method normalizeIpv6MatchArbitraryBitMask.
@Test
public void normalizeIpv6MatchArbitraryBitMask() {
final Ipv6Address leftAddress = new Ipv6Address("1E3D:5678:9ABC::");
final Ipv6ArbitraryMask leftMask = new Ipv6ArbitraryMask("FFFF:FF00::");
final Ipv6Prefix right = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
final MatchBuilder matchBuilder = MatchNormalizationUtil.normalizeIpv6MatchArbitraryBitMask(new MatchBuilder().setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder().setIpv6SourceAddressNoMask(leftAddress).setIpv6SourceArbitraryBitmask(leftMask).setIpv6DestinationAddressNoMask(leftAddress).setIpv6DestinationArbitraryBitmask(leftMask).build()));
assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.Ipv6Prefix in project openflowplugin by opendaylight.
the class Ipv6DestinationEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final Ipv6Prefix address = new Ipv6Prefix("fe80::200:f8ff:fe21:67cf/30");
writeHeader(in, true);
in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(address)));
in.writeBytes(IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(address)));
final Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
assertEquals(address.getValue(), match.getIpv6Destination().getValue());
assertEquals(0, in.readableBytes());
}
Aggregations