use of org.opendaylight.yang.gen.v1.urn.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask in project openflowplugin by opendaylight.
the class MatchConvertorTest method testIpv6MatchArbitraryBitMask.
@Test
public void testIpv6MatchArbitraryBitMask() {
Ipv6MatchArbitraryBitMaskBuilder ipv6MatchArbitraryBitMaskBuilder = new Ipv6MatchArbitraryBitMaskBuilder();
ipv6MatchArbitraryBitMaskBuilder.setIpv6SourceAddressNoMask(new Ipv6Address("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0"));
ipv6MatchArbitraryBitMaskBuilder.setIpv6SourceArbitraryBitmask(new Ipv6ArbitraryMask("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:A555"));
ipv6MatchArbitraryBitMaskBuilder.setIpv6DestinationAddressNoMask(new Ipv6Address("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0"));
ipv6MatchArbitraryBitMaskBuilder.setIpv6DestinationArbitraryBitmask(new Ipv6ArbitraryMask("fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:A555"));
MatchBuilder builder = new MatchBuilder();
builder.setLayer3Match(ipv6MatchArbitraryBitMaskBuilder.build());
Match match = builder.build();
Optional<List<MatchEntry>> entriesOptional = converterManager.convert(match, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
List<MatchEntry> entries = entriesOptional.get();
Assert.assertEquals("Wrong entries size", 2, entries.size());
MatchEntry entry = entries.get(0);
checkEntryHeader(entry, Ipv6Src.class, true);
Assert.assertEquals("wrong Ipv6Adress source", "fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0", ((Ipv6SrcCase) entry.getMatchEntryValue()).getIpv6Src().getIpv6Address().getValue());
entry = entries.get(1);
checkEntryHeader(entry, Ipv6Dst.class, true);
Assert.assertEquals("wrong Ipv6Adress destination", "fbA0:FFB6:FFF0:FFF0:FFF0:FFF0:FFF0:AFF0", ((Ipv6DstCase) entry.getMatchEntryValue()).getIpv6Dst().getIpv6Address().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask 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.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask 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.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask in project openflowplugin by opendaylight.
the class Ipv6ArbitraryBitMaskSourceEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final Ipv6Address ipv6Address = new Ipv6Address("aaaa:bbbb:1111:2222::");
final Ipv6ArbitraryMask ipv6mask = new Ipv6ArbitraryMask("ffff:ffff:ffff:ffff::");
final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder().setIpv6SourceAddressNoMask(ipv6Address).setIpv6SourceArbitraryBitmask(ipv6mask).build()).build();
assertMatch(ipv6abmMatch, true, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(ipv6Address));
byte[] mask = new byte[16];
out.readBytes(mask);
assertArrayEquals(mask, IpConversionUtil.convertIpv6ArbitraryMaskToByteArray(ipv6mask));
});
final Match ipv6abmMatchNoMask = new MatchBuilder().setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder().setIpv6SourceAddressNoMask(ipv6Address).build()).build();
assertMatch(ipv6abmMatchNoMask, false, (out) -> {
byte[] address = new byte[16];
out.readBytes(address);
assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(ipv6Address));
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask in project openflowplugin by opendaylight.
the class IpConversionUtilTest method extractIpv6AddressMaskTest.
@Test
public void extractIpv6AddressMaskTest() {
Ipv6ArbitraryMask ipv6IpAddressMask;
Ipv6Prefix ipv6Prefix = new Ipv6Prefix("1:2:3:4:5:6:7:8/16");
ipv6IpAddressMask = IpConversionUtil.extractIpv6AddressMask(ipv6Prefix);
Assert.assertEquals(ipv6IpAddressMask.getValue(), "ffff:0:0:0:0:0:0:0");
}
Aggregations