Search in sources :

Example 1 with TcpDstBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder in project openflowplugin by opendaylight.

the class OxmTcpDstDeserializer method addTcpDstValue.

private static void addTcpDstValue(ByteBuf input, MatchEntryBuilder builder) {
    TcpDstCaseBuilder caseBuilder = new TcpDstCaseBuilder();
    TcpDstBuilder tcpBuilder = new TcpDstBuilder();
    tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setTcpDst(tcpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}
Also used : TcpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TcpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder)

Example 2 with TcpDstBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder in project openflowplugin by opendaylight.

the class OxmTcpDstSerializerTest method prepareMatchEntry.

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

Example 3 with TcpDstBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder in project openflowplugin by opendaylight.

the class SalToOfTcpMatchCase method process.

@Override
public Optional<List<MatchEntry>> process(@Nonnull TcpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
    List<MatchEntry> result = new ArrayList<>();
    if (source.getTcpSourcePort() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(TcpSrc.class);
        TcpSrcCaseBuilder tcpSrcCaseBuilder = new TcpSrcCaseBuilder();
        TcpSrcBuilder tcpSrcBuilder = new TcpSrcBuilder();
        tcpSrcBuilder.setPort(source.getTcpSourcePort());
        tcpSrcCaseBuilder.setTcpSrc(tcpSrcBuilder.build());
        matchEntryBuilder.setMatchEntryValue(tcpSrcCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    if (source.getTcpDestinationPort() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(TcpDst.class);
        TcpDstCaseBuilder tcpDstCaseBuilder = new TcpDstCaseBuilder();
        TcpDstBuilder tcpDstBuilder = new TcpDstBuilder();
        tcpDstBuilder.setPort(source.getTcpDestinationPort());
        tcpDstCaseBuilder.setTcpDst(tcpDstBuilder.build());
        matchEntryBuilder.setMatchEntryValue(tcpDstCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    return Optional.of(result);
}
Also used : TcpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder) TcpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) TcpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) ArrayList(java.util.ArrayList) TcpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder)

Example 4 with TcpDstBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder in project openflowplugin by opendaylight.

the class SalToOfSetTpDstActionCase method process.

@Nonnull
@Override
public Optional<Action> process(@Nonnull final SetTpDstActionCase source, final ActionConvertorData data, ConvertorExecutor convertorExecutor) {
    IPProtocols protocol = null;
    if (data.getIpProtocol() != null) {
        protocol = IPProtocols.fromProtocolNum(data.getIpProtocol());
    }
    SetTpDstAction settpdstaction = source.getSetTpDstAction();
    MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
    matchBuilder.setOxmClass(OpenflowBasicClass.class);
    matchBuilder.setHasMask(false);
    int port = settpdstaction.getPort().getValue();
    int code = 0xff & port;
    if (protocol != null) {
        switch(protocol) {
            case ICMP:
                matchBuilder.setOxmMatchField(Icmpv4Code.class);
                Icmpv4CodeCaseBuilder icmpv4CodeCaseBuilder = new Icmpv4CodeCaseBuilder();
                Icmpv4CodeBuilder icmpv4CodeBuilder = new Icmpv4CodeBuilder();
                icmpv4CodeBuilder.setIcmpv4Code((short) code);
                icmpv4CodeCaseBuilder.setIcmpv4Code(icmpv4CodeBuilder.build());
                matchBuilder.setMatchEntryValue(icmpv4CodeCaseBuilder.build());
                break;
            case ICMPV6:
                matchBuilder.setOxmMatchField(Icmpv6Code.class);
                Icmpv6CodeCaseBuilder icmpv6CodeCaseBuilder = new Icmpv6CodeCaseBuilder();
                Icmpv6CodeBuilder icmpv6CodeBuilder = new Icmpv6CodeBuilder();
                icmpv6CodeBuilder.setIcmpv6Code((short) code);
                icmpv6CodeCaseBuilder.setIcmpv6Code(icmpv6CodeBuilder.build());
                matchBuilder.setMatchEntryValue(icmpv6CodeCaseBuilder.build());
                break;
            case TCP:
                matchBuilder.setOxmMatchField(TcpDst.class);
                TcpDstCaseBuilder tcpDstCaseBuilder = new TcpDstCaseBuilder();
                TcpDstBuilder tcpDstBuilder = new TcpDstBuilder();
                tcpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port));
                tcpDstCaseBuilder.setTcpDst(tcpDstBuilder.build());
                matchBuilder.setMatchEntryValue(tcpDstCaseBuilder.build());
                break;
            case UDP:
                matchBuilder.setOxmMatchField(UdpDst.class);
                UdpDstCaseBuilder udpDstCaseBuilder = new UdpDstCaseBuilder();
                UdpDstBuilder udpDstBuilder = new UdpDstBuilder();
                udpDstBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber(port));
                udpDstCaseBuilder.setUdpDst(udpDstBuilder.build());
                matchBuilder.setMatchEntryValue(udpDstCaseBuilder.build());
                break;
            default:
                LOG.warn("Unknown protocol with combination of SetSourcePort: {}", protocol);
                break;
        }
    } else {
        LOG.warn("Missing 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) TcpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) IPProtocols(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IPProtocols) Icmpv4CodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4CodeCaseBuilder) Icmpv4CodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.code._case.Icmpv4CodeBuilder) SetFieldActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.field._case.SetFieldActionBuilder) SetTpDstAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstAction) UdpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCaseBuilder) UdpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.udp.dst._case.UdpDstBuilder) TcpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder) Icmpv6CodeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.code._case.Icmpv6CodeBuilder) Icmpv6CodeCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6CodeCaseBuilder) Nonnull(javax.annotation.Nonnull)

Example 5 with TcpDstBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder in project openflowplugin by opendaylight.

the class TcpDstConvertor method convert.

@Override
public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
    TcpDstCaseValue tcpDstCaseValue = (TcpDstCaseValue) input.getMatchEntryValue();
    NxmOfTcpDstBuilder tcpDstBuilder = new NxmOfTcpDstBuilder();
    tcpDstBuilder.setPort(tcpDstCaseValue.getTcpDstValues().getPort());
    tcpDstBuilder.setMask(tcpDstCaseValue.getTcpDstValues().getMask());
    return resolveAugmentation(tcpDstBuilder.build(), path, NxmOfTcpDstKey.class);
}
Also used : TcpDstCaseValue(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue) NxmOfTcpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.tcp.dst.grouping.NxmOfTcpDstBuilder)

Aggregations

TcpDstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder)6 TcpDstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder)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 Icmpv4CodeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4CodeCaseBuilder)3 Icmpv6CodeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6CodeCaseBuilder)3 TcpSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder)3 Icmpv4CodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.code._case.Icmpv4CodeBuilder)3 Icmpv6CodeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.code._case.Icmpv6CodeBuilder)3 TcpSrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder)3 Test (org.junit.Test)2 Dscp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 EtherType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType)2 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)2 IpDscp (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp)2 EthDstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthDstCaseBuilder)2