use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6Match in project openflowplugin by opendaylight.
the class OpenflowPluginBulkTransactionProvider method createICMPv6Match.
private static MatchBuilder createICMPv6Match() {
MatchBuilder match = new MatchBuilder();
EthernetMatchBuilder eth = new EthernetMatchBuilder();
EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
ethTypeBuilder.setType(new EtherType(0x86ddL));
eth.setEthernetType(ethTypeBuilder.build());
match.setEthernetMatch(eth.build());
// ipv4 version
IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 58);
match.setIpMatch(ipmatch.build());
// icmpv6
Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
// match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6Match in project openflowplugin by opendaylight.
the class Icmpv6CodeEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short code = message.readUnsignedByte();
if (Objects.isNull(builder.getIcmpv6Match())) {
builder.setIcmpv6Match(new Icmpv6MatchBuilder().setIcmpv6Code(code).build());
} else if (Objects.isNull(builder.getIcmpv6Match().getIcmpv6Code())) {
builder.setIcmpv6Match(new Icmpv6MatchBuilder(builder.getIcmpv6Match()).setIcmpv6Code(code).build());
} else {
throwErrorOnMalformed(builder, "icmpv6Match", "icmpv6Code");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6Match in project openflowplugin by opendaylight.
the class Icmpv6TypeEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short type = message.readUnsignedByte();
if (Objects.isNull(builder.getIcmpv6Match())) {
builder.setIcmpv6Match(new Icmpv6MatchBuilder().setIcmpv6Type(type).build());
} else if (Objects.isNull(builder.getIcmpv6Match().getIcmpv6Type())) {
builder.setIcmpv6Match(new Icmpv6MatchBuilder(builder.getIcmpv6Match()).setIcmpv6Type(type).build());
} else {
throwErrorOnMalformed(builder, "icmpv6Match", "icmpv6Type");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6Match in project openflowplugin by opendaylight.
the class OpenflowpluginTestCommandProvider method createICMPv6Match.
private static MatchBuilder createICMPv6Match() {
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());
// ipv4 version
final IpMatchBuilder ipmatch = new IpMatchBuilder();
ipmatch.setIpProtocol((short) 58);
match.setIpMatch(ipmatch.build());
// icmpv6
final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
// match
icmpv6match.setIcmpv6Type((short) 135);
icmpv6match.setIcmpv6Code((short) 1);
match.setIcmpv6Match(icmpv6match.build());
return match;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6Match in project openflowplugin by opendaylight.
the class MatchConvertor method convert.
@Override
public List<MatchEntry> convert(final Match source, final VersionConvertorData data) {
List<MatchEntry> result = new ArrayList<>();
if (source == null) {
return result;
}
final ExtensionConverterProvider extensionConvertorProvider = OFSessionUtil.getExtensionConvertorProvider();
inPortMatch(result, source.getInPort());
inPhyPortMatch(result, source.getInPhyPort());
metadataMatch(result, source.getMetadata());
ethernetMatch(result, source.getEthernetMatch());
vlanMatch(result, source.getVlanMatch());
ipMatch(result, source.getIpMatch());
layer4Match(result, source.getLayer4Match(), getConvertorExecutor(), extensionConvertorProvider);
icmpv4Match(result, source.getIcmpv4Match());
icmpv6Match(result, source.getIcmpv6Match());
layer3Match(result, source.getLayer3Match(), getConvertorExecutor(), extensionConvertorProvider);
protocolMatchFields(result, source.getProtocolMatchFields());
tunnelMatch(result, source.getTunnel());
tcpFlagsMatch(result, source.getTcpFlagsMatch());
/*
* TODO: EXTENSION PROPOSAL (source, MD-SAL to OFJava)
* - we might need version for conversion and for key
*/
Optional<GeneralExtensionListGrouping> extensionListOpt = ExtensionResolvers.getMatchExtensionResolver().getExtension(source);
if (extensionListOpt.isPresent()) {
List<ExtensionList> extensionListList = extensionListOpt.get().getExtensionList();
for (ExtensionList extensionItem : extensionListList) {
// TODO: get real version
ConverterExtensionKey<? extends ExtensionKey> key = new ConverterExtensionKey<>(extensionItem.getExtensionKey(), OFConstants.OFP_VERSION_1_3);
ConvertorToOFJava<MatchEntry> convertor = extensionConvertorProvider.getConverter(key);
if (convertor == null) {
throw new IllegalStateException("No converter found for key: " + key.toString());
}
MatchEntry ofMatch = convertor.convert(extensionItem.getExtension());
result.add(ofMatch);
}
}
return result;
}
Aggregations