Search in sources :

Example 6 with Layer4Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match in project openflowplugin by opendaylight.

the class UdpDestinationPortEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final int port = message.readUnsignedShort();
    if (Objects.isNull(builder.getLayer4Match())) {
        builder.setLayer4Match(new UdpMatchBuilder().setUdpDestinationPort(new PortNumber(port)).build());
    } else if (UdpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(UdpMatch.class.cast(builder.getLayer4Match()).getUdpDestinationPort())) {
        builder.setLayer4Match(new UdpMatchBuilder(UdpMatch.class.cast(builder.getLayer4Match())).setUdpDestinationPort(new PortNumber(port)).build());
    } else {
        throwErrorOnMalformed(builder, "layer4Match", "udpDestinationPort");
    }
}
Also used : UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Example 7 with Layer4Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match in project openflowplugin by opendaylight.

the class SctpSourcePortEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final int port = message.readUnsignedShort();
    if (Objects.isNull(builder.getLayer4Match())) {
        builder.setLayer4Match(new SctpMatchBuilder().setSctpSourcePort(new PortNumber(port)).build());
    } else if (SctpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpSourcePort())) {
        builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match())).setSctpSourcePort(new PortNumber(port)).build());
    } else {
        throwErrorOnMalformed(builder, "layer4Match", "sctpSourcePort");
    }
}
Also used : SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) SctpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Example 8 with Layer4Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match in project openflowplugin by opendaylight.

the class UdpSourcePortEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final int port = message.readUnsignedShort();
    if (Objects.isNull(builder.getLayer4Match())) {
        builder.setLayer4Match(new UdpMatchBuilder().setUdpSourcePort(new PortNumber(port)).build());
    } else if (UdpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(UdpMatch.class.cast(builder.getLayer4Match()).getUdpSourcePort())) {
        builder.setLayer4Match(new UdpMatchBuilder(UdpMatch.class.cast(builder.getLayer4Match())).setUdpSourcePort(new PortNumber(port)).build());
    } else {
        throwErrorOnMalformed(builder, "layer4Match", "udpSourcePort");
    }
}
Also used : UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Example 9 with Layer4Match

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match in project openflowplugin by opendaylight.

the class MatchV10Convertor method convert.

@Override
public MatchV10 convert(final Match source, final VersionConvertorData data) {
    MatchV10Builder matchBuilder = new MatchV10Builder();
    boolean dlDst = true;
    boolean dlSsc = true;
    boolean dlType = true;
    boolean dlVlan = true;
    boolean dlVlanPcp = true;
    boolean ipPort = true;
    boolean nwProto = true;
    boolean nwTos = true;
    boolean tpDst = true;
    boolean tpSrc = true;
    matchBuilder.setInPort(0);
    matchBuilder.setDlDst(ZERO_MAC);
    matchBuilder.setDlSrc(ZERO_MAC);
    matchBuilder.setDlType(0);
    matchBuilder.setDlVlan(OFP_VLAN_NONE);
    matchBuilder.setDlVlanPcp((short) 0);
    matchBuilder.setNwDst(ZERO_IPV4);
    matchBuilder.setNwDstMask((short) 0);
    matchBuilder.setNwSrc(ZERO_IPV4);
    matchBuilder.setNwSrcMask((short) 0);
    matchBuilder.setNwProto((short) 0);
    matchBuilder.setNwTos((short) 0);
    matchBuilder.setTpSrc(0);
    matchBuilder.setTpDst(0);
    if (source != null) {
        EthernetMatch ethernetMatch = source.getEthernetMatch();
        if (ethernetMatch != null) {
            dlDst = convertEthernetDlDst(matchBuilder, ethernetMatch);
            dlSsc = convertEthernetDlSrc(matchBuilder, ethernetMatch);
            dlType = convertEthernetDlType(matchBuilder, ethernetMatch);
        }
        VlanMatch vlanMatch = source.getVlanMatch();
        if (vlanMatch != null) {
            dlVlan = convertDlVlan(matchBuilder, vlanMatch);
            dlVlanPcp = convertDlVlanPcp(matchBuilder, vlanMatch);
        }
        NodeConnectorId inPort = source.getInPort();
        if (inPort != null) {
            ipPort = convertInPortMatch(matchBuilder, inPort);
        }
        Layer3Match l3Match = source.getLayer3Match();
        if (l3Match != null) {
            if (l3Match instanceof Ipv4Match) {
                Ipv4Match ipv4 = (Ipv4Match) l3Match;
                convertL3Ipv4SrcMatch(matchBuilder, ipv4);
                convertL3Ipv4DstMatch(matchBuilder, ipv4);
            }
        }
        IpMatch ipMatch = source.getIpMatch();
        if (ipMatch != null) {
            nwProto = convertNwProto(matchBuilder, ipMatch);
            nwTos = convertNwTos(matchBuilder, ipMatch);
        }
        Layer4Match layer4Match = source.getLayer4Match();
        if (layer4Match != null) {
            if (layer4Match instanceof TcpMatch) {
                TcpMatch tcpMatch = (TcpMatch) layer4Match;
                tpSrc = convertL4TpSrcMatch(matchBuilder, tcpMatch);
                tpDst = convertL4TpDstMatch(matchBuilder, tcpMatch);
            } else if (layer4Match instanceof UdpMatch) {
                UdpMatch udpMatch = (UdpMatch) layer4Match;
                tpSrc = convertL4UdpSrcMatch(matchBuilder, udpMatch);
                tpDst = convertL4UdpDstMatch(matchBuilder, udpMatch);
            }
        } else {
            Icmpv4Match icmpv4Match = source.getIcmpv4Match();
            if (icmpv4Match != null) {
                Short type = icmpv4Match.getIcmpv4Type();
                if (type != null) {
                    matchBuilder.setTpSrc(type.intValue());
                    tpSrc = false;
                }
                Short code = icmpv4Match.getIcmpv4Code();
                if (code != null) {
                    matchBuilder.setTpDst(code.intValue());
                    tpDst = false;
                }
            }
        }
    }
    FlowWildcardsV10 wildCards = new FlowWildcardsV10(dlDst, dlSsc, dlType, dlVlan, dlVlanPcp, ipPort, nwProto, nwTos, tpDst, tpSrc);
    matchBuilder.setWildcards(wildCards);
    return matchBuilder.build();
}
Also used : Icmpv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4Match) Layer3Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) Ipv4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match) IpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch) EthernetMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch) TcpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch) FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) Layer4Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match) UdpMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch) VlanMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatch)

Aggregations

PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)6 TcpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch)4 UdpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch)4 Layer3Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match)2 Layer4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match)2 Ipv4Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match)2 SctpMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch)2 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)2 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)2 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1 FlowEntity (org.opendaylight.genius.mdsalutil.FlowEntity)1 ConverterExtensionKey (org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey)1 ExtensionConverterProvider (org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider)1 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)1 RemovedFlowReason (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.RemovedFlowReason)1 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)1 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 TcpMatchFields (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.TcpMatchFields)1