use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createL3IPv6Match.
private static MatchBuilder createL3IPv6Match() {
final MatchBuilder match = new MatchBuilder();
final EthernetMatchBuilder eth = new EthernetMatchBuilder();
final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86ddL));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
final MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
final MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
final Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
nextheader.setIpv6Exthdr(58);
final Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
final Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
ipv6label.setIpv6Flabel(label);
ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
// icmpv6
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
// match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 0);
match.setIcmpv6Match(icmpv6match.build());
final Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
// ipv6match.setIpv6Source(srcip6);
// ipv6match.setIpv6Destination(dstip6);
// ipv6match.setIpv6ExtHeader(nextheader.build());
ipv6match.setIpv6NdSll(ndsll);
ipv6match.setIpv6NdTll(ndtll);
// ipv6match.setIpv6NdTarget(ndtarget);
ipv6match.setIpv6Label(ipv6label.build());
match.setLayer3Match(ipv6match.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.
the class OfToSalIpv6ExthdrCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull Ipv6ExthdrCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
Ipv6Exthdr ipv6Exthdr = source.getIpv6Exthdr();
if (ipv6Exthdr != null) {
Ipv6ExtHeaderBuilder ipv6ExtHeaderBuilder = new Ipv6ExtHeaderBuilder();
Ipv6ExthdrFlags headerFlags = ipv6Exthdr.getPseudoField();
Integer bitmap = MatchConvertorUtil.ipv6ExthdrFlagsToInt(headerFlags);
ipv6ExtHeaderBuilder.setIpv6Exthdr(bitmap);
byte[] mask = ipv6Exthdr.getMask();
if (mask != null) {
ipv6ExtHeaderBuilder.setIpv6ExthdrMask(ByteUtil.bytesToUnsignedShort(mask));
}
ipv6MatchBuilder.setIpv6ExtHeader(ipv6ExtHeaderBuilder.build());
matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.
the class Ipv6NdSllEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final MacAddress address = OxmDeserializerHelper.convertMacAddress(message);
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6NdSll(address).build());
} else if (Ipv6Match.class.isInstance(builder.getLayer3Match()) && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdSll())) {
final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
builder.setLayer3Match(new Ipv6MatchBuilder(match).setIpv6NdSll(address).build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "ipv6NdSll");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder 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.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder 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)));
});
}
Aggregations