Search in sources :

Example 36 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber 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 37 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.

the class OxmInPortDeserializer method addInPortValue.

private static void addInPortValue(ByteBuf input, MatchEntryBuilder builder) {
    InPortCaseBuilder caseBuilder = new InPortCaseBuilder();
    InPortBuilder inPortBuilder = new InPortBuilder();
    inPortBuilder.setPortNumber(new PortNumber(input.readUnsignedInt()));
    caseBuilder.setInPort(inPortBuilder.build());
    builder.setMatchEntryValue(caseBuilder.build());
}
Also used : InPortCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder) InPortBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)

Example 38 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.

the class SctpDestinationPortEntryDeserializer 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().setSctpDestinationPort(new PortNumber(port)).build());
    } else if (SctpMatch.class.isInstance(builder.getLayer4Match()) && Objects.isNull(SctpMatch.class.cast(builder.getLayer4Match()).getSctpDestinationPort())) {
        builder.setLayer4Match(new SctpMatchBuilder(SctpMatch.class.cast(builder.getLayer4Match())).setSctpDestinationPort(new PortNumber(port)).build());
    } else {
        throwErrorOnMalformed(builder, "layer4Match", "sctpDestinationPort");
    }
}
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 39 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.

the class UdpDestinationPortEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final int tcp = 10;
    final Match sctpMatch = new MatchBuilder().setLayer4Match(new UdpMatchBuilder().setUdpDestinationPort(new PortNumber(tcp)).build()).build();
    assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
Also used : 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) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 40 with PortNumber

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber in project openflowplugin by opendaylight.

the class SetTpSrcActionSerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final PortNumber port = new PortNumber(20);
    // TCP
    final short protocol = 6;
    final Action action = new SetTpSrcActionCaseBuilder().setSetTpSrcAction(new SetTpSrcActionBuilder().setPort(port).setIpProtocol(protocol).build()).build();
    assertAction(action, out -> assertEquals(Integer.valueOf(out.readUnsignedShort()), port.getValue()));
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) SetTpSrcActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder) Test(org.junit.Test)

Aggregations

PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)98 PortNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber)81 Test (org.junit.Test)72 ArrayList (java.util.ArrayList)50 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)33 ByteBuf (io.netty.buffer.ByteBuf)29 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)29 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)26 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)23 BigInteger (java.math.BigInteger)21 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder)19 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)18 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)17 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)17 OutputActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder)17 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)16 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)16 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)14 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)13 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)12