Search in sources :

Example 1 with UdpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder in project openflowplugin by opendaylight.

the class OxmUdpSrcDeserializer method addUdpSrcValue.

private static void addUdpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
    UdpSrcCaseBuilder caseBuilder = new UdpSrcCaseBuilder();
    UdpSrcBuilder udpBuilder = new UdpSrcBuilder();
    udpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setUdpSrc(udpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}
Also used : UdpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder) UdpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Example 2 with UdpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder in project openflowplugin by opendaylight.

the class OxmUdpSrcSerializerTest method prepareMatchEntry.

private static MatchEntryBuilder prepareMatchEntry(int value) {
    MatchEntryBuilder builder = prepareHeader(false);
    UdpSrcCaseBuilder casebuilder = new UdpSrcCaseBuilder();
    UdpSrcBuilder valueBuilder = new UdpSrcBuilder();
    valueBuilder.setPort(new PortNumber(value));
    casebuilder.setUdpSrc(valueBuilder.build());
    builder.setMatchEntryValue(casebuilder.build());
    return builder;
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) UdpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder) UdpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Example 3 with UdpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder in project openflowplugin by opendaylight.

the class UdpSrcConvertor method convert.

@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    UdpSrcCaseValue udpSrcCaseValue = (UdpSrcCaseValue) input.getMatchEntryValue();
    NxmOfUdpSrcBuilder udpSrcBuilder = new NxmOfUdpSrcBuilder();
    udpSrcBuilder.setPort(udpSrcCaseValue.getUdpSrcValues().getPort());
    udpSrcBuilder.setMask(udpSrcCaseValue.getUdpSrcValues().getMask());
    return resolveAugmentation(udpSrcBuilder.build(), path, NxmOfUdpSrcKey.class);
}
Also used : NxmOfUdpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.src.grouping.NxmOfUdpSrcBuilder) UdpSrcCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue)

Example 4 with UdpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder in project openflowplugin by opendaylight.

the class SalToOfUdpMatchCase method process.

@Override
public Optional<List<MatchEntry>> process(@Nonnull UdpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
    List<MatchEntry> result = new ArrayList<>();
    if (source.getUdpSourcePort() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(UdpSrc.class);
        UdpSrcCaseBuilder udpSrcCaseBuilder = new UdpSrcCaseBuilder();
        UdpSrcBuilder udpSrcBuilder = new UdpSrcBuilder();
        udpSrcBuilder.setPort(source.getUdpSourcePort());
        udpSrcCaseBuilder.setUdpSrc(udpSrcBuilder.build());
        matchEntryBuilder.setMatchEntryValue(udpSrcCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    if (source.getUdpDestinationPort() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(UdpDst.class);
        UdpDstCaseBuilder udpDstCaseBuilder = new UdpDstCaseBuilder();
        UdpDstBuilder udpDstBuilder = new UdpDstBuilder();
        udpDstBuilder.setPort(source.getUdpDestinationPort());
        udpDstCaseBuilder.setUdpDst(udpDstBuilder.build());
        matchEntryBuilder.setMatchEntryValue(udpDstCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    return Optional.of(result);
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) UdpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) UdpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder) ArrayList(java.util.ArrayList) UdpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCaseBuilder) UdpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.dst._case.UdpDstBuilder)

Example 5 with UdpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder in project openflowplugin by opendaylight.

