use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match in project openflowplugin by opendaylight.
the class Ipv6NdTllEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final MacAddress address = new MacAddress("00:01:02:03:04:05");
writeHeader(in, false);
in.writeBytes(IetfYangUtil.INSTANCE.bytesFor(address));
Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
assertEquals(address.getValue(), match.getIpv6NdTll().getValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match in project openflowplugin by opendaylight.
the class Ipv6FlabelEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final int flowLabel = 10;
final int flowLabelMask = 8;
writeHeader(in, false);
in.writeInt(flowLabel);
Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
assertEquals(flowLabel, match.getIpv6Label().getIpv6Flabel().getValue().intValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
in.writeInt(flowLabel);
in.writeInt(flowLabelMask);
match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
assertEquals(flowLabel, match.getIpv6Label().getIpv6Flabel().getValue().intValue());
assertEquals(flowLabelMask, match.getIpv6Label().getFlabelMask().getValue().intValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match in project openflowplugin by opendaylight.
the class Ipv6SourceEntryDeserializerTest 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.getIpv6Source().getValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match in project openflowplugin by opendaylight.
the class MatchResponseConvertor2Test method testLayer3MatchIpv6ExtHeader2.
/**
* Test {@link MatchResponseConvertor#convert(MatchEntriesGrouping, VersionDatapathIdConvertorData)}.
*/
@Test
public void testLayer3MatchIpv6ExtHeader2() {
final MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
final List<MatchEntry> entries = new ArrayList<>();
final MatchEntryBuilder entriesBuilder = new MatchEntryBuilder();
entriesBuilder.setOxmClass(OpenflowBasicClass.class);
entriesBuilder.setOxmMatchField(Ipv6Exthdr.class);
entriesBuilder.setHasMask(true);
final Ipv6ExthdrCaseBuilder ipv6ExthdrCaseBuilder = new Ipv6ExthdrCaseBuilder();
final Ipv6ExthdrBuilder ipv6ExthdrBuilder = new Ipv6ExthdrBuilder();
ipv6ExthdrBuilder.setPseudoField(new Ipv6ExthdrFlags(false, true, false, true, false, true, false, true, false));
ipv6ExthdrBuilder.setMask(new byte[] { 1, 2 });
ipv6ExthdrCaseBuilder.setIpv6Exthdr(ipv6ExthdrBuilder.build());
entriesBuilder.setMatchEntryValue(ipv6ExthdrCaseBuilder.build());
entries.add(entriesBuilder.build());
builder.setMatchEntry(entries);
final VersionDatapathIdConvertorData datapathIdConvertorData = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
datapathIdConvertorData.setDatapathId(new BigInteger("42"));
final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder salMatchBuilder = convert(builder.build(), datapathIdConvertorData);
final org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match builtMatch = salMatchBuilder.build();
final Ipv6Match ipv6Match = (Ipv6Match) builtMatch.getLayer3Match();
Assert.assertEquals("Wrong ipv6 ext header", 153, ipv6Match.getIpv6ExtHeader().getIpv6Exthdr().intValue());
Assert.assertEquals("Wrong ipv6 ext header mask", 258, ipv6Match.getIpv6ExtHeader().getIpv6ExthdrMask().intValue());
}
Aggregations