Search in sources :

Example 6 with SctpMatch

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

the class OpenflowpluginTestCommandProvider method createAppyActionInstruction41.

private static InstructionsBuilder createAppyActionInstruction41() {
    final List<Action> actionList = new ArrayList<>();
    final ActionBuilder ab = new ActionBuilder();
    final ActionBuilder ab1 = new ActionBuilder();
    final SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
    final SetFieldBuilder setFieldBuilder1 = new SetFieldBuilder();
    // Sctp
    final SctpMatchBuilder sctpmatch = new SctpMatchBuilder();
    final SctpMatchBuilder sctpmatch1 = new SctpMatchBuilder();
    final PortNumber srcport = new PortNumber(1435);
    final PortNumber dstport = new PortNumber(22);
    sctpmatch.setSctpSourcePort(srcport);
    sctpmatch1.setSctpDestinationPort(dstport);
    setFieldBuilder.setLayer4Match(sctpmatch.build());
    ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
    ab.setKey(new ActionKey(0));
    actionList.add(ab.build());
    setFieldBuilder1.setLayer4Match(sctpmatch1.build());
    ab1.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder1.build()).build());
    ab1.setKey(new ActionKey(1));
    actionList.add(ab1.build());
    final ApplyActionsBuilder aab = new ApplyActionsBuilder();
    aab.setAction(actionList);
    final InstructionBuilder ib = new InstructionBuilder();
    ib.setKey(new InstructionKey(0));
    ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
    // Put our Instruction in a list of Instructions
    final InstructionsBuilder isb = new InstructionsBuilder();
    final List<Instruction> instructions = new ArrayList<>();
    instructions.add(ib.build());
    isb.setInstruction(instructions);
    return isb;
}
Also used : SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) InstructionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder) DropAction(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction) Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) SetFieldCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder) ControllerActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder) LoopbackActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder) HwPathActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder) SetVlanIdActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder) DropActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder) SetVlanCfiActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder) PushPbbActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder) SetMplsTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder) PopMplsActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder) SetDlSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder) SetDlTypeActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder) SetTpDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder) SetNextHopActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder) PushVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder) SetNwTtlActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder) PopPbbActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder) SetNwTosActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder) SetTpSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder) SetNwDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder) GroupActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder) PushMplsActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder) PopVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder) OutputActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder) SwPathActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder) SetDlDstActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder) StripVlanActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder) FloodAllActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder) SetVlanPcpActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder) SetQueueActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder) SetNwSrcActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder) FloodActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) ArrayList(java.util.ArrayList) InstructionKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey) ActionKey(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey) Instruction(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction) SetFieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder) ApplyActionsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) ApplyActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder)

Example 7 with SctpMatch

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

the class TcpDestinationPortEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final int tcp = 10;
    final Match sctpMatch = new MatchBuilder().setLayer4Match(new TcpMatchBuilder().setTcpDestinationPort(new PortNumber(tcp)).build()).build();
    assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
Also used : TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 8 with SctpMatch

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

the class TcpSourcePortEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final int tcp = 10;
    final Match sctpMatch = new MatchBuilder().setLayer4Match(new TcpMatchBuilder().setTcpSourcePort(new PortNumber(tcp)).build()).build();
    assertMatch(sctpMatch, false, (out) -> assertEquals(out.readUnsignedShort(), tcp));
}
Also used : TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 9 with SctpMatch

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

the class SctpSourcePortEntrySerializerTest method testSerialize.

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

Example 10 with SctpMatch

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

the class SalToOfSctpMatchCase method process.

@Override
public Optional<List<MatchEntry>> process(@Nonnull SctpMatch source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
    List<MatchEntry> result = new ArrayList<>();
    if (source.getSctpSourcePort() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(SctpSrc.class);
        SctpSrcCaseBuilder sctpSrcCaseBuilder = new SctpSrcCaseBuilder();
        SctpSrcBuilder sctpSrcBuilder = new SctpSrcBuilder();
        sctpSrcBuilder.setPort(source.getSctpSourcePort());
        sctpSrcCaseBuilder.setSctpSrc(sctpSrcBuilder.build());
        matchEntryBuilder.setMatchEntryValue(sctpSrcCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    if (source.getSctpDestinationPort() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(SctpDst.class);
        SctpDstCaseBuilder sctpDstCaseBuilder = new SctpDstCaseBuilder();
        SctpDstBuilder sctpDstBuilder = new SctpDstBuilder();
        sctpDstBuilder.setPort(source.getSctpDestinationPort());
        sctpDstCaseBuilder.setSctpDst(sctpDstBuilder.build());
        matchEntryBuilder.setMatchEntryValue(sctpDstCaseBuilder.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) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) SctpDstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.sctp.dst._case.SctpDstBuilder) ArrayList(java.util.ArrayList) SctpSrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.sctp.src._case.SctpSrcBuilder) SctpDstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpDstCaseBuilder) SctpSrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpSrcCaseBuilder)

Aggregations

PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)8 Test (org.junit.Test)7 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)7 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)6 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)4 ArrayList (java.util.ArrayList)3 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)3 UdpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder)3 BigInteger (java.math.BigInteger)1 VersionDatapathIdConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionDatapathIdConvertorData)1 SetFieldCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder)1 ControllerActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder)1 DropAction (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction)1 DropActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder)1 FloodActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder)1 FloodAllActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder)1 GroupActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder)1 HwPathActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder)1 LoopbackActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder)1 OutputActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder)1