the class SalToOfSetTpSrcActionCase method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetTpSrcActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    IPProtocols protocol = null;
    if (data.getIpProtocol() != null) {
        protocol = IPProtocols.fromProtocolNum(data.getIpProtocol());
    }
    SetTpSrcAction settpsrcaction = source.getSetTpSrcAction();
    MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
    matchBuilder.setOxmClass(OpenflowBasicClass.class);
    matchBuilder.setHasMask(false);
    int port = settpsrcaction.getPort().getValue();
    int type = 0xff & port;
    if (protocol != null) {
        switch(protocol) {
            case ICMP:
                matchBuilder.setOxmMatchField(Icmpv4Type.class);
                Icmpv4TypeCaseBuilder icmpv4TypeCaseBuilder = new Icmpv4TypeCaseBuilder();
                Icmpv4TypeBuilder icmpv4TypeBuilder = new Icmpv4TypeBuilder();
                icmpv4TypeBuilder.setIcmpv4Type((short) type);
                icmpv4TypeCaseBuilder.setIcmpv4Type(icmpv4TypeBuilder.build());
                matchBuilder.setMatchEntryValue(icmpv4TypeCaseBuilder.build());
                break;
            case ICMPV6:
                matchBuilder.setOxmMatchField(Icmpv6Type.class);
                Icmpv6TypeCaseBuilder icmpv6TypeCaseBuilder = new Icmpv6TypeCaseBuilder();
                Icmpv6TypeBuilder icmpv6TypeBuilder = new Icmpv6TypeBuilder();
                icmpv6TypeBuilder.setIcmpv6Type((short) type);
                icmpv6TypeCaseBuilder.setIcmpv6Type(icmpv6TypeBuilder.build());
                matchBuilder.setMatchEntryValue(icmpv6TypeCaseBuilder.build());
                break;
            case TCP:
                matchBuilder.setOxmMatchField(TcpSrc.class);
                TcpSrcCaseBuilder tcpSrcCaseBuilder = new TcpSrcCaseBuilder();
                TcpSrcBuilder tcpSrcBuilder = new TcpSrcBuilder();
                tcpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port));
                tcpSrcCaseBuilder.setTcpSrc(tcpSrcBuilder.build());
                matchBuilder.setMatchEntryValue(tcpSrcCaseBuilder.build());
                break;
            case UDP:
                matchBuilder.setOxmMatchField(UdpSrc.class);
                UdpSrcCaseBuilder udpSrcCaseBuilder = new UdpSrcCaseBuilder();
                UdpSrcBuilder udpSrcBuilder = new UdpSrcBuilder();
                udpSrcBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port));
                udpSrcCaseBuilder.setUdpSrc(udpSrcBuilder.build());
                matchBuilder.setMatchEntryValue(udpSrcCaseBuilder.build());
                break;
            default:
                LOG.warn("Unknown protocol with combination of SetSourcePort: {}", protocol);
                break;
        }
    } else {
        LOG.warn("Null protocol with combination of SetSourcePort");
    }
    List<MatchEntry> entries = new ArrayList<>();
    entries.add(matchBuilder.build());
    SetFieldActionBuilder setFieldBuilder = new SetFieldActionBuilder();
    setFieldBuilder.setMatchEntry(entries);
    SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
    setFieldCaseBuilder.setSetFieldAction(setFieldBuilder.build());
    return Optional.of(new ActionBuilder().setActionChoice(setFieldCaseBuilder.build()).build());
}
Also used : SetFieldCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCaseBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder) ArrayList(java.util.ArrayList) Icmpv6TypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6TypeCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Icmpv6TypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.type._case.Icmpv6TypeBuilder) UdpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder) IPProtocols(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) UdpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCaseBuilder) TcpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder) SetTpSrcAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcAction) Icmpv4TypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.type._case.Icmpv4TypeBuilder) Icmpv4TypeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4TypeCaseBuilder) TcpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder) Nonnull(javax.annotation.Nonnull)

Aggregations

UdpSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCaseBuilder)6 UdpSrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.src._case.UdpSrcBuilder)6 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)5 ArrayList (java.util.ArrayList)4 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)4 UdpDstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCaseBuilder)3 UdpDstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.dst._case.UdpDstBuilder)3 Test (org.junit.Test)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 Icmpv4TypeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4TypeCaseBuilder)2 Icmpv6TypeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6TypeCaseBuilder)2 TcpSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder)2 Icmpv4TypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.type._case.Icmpv4TypeBuilder)2 Icmpv6TypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.type._case.Icmpv6TypeBuilder)2 TcpSrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder)2 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder)2 ByteBuf (io.netty.buffer.ByteBuf)1 BigInteger (java.math.BigInteger)1 Nonnull (javax.annotation.Nonnull)1 IPProtocols (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols)1