Search in sources :

Example 1 with TcpSrcBuilder

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

the class TcpSrcConvertor method convert.

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

Example 2 with TcpSrcBuilder

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

the class OxmTcpSrcSerializerTest method prepareMatchEntry.

private static MatchEntryBuilder prepareMatchEntry(int value) {
    MatchEntryBuilder builder = prepareHeader(false);
    TcpSrcCaseBuilder casebuilder = new TcpSrcCaseBuilder();
    TcpSrcBuilder valueBuilder = new TcpSrcBuilder();
    valueBuilder.setPort(new PortNumber(value));
    casebuilder.setTcpSrc(valueBuilder.build());
    builder.setMatchEntryValue(casebuilder.build());
    return builder;
}
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) 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)

Example 3 with TcpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder 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 TcpSrcBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder 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)

Example 5 with TcpSrcBuilder

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

the class OxmTcpSrcDeserializer method addTcpSrcValue.

private static void addTcpSrcValue(ByteBuf input, MatchEntryBuilder builder) {
    TcpSrcCaseBuilder caseBuilder = new TcpSrcCaseBuilder();
    TcpSrcBuilder tcpBuilder = new TcpSrcBuilder();
    tcpBuilder.setPort(new PortNumber(input.readUnsignedShort()));
    caseBuilder.setTcpSrc(tcpBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}
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) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)

Aggregations

TcpSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCaseBuilder)6 TcpSrcBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.src._case.TcpSrcBuilder)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 Icmpv4TypeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4TypeCaseBuilder)3 Icmpv6TypeCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6TypeCaseBuilder)3 TcpDstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCaseBuilder)3 Icmpv4TypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.type._case.Icmpv4TypeBuilder)3 Icmpv6TypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.type._case.Icmpv6TypeBuilder)3 TcpDstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tcp.dst._case.TcpDstBuilder)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 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 EthSrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthSrcCaseBuilder)2