use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSll in project openflowplugin by opendaylight.
the class OfToSalIpv6NdSllCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull Ipv6NdSllCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
Ipv6NdSll ipv6NdSll = source.getIpv6NdSll();
if (ipv6NdSll != null) {
ipv6MatchBuilder.setIpv6NdSll(ipv6NdSll.getMacAddress());
matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSll in project openflowplugin by opendaylight.
the class Ipv6NdSllEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final MacAddress ipv6NdSll = new MacAddress("00:01:02:03:04:05");
final Match ipv6NdSllMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6NdSll(ipv6NdSll).build()).build();
assertMatch(ipv6NdSllMatch, false, (out) -> {
byte[] addressBytes = new byte[6];
out.readBytes(addressBytes);
assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), ipv6NdSll.getValue());
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSll in project openflowplugin by opendaylight.
the class SalToOfIpv6MatchCase method process.
@Override
public Optional<List<MatchEntry>> process(@Nonnull Ipv6Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
List<MatchEntry> result = new ArrayList<>();
if (source.getIpv6Source() != null) {
Ipv6Prefix ipv6Prefix = source.getIpv6Source();
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6Src.class);
Ipv6SrcCaseBuilder ipv6SrcCaseBuilder = new Ipv6SrcCaseBuilder();
Ipv6SrcBuilder ipv6SrcBuilder = new Ipv6SrcBuilder();
final Integer prefix = IpConversionUtil.extractIpv6Prefix(ipv6Prefix);
boolean hasMask = false;
if (null != prefix) {
ipv6SrcBuilder.setMask(IpConversionUtil.convertIpv6PrefixToByteArray(prefix));
hasMask = true;
}
ipv6SrcBuilder.setIpv6Address(IpConversionUtil.extractIpv6Address(ipv6Prefix));
ipv6SrcCaseBuilder.setIpv6Src(ipv6SrcBuilder.build());
matchEntryBuilder.setHasMask(hasMask);
matchEntryBuilder.setMatchEntryValue(ipv6SrcCaseBuilder.build());
result.add(matchEntryBuilder.build());
}
if (source.getIpv6Destination() != null) {
Ipv6Prefix ipv6Prefix = source.getIpv6Destination();
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6Dst.class);
Ipv6DstCaseBuilder ipv6DstCaseBuilder = new Ipv6DstCaseBuilder();
Ipv6DstBuilder ipv6DstBuilder = new Ipv6DstBuilder();
final Integer prefix = IpConversionUtil.extractIpv6Prefix(ipv6Prefix);
boolean hasMask = false;
if (null != prefix) {
ipv6DstBuilder.setMask(IpConversionUtil.convertIpv6PrefixToByteArray(prefix));
hasMask = true;
}
ipv6DstBuilder.setIpv6Address(IpConversionUtil.extractIpv6Address(ipv6Prefix));
ipv6DstCaseBuilder.setIpv6Dst(ipv6DstBuilder.build());
matchEntryBuilder.setHasMask(hasMask);
matchEntryBuilder.setMatchEntryValue(ipv6DstCaseBuilder.build());
result.add(matchEntryBuilder.build());
}
if (source.getIpv6Label() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
boolean hasmask = false;
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6Flabel.class);
Ipv6FlabelCaseBuilder ipv6FlabelCaseBuilder = new Ipv6FlabelCaseBuilder();
Ipv6FlabelBuilder ipv6FlabelBuilder = new Ipv6FlabelBuilder();
ipv6FlabelBuilder.setIpv6Flabel(source.getIpv6Label().getIpv6Flabel());
if (source.getIpv6Label().getFlabelMask() != null) {
hasmask = true;
ipv6FlabelBuilder.setMask(ByteUtil.unsignedIntToBytes(source.getIpv6Label().getFlabelMask().getValue()));
}
ipv6FlabelCaseBuilder.setIpv6Flabel(ipv6FlabelBuilder.build());
matchEntryBuilder.setMatchEntryValue(ipv6FlabelCaseBuilder.build());
matchEntryBuilder.setHasMask(hasmask);
result.add(matchEntryBuilder.build());
}
if (source.getIpv6NdTarget() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(Ipv6NdTarget.class);
Ipv6NdTargetCaseBuilder ipv6NdTargetCaseBuilder = new Ipv6NdTargetCaseBuilder();
Ipv6NdTargetBuilder ipv6NdTargetBuilder = new Ipv6NdTargetBuilder();
ipv6NdTargetBuilder.setIpv6Address(source.getIpv6NdTarget());
ipv6NdTargetCaseBuilder.setIpv6NdTarget(ipv6NdTargetBuilder.build());
matchEntryBuilder.setMatchEntryValue(ipv6NdTargetCaseBuilder.build());
result.add(matchEntryBuilder.build());
}
if (source.getIpv6NdSll() != null) {
MacAddress ipv6NdSll = source.getIpv6NdSll();
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6NdSll.class);
Ipv6NdSllCaseBuilder ipv6NdSllCaseBuilder = new Ipv6NdSllCaseBuilder();
Ipv6NdSllBuilder ipv6NdSllBuilder = new Ipv6NdSllBuilder();
ipv6NdSllBuilder.setMacAddress(ipv6NdSll);
ipv6NdSllCaseBuilder.setIpv6NdSll(ipv6NdSllBuilder.build());
matchEntryBuilder.setMatchEntryValue(ipv6NdSllCaseBuilder.build());
matchEntryBuilder.setHasMask(false);
result.add(matchEntryBuilder.build());
}
if (source.getIpv6NdTll() != null) {
MacAddress ipv6NdSll = source.getIpv6NdTll();
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6NdTll.class);
Ipv6NdTllCaseBuilder ipv6NdTllCaseBuilder = new Ipv6NdTllCaseBuilder();
Ipv6NdTllBuilder ipv6NdTllBuilder = new Ipv6NdTllBuilder();
ipv6NdTllBuilder.setMacAddress(ipv6NdSll);
ipv6NdTllCaseBuilder.setIpv6NdTll(ipv6NdTllBuilder.build());
matchEntryBuilder.setMatchEntryValue(ipv6NdTllCaseBuilder.build());
matchEntryBuilder.setHasMask(false);
result.add(matchEntryBuilder.build());
}
if (source.getIpv6ExtHeader() != null) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
boolean hasmask = false;
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setOxmMatchField(Ipv6Exthdr.class);
Ipv6ExthdrCaseBuilder ipv6ExthdrCaseBuilder = new Ipv6ExthdrCaseBuilder();
Ipv6ExthdrBuilder ipv6ExthdrBuilder = new Ipv6ExthdrBuilder();
int bitmap = source.getIpv6ExtHeader().getIpv6Exthdr();
ipv6ExthdrBuilder.setPseudoField(makeIpv6ExthdrFlags(bitmap));
if (source.getIpv6ExtHeader().getIpv6ExthdrMask() != null) {
hasmask = true;
ipv6ExthdrBuilder.setMask(ByteUtil.unsignedShortToBytes(source.getIpv6ExtHeader().getIpv6ExthdrMask()));
}
ipv6ExthdrCaseBuilder.setIpv6Exthdr(ipv6ExthdrBuilder.build());
matchEntryBuilder.setMatchEntryValue(ipv6ExthdrCaseBuilder.build());
matchEntryBuilder.setHasMask(hasmask);
result.add(matchEntryBuilder.build());
}
return Optional.of(result);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSll 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");
}
}
Aggregations