Search in sources :

Example 1 with Icmpv6Match

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;
}
Also used : IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 2 with Icmpv6Match

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");
    }
}
Also used : Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)

Example 3 with Icmpv6Match

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");
    }
}
Also used : Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)

Example 4 with Icmpv6Match

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;
}
Also used : IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 5 with Icmpv6Match

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;
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) ExtensionConverterProvider(org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider) ExtensionList(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionList) ArrayList(java.util.ArrayList) GeneralExtensionListGrouping(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralExtensionListGrouping) ConverterExtensionKey(org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey)

Aggregations

Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)8 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)5 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType)5 EthernetTypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder)5 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)5 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)5 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)5 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)5 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)3 TcpFlagsMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder)3 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)3 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)3 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)3 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)3 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)3 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)3 ArrayList (java.util.ArrayList)2 Ipv6FlowLabel (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 Ipv6ExtHeaderBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder)2